TOP Contributors

  1. MIKROE (2662 codes)
  2. Alcides Ramos (357 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (112 codes)
  5. Chisanga Mumba (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 (137032 times)
  2. FAT32 Library (70166 times)
  3. Network Ethernet Library (56035 times)
  4. USB Device Library (46355 times)
  5. Network WiFi Library (41970 times)
  6. FT800 Library (41300 times)
  7. GSM click (29079 times)
  8. mikroSDK (26519 times)
  9. PID Library (26452 times)
  10. microSD click (25449 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 5 click

Rating:

5

Author: MIKROE

Last Updated: 2019-11-20

Package Version: 1.0.0.0

mikroSDK Library: 1.0.0.0

Category: Battery Charger

Downloaded: 2934 times

Not followed.

License: MIT license  

Balancer 5 Click is an intelligent 2-cell Li-Ion battery charger, system power manager, and a battery fuel gauge Click board.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "Balancer 5 click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "Balancer 5 click" changes.

Do you want to report abuse regarding "Balancer 5 click".

  • mikroSDK Library 2.0.0.0
  • Comments (0)
DOWNLOAD LINK RELATED COMPILER CONTAINS
mikroBasic PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc

mikroSDK Library Blog

Balancer 5 click

Balancer 5 click

Native view of the Balancer 5 click board.

View full image
Balancer 5 click

Balancer 5 click

Front and back view of the Balancer 5 click board.

View full image

Library Description

Library provides functions for controling pin state and reading it from device, and reading and writing data to device.

Key functions:

  • void balancer5_charge ( uint8_t state ) - Control device charging sate
  • uint8_t balancer5_read_data ( uint8_t reg_addr ) - Reads and returns one Byte of data from registar
  • void balancer5_write_data ( uint8_t reg_addr, uint8_t write_data ) - Writes one Byte of data to registar

Examples description

The application is composed of three sections :

  • System Initialization - Initialization of I2C module and setting pins to output
  • Application Initialization - Checks ID, starts charging, reads charge status registers and configures ADC
  • Application Task - Reads ADC values from registers and logs it
void application_task ( )
{
    temp_data = balancer5_read_data( BALANCER5_REG_IBUS_ADC1 );
    temp_uint_data = temp_data;
    temp_uint_data <<= 8;
    temp_data = balancer5_read_data( BALANCER5_REG_IBUS_ADC0 );
    temp_uint_data |= temp_data;
    IntToStr( temp_uint_data, demo_txt );
    mikrobus_logWrite( "- IBUS:", _LOG_TEXT );
    mikrobus_logWrite( demo_txt, _LOG_TEXT );
    mikrobus_logWrite( " mA", _LOG_LINE );

    temp_data = balancer5_read_data( BALANCER5_REG_ICHG_ADC1 ); 
    temp_uint_data = temp_data;
    temp_uint_data <<= 8;
    temp_data = balancer5_read_data( BALANCER5_REG_ICHG_ADC0 );
    temp_uint_data |= temp_data;
    WordToStr( temp_uint_data, demo_txt );
    mikrobus_logWrite( "- ICHG:", _LOG_TEXT );
    mikrobus_logWrite( demo_txt, _LOG_TEXT );
    mikrobus_logWrite( " mA", _LOG_LINE );

    temp_data = balancer5_read_data( BALANCER5_REG_VBAT_ADC1 );
    temp_uint_data = temp_data;
    temp_uint_data <<= 8;
    temp_data = balancer5_read_data( BALANCER5_REG_VBAT_ADC0 );
    temp_uint_data |= temp_data;
    IntToStr( temp_uint_data, demo_txt );
    mikrobus_logWrite( "- VBAT:", _LOG_TEXT );
    mikrobus_logWrite( demo_txt, _LOG_TEXT );
    mikrobus_logWrite( " mV", _LOG_LINE );

    temp_data = balancer5_read_data( BALANCER5_REG_VBUS_ADC1 );
    temp_uint_data = temp_data;
    temp_uint_data <<= 8;
    temp_data = balancer5_read_data( BALANCER5_REG_VBUS_ADC0 );
    temp_uint_data |= temp_data;
    IntToStr( temp_uint_data, demo_txt );
    mikrobus_logWrite( "- VBUS:", _LOG_TEXT );
    mikrobus_logWrite( demo_txt, _LOG_TEXT );
    mikrobus_logWrite( " mV", _LOG_LINE );

    temp_data = balancer5_read_data( BALANCER5_REG_VCELLTOP_ADC1 );
    temp_uint_data = temp_data;
    temp_uint_data <<= 8;
    temp_data = balancer5_read_data( BALANCER5_REG_VCELLTOP_ADC0 );
    temp_uint_data |= temp_data;
    IntToStr( temp_uint_data, demo_txt );
    mikrobus_logWrite( "- VCELLTOP:", _LOG_TEXT );
    mikrobus_logWrite( demo_txt, _LOG_TEXT );
    mikrobus_logWrite( " mV", _LOG_LINE );

    temp_data = balancer5_read_data( BALANCER5_REG_VCELLBOT_ADC1 );
    temp_uint_data = temp_data;
    temp_uint_data <<= 8;
    temp_data = balancer5_read_data( BALANCER5_REG_VCELLBOT_ADC0 );
    temp_uint_data |= temp_data;
    IntToStr( temp_uint_data, demo_txt );
    mikrobus_logWrite( "- VCELLBOT:", _LOG_TEXT );
    mikrobus_logWrite( demo_txt, _LOG_TEXT );
    mikrobus_logWrite( " mV", _LOG_LINE );

    temp_data = balancer5_read_data( BALANCER5_REG_TS_ADC1 );
    temp_uint_data = temp_data;
    temp_uint_data <<= 8;
    temp_data = balancer5_read_data( BALANCER5_REG_TS_ADC0 );
    temp_uint_data |= temp_data;
    temp_float_data = temp_uint_data;
    temp_float_data *= 0.098;
    FloatToStr( temp_float_data, demo_txt );
    mikrobus_logWrite( "- TS:", _LOG_TEXT );
    mikrobus_logWrite( demo_txt, _LOG_TEXT );
    mikrobus_logWrite( " %", _LOG_LINE );

    temp_data = balancer5_read_data( BALANCER5_REG_TDIE_ADC1 );
    temp_uint_data = temp_data;
    temp_uint_data <<= 8;
    temp_data = balancer5_read_data( BALANCER5_REG_TDIE_ADC0 );
    temp_uint_data |= temp_data;
    temp_float_data = temp_uint_data;
    temp_float_data *= 0.5;
    FloatToStr( temp_float_data, demo_txt );
    mikrobus_logWrite( "- TDIE:", _LOG_TEXT );
    mikrobus_logWrite( demo_txt, _LOG_TEXT );
    mikrobus_logWrite( log_degree, _LOG_LINE );
    
    mikrobus_logWrite( "____________________", _LOG_LINE );
    Delay_ms( 5000 );
}

Additional Functions :

  • void charger_status_1_handler ( uint8_t cs1_data ) - Handles data from charger status 1 and logs it
  • void charger_status_2_handler ( uint8_t cs2_data ) - Handles data from charger status 2 and logs it

The full application code, and ready to use projects can be found on our LibStock page.

Other mikroE Libraries used in the example:

  • Conversions
  • UART
  • I2C

Additional notes and informations

Depending on the development board you are using, you may need USB UART clickUSB UART 2 click or RS232 click to connect to your PC, for development systems with no UART to USB interface available on the board. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.

ALSO FROM THIS AUTHOR

Alcohol click

0

Alcohol click has a high sensitivity to alcohol and it can be used to detect alcohol in concentrations from 0.04 to 4mg/l.Alcohol click carries an MQ-3 Semiconductor sensor for alcohol. The click is designed to run on a 5V power supply only. It communicates with the target microcontroller through the AN pin on the mikroBUS™ line.

[Learn More]

Proximity 10 click

0

Proximity 10 Click is a versatile proximity detection device on a Click board™. It can detect a foreign object distanced up to 20cm.

[Learn More]

Remote Temp click

0

Remote Temp Click is a temperature sensing Click board™, which features the EMC1833 from Microchip, a specifically designed IC, capable of measuring remote temperature. This option makes Remote Temp click well-suited for monitoring the temperature of a CPU, GPU or FPGA, where the BJT model junction can be a substrate PNP or NPN.

[Learn More]