TOP Contributors

  1. MIKROE (2762 codes)
  2. Alcides Ramos (374 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (118 codes)
  5. Bugz Bensce (90 codes)
  6. S P (73 codes)
  7. dany (71 codes)
  8. MikroBUS.NET Team (35 codes)
  9. NART SCHINACKOW (34 codes)
  10. Armstrong Subero (27 codes)

Most Downloaded

  1. Timer Calculator (139251 times)
  2. FAT32 Library (71748 times)
  3. Network Ethernet Library (57120 times)
  4. USB Device Library (47430 times)
  5. Network WiFi Library (43082 times)
  6. FT800 Library (42403 times)
  7. GSM click (29835 times)
  8. mikroSDK (28077 times)
  9. PID Library (26885 times)
  10. microSD click (26198 times)
Libstock prefers package manager

Package Manager

We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]

< Back
mikroSDK Library

Balancer 4 Click

Rating:

0

Author: MIKROE

Last Updated: 2024-10-31

Package Version: 2.1.0.6

mikroSDK Library: 2.0.0.0

Category: Battery Charger

Downloaded: 97 times

Not followed.

License: MIT license  

Balancer 4 Click is a compact add-on board optimized for overvoltage protection balancing the voltage of serially connected batteries. This board features the MP2672A, a highly integrated, flexible switch-mode battery charger for Lithium-Ion batteries with two cells in series from Monolithic Power Systems (MPS). The MP2672A has a narrow voltage DC (NVDC) power structure and monitors the voltage across each cell, equalizing the cell�s voltages if the difference between the two cells exceeds the mismatch threshold. It also has two selective operating modes with configurable output current up to 2A via register setting via I2C serial interface, alongside selectable MP2672A power supply, LED indication, and protection features allowing a reliable operation.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "Balancer 4 Click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "Balancer 4 Click" changes.

Do you want to report abuse regarding "Balancer 4 Click".

  • Information
  • Comments (0)

mikroSDK Library Blog


Balancer 4 Click

Balancer 4 Click is a compact add-on board optimized for overvoltage protection balancing the voltage of serially connected batteries. This board features the MP2672A, a highly integrated, flexible switch-mode battery charger for Lithium-Ion batteries with two cells in series from Monolithic Power Systems (MPS). The MP2672A has a narrow voltage DC (NVDC) power structure and monitors the voltage across each cell, equalizing the cell’s voltages if the difference between the two cells exceeds the mismatch threshold. It also has two selective operating modes with configurable output current up to 2A via register setting via I2C serial interface, alongside selectable MP2672A power supply, LED indication, and protection features allowing a reliable operation.

balancer4_click.png

Click Product page


Click library

  • Author : Stefan Filipovic
  • Date : Jan 2022.
  • Type : I2C type

Software Support

We provide a library for the Balancer 4 Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.

Package can be downloaded/installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Library Description

This library contains API for Balancer 4 Click driver.

Standard key functions :

  • balancer4_cfg_setup Config Object Initialization function.

    void balancer4_cfg_setup ( balancer4_cfg_t *cfg );
  • balancer4_init Initialization function.

    err_t balancer4_init ( balancer4_t *ctx, balancer4_cfg_t *cfg );
  • balancer4_default_cfg Click Default Configuration function.

    err_t balancer4_default_cfg ( balancer4_t *ctx );

Example key functions :

  • balancer4_write_register This function writes a desired data byte to the selected register by using I2C serial interface.

    err_t balancer4_write_register ( balancer4_t *ctx, uint8_t reg, uint8_t data_in );
  • balancer4_write_and_verify_register This function writes a desired data byte to the selected register and verifies if is is written correctly by reading it.

    err_t balancer4_write_and_verify_register ( balancer4_t *ctx, uint8_t reg, uint8_t data_in );
  • balancer4_read_register This function reads a data byte from the selected register by using I2C serial interface.

    err_t balancer4_read_register ( balancer4_t *ctx, uint8_t reg, uint8_t *data_out );

Example Description

This example demonstrates the use of Balancer 4 Click board by configuring the Click board for charging and then reading the status and fault registers.

The demo application is composed of two sections :

Application Init

Initializes the driver and configures the Click board for charging.


void application_init ( void )
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    balancer4_cfg_t balancer4_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.
    balancer4_cfg_setup( &balancer4_cfg );
    BALANCER4_MAP_MIKROBUS( balancer4_cfg, MIKROBUS_1 );
    if ( I2C_MASTER_ERROR == balancer4_init( &balancer4, &balancer4_cfg ) ) 
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }

    if ( BALANCER4_ERROR == balancer4_default_cfg ( &balancer4 ) )
    {
        log_error( &logger, " Default configuration." );
        for ( ; ; );
    }

    log_info( &logger, " Application Task " );
}

Application Task

Reads and displays the status and fault registers on the USB UART every 500ms approximately.

void application_task ( void )
{
    uint8_t status, fault;
    if ( BALANCER4_OK == balancer4_read_register ( &balancer4, BALANCER4_REG_STATUS, &status ) )
    {
        log_printf ( &logger, "\r\n - STATUS - \r\n", status );
        log_printf ( &logger, " Battery status: " );
        if ( status & BALANCER4_STATUS_BATTERY_MISSING )
        {
            log_printf ( &logger, "missing\r\n" );
        }
        else
        {
            log_printf ( &logger, "present\r\n" );
            log_printf ( &logger, " Charging status: " );
            switch ( status & BALANCER4_STATUS_CHG_STAT_MASK )
            {
                case BALANCER4_STATUS_NOT_CHARGING:
                {
                    log_printf ( &logger, "not charging\r\n" );
                    break;
                }
                case BALANCER4_STATUS_PRE_CHARGE:
                {
                    log_printf ( &logger, "pre-charge\r\n" );
                    break;
                }
                case BALANCER4_STATUS_CONSTANT_CHARGE:
                {
                    log_printf ( &logger, "constant current or constant voltage charge\r\n" );
                    break;
                }
                case BALANCER4_STATUS_CHARGING_COMPLETE:
                {
                    log_printf ( &logger, "charging complete\r\n" );
                    break;
                }
            }
        }
    }
    if ( BALANCER4_OK == balancer4_read_register ( &balancer4, BALANCER4_REG_FAULT, &fault ) )
    {
        if ( fault )
        {
            log_printf ( &logger, "\r\n - FAULT - \r\n" );
            if ( fault & BALANCER4_FAULT_WD )
            {
                log_printf ( &logger, " The watchdog timer has expired\r\n" );
            }
            if ( fault & BALANCER4_FAULT_INPUT )
            {
                log_printf ( &logger, " Input OVP has occured\r\n" );
            }
            if ( fault & BALANCER4_FAULT_THERMAL_SD )
            {
                log_printf ( &logger, " Thermal shutdown\r\n" );
            }
            if ( fault & BALANCER4_FAULT_TIMER )
            {
                log_printf ( &logger, " The safety timer has expired\r\n" );
            }
            if ( fault & BALANCER4_FAULT_BAT )
            {
                log_printf ( &logger, " Battery OVP has occured\r\n" );
            }
            switch ( fault & BALANCER4_FAULT_NTC_MASK )
            {
                case BALANCER4_FAULT_NTC_COLD:
                {
                    log_printf ( &logger, " An NTC cold fault has occured\r\n" );
                    break;
                }
                case BALANCER4_FAULT_NTC_COOL:
                {
                    log_printf ( &logger, " An NTC cool fault has occured\r\n" );
                    break;
                }
                case BALANCER4_FAULT_NTC_WARM:
                {
                    log_printf ( &logger, " An NTC warm fault has occured\r\n" );
                    break;
                }
                case BALANCER4_FAULT_NTC_HOT:
                {
                    log_printf ( &logger, " An NTC hot fault has occured\r\n" );
                    break;
                }
            }
        }
    }
    Delay_ms ( 500 );
}

The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Other Mikroe Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.Balancer4

Additional notes and informations

Depending on the development board you are using, you may need USB UART Click, USB UART 2 Click or RS232 Click to connect to your PC, for development systems with no UART to USB interface available on the board. UART terminal is available in all MikroElektronika compilers.


ALSO FROM THIS AUTHOR

6DOF IMU 12 click

5

6DOF IMU 12 carries the ultra-low-power BMI270, Inertial Measurement Unit optimized for wearables providing precise acceleration, angular rate measurement and intelligent on-chip motion-triggered interrupt features.

[Learn More]

USB UART 5 Click

0

USB UART 5 Click is a compact add-on board with a general-purpose USB to UART serial interface. This board features the CP2110, a highly-integrated USB-to-UART bridge controller from Silicon Labs. The CP2110 uses the standard USB HID device class, requiring no custom driver and a UART interface that implements all RS-232 signals, including control and hardware handshaking, so existing system firmware does not need to be modified. The UART capabilities of the CP2110 also include baud rate support from 300 to 1Mbps, hardware flow control, RS-485 support, and GPIO signals that are user-defined for status and control information.

[Learn More]

Waveform 4 Click

0

Waveform 4 Click is a compact add-on board that represents a high-performance signal generator. This board features the AD9106, a quad-channel, 12-bit, 180MSPS waveform generator, integrating on-chip static random access memory (SRAM) and direct digital synthesis (DDS) for complex waveform generation from Analog Devices. The DDS is up to a 180 MHz master clock sinewave generator with a 24-bit tuning word allowing 10.8 Hz/LSB frequency resolution.

[Learn More]