Intermediate
30 min

Be charged up and unstoppable with ISL78693 and PIC32MZ1024EFH064

Experience charging at its finest!

Charger 23 Click with PIC32MZ clicker

Published May 14, 2023

Click board™

Charger 23 Click

Dev. board

PIC32MZ clicker

Compiler

NECTO Studio

MCU

PIC32MZ1024EFH064

The easy-to-use and intuitive battery charger can save you time and effort while improving your solution's functionality

A

A

Hardware Overview

How does it work?

Charger 23 Click is based on the ISL78693, an integrated charger for single-cell Lithium chemistry batteries from Renesas. The ISL78693 functions as a traditional linear charger. The ISL78693 charges a battery as a linear charger in the Constant Current (CC) and Constant Voltage (CV) profile. Its constant charge current is selectable via onboard jumper CURR SEL between 250 and 500mA. The charge voltage is also characterized by an accuracy of 1% over the entire recommended operating condition range. The charger automatically recharges the battery when the voltage typically drops below a recharge threshold of 3.3V. When the input supply is absent, the ISL78693 draws less than 1µA current from the battery. This Click board™ communicates with the host MCU using several pins of the mikroBUS™ socket.

The charger can be enabled or disabled using the EN pin of the mikroBUS™ socket, offering a switch operation to turn the ON/OFF charger. In addition, the ISL78693 also has two indication signals to indicate the charge status. The ST pin is a status open-drain that turns to a low logic state at the beginning of a charge cycle until the End-of-charge (EOC) condition is qualified. Once the EOC condition is qualified, the ST pin goes to a HIGH logic state. The fault pin (FLT) turns low when fault conditions occur, such as the external battery temperature fault, a charge time fault, or battery removal. Besides mikroBUS™ pins, their visual representation is also via red and yellow LEDs marked with STATUS and FAULT. An NTC function is also available to monitor the battery temperature and ensure a safe charging temperature range.

Apart from monitoring, it is also possible to detect the removal of the battery. To use this function, switching the SEN EN jumper to the YES position and connecting an external NTC to the SENSE header pins is necessary. This Click board™ can only be operated from a 5V logic voltage level. Therefore, the board must perform appropriate logic voltage conversion before using MCUs with different logic levels. Additionally, there is a possibility for the ISL78693 power supply selection via jumper labeled as VIN SEL to supply the ISL78693 from an external 5V power supply or with a 5V mikroBUS™ power rail. However, the Click board™ comes equipped with a library containing easy-to-use functions and an example code that can be used, as a reference, for further development.

Charger 23 Click hardware overview image

Features overview

Development board

PIC32MZ Clicker is a compact starter development board that brings the flexibility of add-on Click boards™ to your favorite microcontroller, making it a perfect starter kit for implementing your ideas. It comes with an onboard 32-bit PIC32MZ microcontroller with FPU from Microchip, a USB connector, LED indicators, buttons, a mikroProg connector, and a header for interfacing with external electronics. Thanks to its compact design with clear and easy-recognizable silkscreen markings, it provides a fluid and immersive working experience, allowing access anywhere and under

any circumstances. Each part of the PIC32MZ Clicker development kit contains the components necessary for the most efficient operation of the same board. In addition to the possibility of choosing the PIC32MZ Clicker programming method, using USB HID mikroBootloader, or through an external mikroProg connector for PIC, dsPIC, or PIC32 programmer, the Clicker board also includes a clean and regulated power supply module for the development kit. The USB Micro-B connection can provide up to 500mA of current, which is more than enough to operate all onboard

and additional modules. All communication methods that mikroBUS™ itself supports are on this board, including the well-established mikroBUS™ socket, reset button, and several buttons and LED indicators. PIC32MZ Clicker is an integral part of the Mikroe ecosystem, allowing you to create a new application in minutes. Natively supported by Mikroe software tools, it covers many aspects of prototyping thanks to a considerable number of different Click boards™ (over a thousand boards), the number of which is growing every day.

PIC32MZ clicker double side image

Microcontroller Overview

MCU Card / MCU

default

Architecture

PIC32

MCU Memory (KB)

1024

Silicon Vendor

Microchip

Pin count

64

RAM (Bytes)

524288

You complete me!

Accessories

Li-Polymer Battery is the ideal solution for devices that demand a dependable and long-lasting power supply while emphasizing mobility. Its compatibility with mikromedia boards ensures easy integration without additional modifications. With a voltage output of 3.7V, the battery meets the standard requirements of many electronic devices. Additionally, boasting a capacity of 2000mAh, it can store a substantial amount of energy, providing sustained power for extended periods. This feature minimizes the need for frequent recharging or replacement. Overall, the Li-Polymer Battery is a reliable and autonomous power source, ideally suited for devices requiring a stable and enduring energy solution. You can find a more extensive choice of Li-Polymer batteries in our offer.

Charger 23 Click accessories image

Used MCU Pins

mikroBUS™ mapper

Charge Status
RE4
AN
Enable
RE5
RST
NC
NC
CS
NC
NC
SCK
NC
NC
MISO
NC
NC
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
NC
NC
PWM
Fault Indicator
RB5
INT
NC
NC
TX
NC
NC
RX
NC
NC
SCL
NC
NC
SDA
Power Supply
5V
5V
Ground
GND
GND
1

Take a closer look

Click board™ Schematic

Charger 23 Click Schematic schematic

Step by step

Project assembly

PIC32MZ clicker front image hardware assembly

Start by selecting your development board and Click board™. Begin with the PIC32MZ clicker as your development board.

PIC32MZ clicker front image hardware assembly
GNSS2 Click front image hardware assembly
Prog-cut hardware assembly
GNSS2 Click complete accessories setup image hardware assembly
Micro B Connector Clicker Access - upright/background hardware assembly
Necto image step 2 hardware assembly
Necto image step 3 hardware assembly
Necto image step 4 hardware assembly
Necto image step 5 hardware assembly
Necto image step 6 hardware assembly
Flip&Click PIC32MZ MCU step hardware assembly
Necto No Display image step 8 hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Debug Image Necto Step hardware assembly

Track your results in real time

Application Output

1. Application Output - In Debug mode, the 'Application Output' window enables real-time data monitoring, offering direct insight into execution results. Ensure proper data display by configuring the environment correctly using the provided tutorial.

2. UART Terminal - Use the UART Terminal to monitor data transmission via a USB to UART converter, allowing direct communication between the Click board™ and your development system. Configure the baud rate and other serial settings according to your project's requirements to ensure proper functionality. For step-by-step setup instructions, refer to the provided tutorial.

3. Plot Output - The Plot feature offers a powerful way to visualize real-time sensor data, enabling trend analysis, debugging, and comparison of multiple data points. To set it up correctly, follow the provided tutorial, which includes a step-by-step example of using the Plot feature to display Click board™ readings. To use the Plot feature in your code, use the function: plot(*insert_graph_name*, variable_name);. This is a general format, and it is up to the user to replace 'insert_graph_name' with the actual graph name and 'variable_name' with the parameter to be displayed.

Software Support

Library Description

This library contains API for Charger 23 Click driver.

Key functions:

  • charger23_enable_device This function enables the device by setting the EN pin to HIGH logic state.

  • charger23_disable_device This function disables the device by setting the EN pin to LOW logic state.

  • charger23_get_charger_state TThis function returns the charger state.

Open Source

Code example

The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.

/*!
 * @file main.c
 * @brief Charger 23 Click Example.
 *
 * # Description
 * This example demonstrates the use of Charger 23 Click board by enabling the device
 * and then reading and displaying the charger status.
 *
 * The demo application is composed of two sections :
 *
 * ## Application Init
 * Initializes the driver and enables the device.
 *
 * ## Application Task
 * Reads the charger state and displays it on the USB UART on change.
 *
 * @note
 * Depending on the CURR SEL onboard jumper position this Click board is able to
 * charge batteries of 250mAh or 500mAh rated capacity.
 *
 * @author Stefan Filipovic
 *
 */

#include "board.h"
#include "log.h"
#include "charger23.h"

static charger23_t charger23;   /**< Charger 23 Click driver object. */
static log_t logger;    /**< Logger object. */

void application_init ( void ) 
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    charger23_cfg_t charger23_cfg;  /**< Click config object. */

    /** 
     * Logger initialization.
     * Default baud rate: 115200
     * Default log level: LOG_LEVEL_DEBUG
     * @note If USB_UART_RX and USB_UART_TX 
     * are defined as HAL_PIN_NC, you will 
     * need to define them manually for log to work. 
     * See @b LOG_MAP_USB_UART macro definition for detailed explanation.
     */
    LOG_MAP_USB_UART( log_cfg );
    log_init( &logger, &log_cfg );
    log_info( &logger, " Application Init " );

    // Click initialization.
    charger23_cfg_setup( &charger23_cfg );
    CHARGER23_MAP_MIKROBUS( charger23_cfg, MIKROBUS_1 );
    if ( DIGITAL_OUT_UNSUPPORTED_PIN == charger23_init( &charger23, &charger23_cfg ) ) 
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }
    
    charger23_enable_device ( &charger23 );
    log_info( &logger, " Application Task " );
}

void application_task ( void ) 
{
    static uint8_t chg_state_old = CHARGER23_STATE_UNKNOWN;
    uint8_t chg_state = charger23_get_charger_state ( &charger23 );
    if ( chg_state_old != chg_state )
    {
        chg_state_old = chg_state;
        log_printf( &logger, "\r\n Charger state: " );
        switch ( chg_state )
        {
            case CHARGER23_STATE_IDLE:
            {
                log_printf( &logger, "Charge completed with no fault (Inhibit) or Standby\r\n" );
                break;
            }
            case CHARGER23_STATE_CHARGING:
            {
                log_printf( &logger, "Charging in one of the three modes\r\n" );
                break;
            }
            case CHARGER23_STATE_FAULT:
            {
                log_printf( &logger, "Fault\r\n" );
                break;
            }
            default:
            {
                log_printf( &logger, "Unknown\r\n" );
                break;
            }
        }
        Delay_ms ( 100 );
    }
}

int main ( void ) 
{
    /* Do not remove this line or clock might not be set correctly. */
    #ifdef PREINIT_SUPPORTED
    preinit();
    #endif
    
    application_init( );
    
    for ( ; ; ) 
    {
        application_task( );
    }

    return 0;
}

// ------------------------------------------------------------------------ END

Additional Support

Resources

Love this project?

'Buy This Kit' button takes you directly to the shopping cart where you can easily add or remove products.