Balancer 5 Click Board
Balancer 5 Click Board
The Balancer 5 Click Board™ is an intelligent 2-cell Li-Ion battery charger, system power manager, and battery fuel gauge Click Board™.
The Balancer 5 Click Board™ is based on a BQ25887 controller which has some extra features enabling charging without too much hassle. As a system power distributor, it can supply up to 3.3A to a connected battery. By utilizing an externally connected USB power supply, it can charge a 2-cell Li-Ion battery. A dedicated power management IC with optimized smart power control allows very efficient management of the available power.
Software Support
We provide a library for the Balancer 5 Click Board™ on our LibStock page, as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.
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 sateuint8_t balancer5_read_data ( uint8_t reg_addr )
- Reads and returns one Byte of data from registarvoid balancer5_write_data ( uint8_t reg_addr, uint8_t write_data )
- Writes one Byte of data to registar
Example 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 Information
Depending on the development board you are using, you may need a 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. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.
MIKROSDK
The Balancer 5 Click Board™ is supported with mikroSDK - MikroElektronika Software Development Kit. To ensure proper operation of mikroSDK compliant Click board™ demo applications, mikroSDK should be downloaded from the LibStock and installed for the compiler you are using.
Balancer 5 Click Board
Frequently Asked Questions
Have a Question?
Be the first to ask a question about this.