TOP Contributors

  1. MIKROE (2752 codes)
  2. Alcides Ramos (372 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 (139071 times)
  2. FAT32 Library (71594 times)
  3. Network Ethernet Library (56989 times)
  4. USB Device Library (47330 times)
  5. Network WiFi Library (43006 times)
  6. FT800 Library (42297 times)
  7. GSM click (29777 times)
  8. mikroSDK (27874 times)
  9. PID Library (26859 times)
  10. microSD click (26129 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: 3461 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

H-Bridge 2 click

5

H-Bridge 2 click can be used to drive a motor by utilizing a specific configuration of the output stage MOSFETs, known as the H-bridge. This configuration enables H-Bridge 2 click to drive a motor with up to 1.2A and 15V, providing control of the speed and direction, as well as the dynamic (rheostatic) braking capability.

[Learn More]

3D Hall click

1

3D Hall click carries the MLX90333 Triaxisâ„¢ Hall sensor, capable of detecting the position of any magnet in nearby space. It does so by being sensitive to three components of flux density (BX, BY, BZ). The board communicates with the target MCU through the mikroBUS SPI interface. 3D Hall click is designed to use a 5V power supply only.

[Learn More]

Vibro Motor Click

0

Vibro Motor Click features a compact size Eccentric Rotating Mass (ERM) motor, labeled as C1026B002F. This type of motor is often used for haptic feedback on many small handheld devices, such as the cellphones, pagers, RFID scanners and similar devices. This motor contains a small eccentric weight on its rotor, so while rotating it also produces vibration effect. This kind of motors is sometimes referred to as coin motors, due to its shape.

[Learn More]