TOP Contributors

  1. MIKROE (2652 codes)
  2. Alcides Ramos (351 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 (136606 times)
  2. FAT32 Library (69810 times)
  3. Network Ethernet Library (55881 times)
  4. USB Device Library (46213 times)
  5. Network WiFi Library (41857 times)
  6. FT800 Library (41070 times)
  7. GSM click (28941 times)
  8. PID Library (26400 times)
  9. mikroSDK (26309 times)
  10. microSD click (25324 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: 2885 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

Dual LIN click

5

The Dual LIN click is a Click boardâ„¢ based on the TLE7268SKXUMA1, a Dual LIN transceiver from Infineon. Given the features included in this transceiver, the Dual LIN transceiver designed for data transmission rates up to 20 kbps being fully compliant to the ISO17987-4, LIN specification 2.2A and SAE J2602 standards.

[Learn More]

Let's make - Breathalyser

6

Is there such a thing as the Ballmer peak? It's the idea that moderate alcohol consumption has a benefitial impact on creativity, and hence, on programming ability. The theory was explained in this issue of the xkcd webcomic. We devised a practical test to examine the validity of the assumption.

[Learn More]

10DOF click

4

10DOF click board carries two modules from Bosch: BNO055, a 9-axis absolute orientation sensor and BMP180, a digital pressure sensor. 10DOF click communicates with the target board MCU through the mikroBUS I2C interface (SCL, SDA), with additional functionality provided by INT and RST pins. Designed to use a 3.3V power supply only.

[Learn More]