BATT-MAN 3 click
BATT-MAN 3 Click is a compact add-on board representing an advanced battery management solution. This board features the ADP5350, a power management IC with inductive boost LED, and three LDO regulators from Analog Devices. This I2C programmable board supports USB optimized for USB voltage input. It combines one high-performance buck regulator for single Li-Ion/Li-Ion polymer battery charging, a fuel gauge, a highly programmable boost regulator for LED backlight illumination, and three 150mA LDO regulators.
click Product page
Click library
- Author : Luka Filipovic
- Date : Oct 2021.
- Type : I2C type
Software Support
We provide a library for the BATT-MAN3 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 BATT-MAN3 Click driver.
Standard key functions :
battman3_cfg_setup
Config Object Initialization function.
void battman3_cfg_setup(battman3_cfg_t *cfg)
BATT-MAN 3 configuration object setup function.
BATT-MAN 3 Click configuration object.
Definition battman3.h:232
battman3_init
Initialization function.
err_t battman3_init(battman3_t *ctx, battman3_cfg_t *cfg)
BATT-MAN 3 initialization function.
BATT-MAN 3 Click context object.
Definition battman3.h:213
battman3_default_cfg
Click Default Configuration function.
err_t battman3_default_cfg(battman3_t *ctx)
BATT-MAN 3 default configuration function.
Example key functions :
battman3_get_battery_voltage
Read battery voltage level.
err_t battman3_get_battery_voltage(battman3_t *ctx, float *vout)
Read battery voltage level.
battman3_set_ldo_vout
Set voltage output on LDO.
battman3_ldo_t
BATT-MAN 3 Click LDO.
Definition battman3.h:286
battman3_ldo_vout_t
BATT-MAN 3 Click LDO voltage output.
Definition battman3.h:261
err_t battman3_set_ldo_vout(battman3_t *ctx, battman3_ldo_t ldo, battman3_ldo_vout_t vout)
Set voltage output on LDO.
battman3_set_charge_termination_voltage
Set charge termination voltage.
err_t battman3_set_charge_termination_voltage(battman3_t *ctx, float voltage)
Set charge termination voltage.
Example Description
This example showcases ability of device to charge battery,
and outputs and supply 4 different devices with 3 LDO's and 1 boost channel.
The demo application is composed of two sections :
Application Init
Initialization of the communication modules(UART, I2C) and 3 additional
input pins(power good, battery ok, and interrupt). Configures device to enable charging, battery voltage monitoring, sets charging termination to 3.7V, charging threshold to 3.1V and dead battery to 2.5V. Enables all 3 LDO's( channel 1 -> 3.3V, channel 2 -> 1.5V, and channel 3 -> 2.5V ).
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
if ( I2C_MASTER_ERROR ==
battman3_init( &battman3, &battman3_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
uint8_t temp_data = 0;
log_printf( &logger, " > ID: 0x%.2X\r\n", ( uint16_t )temp_data );
log_printf( &logger, " > REV: 0x%.2X\r\n", ( uint16_t )temp_data );
log_info( &logger, " Application Task " );
Delay_ms ( 500 );
}
@ BATTMAN3_VTRK_DEAD_2p5V
Definition battman3.h:300
@ BATTMAN3_ERROR
Definition battman3.h:252
@ BATTMAN3_LDO3
Definition battman3.h:289
@ BATTMAN3_LDO2
Definition battman3.h:288
@ BATTMAN3_LDO1
Definition battman3.h:287
@ BATTMAN3_LDO_2p50V
Definition battman3.h:268
@ BATTMAN3_LDO_1p50V
Definition battman3.h:272
@ BATTMAN3_LDO_3p30V
Definition battman3.h:264
#define BATTMAN3_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition battman3.h:198
#define BATTMAN3_REG_MANUFACTURE_AND_MODEL_ID
BATT-MAN 3 description register.
Definition battman3.h:73
#define BATTMAN3_REG_SILICON_REVSION
Definition battman3.h:74
#define BATTMAN3_ENABLE
BATT-MAN 3 acitve state.
Definition battman3.h:172
err_t battman3_set_ldo_state(battman3_t *ctx, battman3_ldo_t ldo, uint8_t enable)
Enable/Disable LDO.
err_t battman3_reg_read(battman3_t *ctx, uint8_t reg, uint8_t *rx_data)
Register reading function.
err_t battman3_set_charge_voltage_threshold(battman3_t *ctx, battman3_vtrk_dead_t vtrk_dead, float vweak)
Set charge termination voltage.
void application_init(void)
Definition main.c:60
Application Task
Reads battery voltage level and logs it. Besides that reads status and logs
every change on charging and battery status. If power good flag occurs(PGD
pin goes low) disables LDO's, and reenables them when battery is full(when
battery reaches charging termination voltage).
{
static uint8_t counter = 0;
static uint8_t ldo_enable = 1;
float vbat = 0;
{
log_printf( &logger, " > Power is not good - LDO disabled\r\n" );
ldo_enable = 0;
}
{
log_printf( &logger, " > Power is good - LDO enabled\r\n" );
ldo_enable = 1;
}
battman3_charge_status( );
{
counter = 0;
log_printf( &logger, " > Battery voltage: %.2f\r\n", vbat );
log_printf( &logger, "****************************************************\r\n" );
}
counter++;
Delay_ms ( 100 );
}
#define BATTMAN3_DISABLE
Definition battman3.h:173
uint8_t battman3_get_power_good(battman3_t *ctx)
Get power good.
void application_task(void)
Definition main.c:118
#define LOG_THRESHOLD_3SEC
Definition main.c:38
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.BATT-MAN3
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.