Streamline energy consumption, enhance battery safety, and improve overall system efficiency
A
A
Hardware Overview
How does it work?
BATT-MAN 3 Click is based on the ADP5350, an advanced battery management PMIC with inductive boost LED and three LDO regulators from Analog Devices. It combines one high-performance buck regulator for single Li-ion/Li-ion polymer battery charging (also available on the left side header labeled as BUCK), a fuel gauge, a highly programmable boost regulator for LED backlight illumination, one ultralow quiescent current low dropout (LDO) regulator, and two general-purpose LDO regulators. Besides, it supports a USB connection optimized for USB 5V input. The ADP5350 operates in trickle charge mode and constant current (CC)/constant voltage (CV) fast charge mode. It also features an internal field-effect transistor (FET) that permits battery isolation on the system power side. The ADP5350 fuel gauge is a low current-consuming solution optimal for rechargeable Li-Ion battery-powered devices. Its boost regulator operates at a 1.5MHz switching frequency. It can be employed as a constant voltage regulator or supplemental constant current regulator for multiple LED backlight drivers on the VOUT4 terminal. This LED driver can support various LED backlight
configurations, either multiple LEDs in parallel or series connected on the upper-right onboard header. This Click board™ also has a feedback-sensing for the boost regulator, which can be selected for standalone or LED operation mode by positioning the SMD jumpers labeled as MODE SEL to an appropriate position marked as STAL and LED. An additional option has been added for the users to activate or deactivate the Boost and LED part of the board by populating or removing two jumpers, R11 and R9. BATT-MAN 3 Click communicates with MCU using the standard I2C 2-Wire interface to read data and configure settings with a maximum frequency of 400kHz. Also, it uses several GPIO pins, one of which is an interrupt pin, the INT pin of the mikroBUS™ socket, used as a ‘fault’ indicator that immediately notifies the host when a fault occurs. The ADP5350 low dropout (LDO) regulators on top side terminals labeled from VOUT1 to VOUT3 are optimized to operate at low shutdown current and quiescent current to extend battery life. The device is a load switch that can be turned OFF or ON. The I2C interface enables the programmability of all parameters, including status bit readback for
operation monitoring and safety control. This Click board™ uses two LED indicators, labeled as PGOOD and BATT OK, used as power good and charging status indicator alongside the connector on the upper-left side of the board, reserved for a Li-ion/Li-ion polymer battery. PGOOD indicates a good input source, while BATT OK shows the real-time status of the battery voltage. Also, it features battery pack temperature sensing via an internal or external thermistor connected to the onboard header labeled as NTC. This sensing precludes charging when the battery pack temperature exceeds the specified range. A thermistor can be selected by positioning the SMD jumpers labeled as TMP SEL to an appropriate position marked as EXT and INT. This Click board™ can be operated only with a 5V logic voltage level. The board must perform appropriate logic voltage level conversion before using MCUs with different logic levels. Also, it comes equipped with a library containing functions and an example code that can be used, as a reference, for further development.
Features overview
Development board
Nucleo-64 with STM32F091RC MCU offers a cost-effective and adaptable platform for developers to explore new ideas and prototype their designs. This board harnesses the versatility of the STM32 microcontroller, enabling users to select the optimal balance of performance and power consumption for their projects. It accommodates the STM32 microcontroller in the LQFP64 package and includes essential components such as a user LED, which doubles as an ARDUINO® signal, alongside user and reset push-buttons, and a 32.768kHz crystal oscillator for precise timing operations. Designed with expansion and flexibility in mind, the Nucleo-64 board features an ARDUINO® Uno V3 expansion connector and ST morpho extension pin
headers, granting complete access to the STM32's I/Os for comprehensive project integration. Power supply options are adaptable, supporting ST-LINK USB VBUS or external power sources, ensuring adaptability in various development environments. The board also has an on-board ST-LINK debugger/programmer with USB re-enumeration capability, simplifying the programming and debugging process. Moreover, the board is designed to simplify advanced development with its external SMPS for efficient Vcore logic supply, support for USB Device full speed or USB SNK/UFP full speed, and built-in cryptographic features, enhancing both the power efficiency and security of projects. Additional connectivity is
provided through dedicated connectors for external SMPS experimentation, a USB connector for the ST-LINK, and a MIPI® debug connector, expanding the possibilities for hardware interfacing and experimentation. Developers will find extensive support through comprehensive free software libraries and examples, courtesy of the STM32Cube MCU Package. This, combined with compatibility with a wide array of Integrated Development Environments (IDEs), including IAR Embedded Workbench®, MDK-ARM, and STM32CubeIDE, ensures a smooth and efficient development experience, allowing users to fully leverage the capabilities of the Nucleo-64 board in their projects.
Microcontroller Overview
MCU Card / MCU

Architecture
ARM Cortex-M0
MCU Memory (KB)
256
Silicon Vendor
STMicroelectronics
Pin count
64
RAM (Bytes)
32768
You complete me!
Accessories
Click Shield for Nucleo-64 comes equipped with two proprietary mikroBUS™ sockets, allowing all the Click board™ devices to be interfaced with the STM32 Nucleo-64 board with no effort. This way, Mikroe allows its users to add any functionality from our ever-growing range of Click boards™, such as WiFi, GSM, GPS, Bluetooth, ZigBee, environmental sensors, LEDs, speech recognition, motor control, movement sensors, and many more. More than 1537 Click boards™, which can be stacked and integrated, are at your disposal. The STM32 Nucleo-64 boards are based on the microcontrollers in 64-pin packages, a 32-bit MCU with an ARM Cortex M4 processor operating at 84MHz, 512Kb Flash, and 96KB SRAM, divided into two regions where the top section represents the ST-Link/V2 debugger and programmer while the bottom section of the board is an actual development board. These boards are controlled and powered conveniently through a USB connection to program and efficiently debug the Nucleo-64 board out of the box, with an additional USB cable connected to the USB mini port on the board. Most of the STM32 microcontroller pins are brought to the IO pins on the left and right edge of the board, which are then connected to two existing mikroBUS™ sockets. This Click Shield also has several switches that perform functions such as selecting the logic levels of analog signals on mikroBUS™ sockets and selecting logic voltage levels of the mikroBUS™ sockets themselves. Besides, the user is offered the possibility of using any Click board™ with the help of existing bidirectional level-shifting voltage translators, regardless of whether the Click board™ operates at a 3.3V or 5V logic voltage level. Once you connect the STM32 Nucleo-64 board with our Click Shield for Nucleo-64, you can access hundreds of Click boards™, working with 3.3V or 5V logic voltage levels.
Used MCU Pins
mikroBUS™ mapper
Take a closer look
Click board™ Schematic

Step by step
Project assembly
Track your results in real time
Application Output
1. Application Output - In Debug mode, the 'Application Output' window enables real-time data monitoring, offering direct insight into execution results. Ensure proper data display by configuring the environment correctly using the provided tutorial.

2. UART Terminal - Use the UART Terminal to monitor data transmission via a USB to UART converter, allowing direct communication between the Click board™ and your development system. Configure the baud rate and other serial settings according to your project's requirements to ensure proper functionality. For step-by-step setup instructions, refer to the provided tutorial.

3. Plot Output - The Plot feature offers a powerful way to visualize real-time sensor data, enabling trend analysis, debugging, and comparison of multiple data points. To set it up correctly, follow the provided tutorial, which includes a step-by-step example of using the Plot feature to display Click board™ readings. To use the Plot feature in your code, use the function: plot(*insert_graph_name*, variable_name);. This is a general format, and it is up to the user to replace 'insert_graph_name' with the actual graph name and 'variable_name' with the parameter to be displayed.

Software Support
Library Description
This library contains API for BATT-MAN 3 Click driver.
Key functions:
battman3_get_battery_voltage
- Read battery voltage levelbattman3_set_ldo_vout
- Set voltage output on LDObattman3_set_charge_termination_voltage
- Set charge termination voltage
Open Source
Code example
The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.
/*!
* @file main.c
* @brief BATT-MAN3 Click 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 ).
*
* ## 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).
*
* @author Luka Filipovic
*
*/
#include "board.h"
#include "log.h"
#include "battman3.h"
/**
* @brief BATT-MAN 3 Click LOG delay.
* @details Macro that specifies delay between logs of battery voltage.
*/
#define LOG_THRESHOLD_1SEC 10
#define LOG_THRESHOLD_3SEC 30
#define LOG_THRESHOLD_5SEC 50
static battman3_t battman3;
static log_t logger;
/**
* @brief Parse charge status.
* @details This function reads charge status 1 and 2
* and logs @b CHAGER_STATUS and @b BATTERY_STATUS on change.
* @return Nothing.
*/
static void battman3_charge_status ( void );
/**
* @brief Enable/Disable all 3 LDO's.
* @details This function sets state of all 3 LDO's.
* @param[in] enable : Enable/Disable.
* @return Nothing.
*/
static void battman3_ldo( uint8_t enable );
void application_init ( void )
{
log_cfg_t log_cfg; /**< Logger config object. */
battman3_cfg_t battman3_cfg; /**< Click config object. */
/**
* Logger initialization.
* Default baud rate: 115200
* Default log level: LOG_LEVEL_DEBUG
* @note If USB_UART_RX and USB_UART_TX
* are defined as HAL_PIN_NC, you will
* need to define them manually for log to work.
* See @b LOG_MAP_USB_UART macro definition for detailed explanation.
*/
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
battman3_cfg_setup( &battman3_cfg );
BATTMAN3_MAP_MIKROBUS( battman3_cfg, MIKROBUS_1 );
if ( I2C_MASTER_ERROR == battman3_init( &battman3, &battman3_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
if ( BATTMAN3_ERROR == battman3_default_cfg ( &battman3 ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
uint8_t temp_data = 0;
battman3_reg_read( &battman3, BATTMAN3_REG_MANUFACTURE_AND_MODEL_ID, &temp_data );
log_printf( &logger, " > ID: 0x%.2X\r\n", ( uint16_t )temp_data );
battman3_reg_read( &battman3, BATTMAN3_REG_SILICON_REVSION, &temp_data );
log_printf( &logger, " > REV: 0x%.2X\r\n", ( uint16_t )temp_data );
//Charging voltage termination
battman3_set_charge_termination_voltage( &battman3, 3.7 );
//Charging voltage threshold
battman3_set_charge_voltage_threshold( &battman3, BATTMAN3_VTRK_DEAD_2p5V, 3.1 );
//LDO 1
battman3_set_ldo_state( &battman3, BATTMAN3_LDO1, BATTMAN3_ENABLE );
battman3_set_ldo_vout( &battman3, BATTMAN3_LDO1, BATTMAN3_LDO_3p30V );
//LDO 2
battman3_set_ldo_state( &battman3, BATTMAN3_LDO2, BATTMAN3_ENABLE );
battman3_set_ldo_vout( &battman3, BATTMAN3_LDO2, BATTMAN3_LDO_1p50V );
//LDO 3
battman3_set_ldo_state( &battman3, BATTMAN3_LDO3, BATTMAN3_ENABLE );
battman3_set_ldo_vout( &battman3, BATTMAN3_LDO3, BATTMAN3_LDO_2p50V );
log_info( &logger, " Application Task " );
Delay_ms ( 500 );
}
void application_task ( void )
{
static uint8_t counter = 0;
static uint8_t ldo_enable = 1;
float vbat = 0;
if ( !battman3_get_power_good( &battman3 ) && ldo_enable )
{
battman3_ldo( BATTMAN3_DISABLE );
log_printf( &logger, " > Power is not good - LDO disabled\r\n" );
ldo_enable = 0;
}
else if ( battman3_get_power_good( &battman3 ) && !ldo_enable )
{
battman3_ldo( BATTMAN3_ENABLE );
log_printf( &logger, " > Power is good - LDO enabled\r\n" );
ldo_enable = 1;
}
battman3_charge_status( );
if ( counter >= LOG_THRESHOLD_3SEC )
{
counter = 0;
battman3_get_battery_voltage( &battman3, &vbat );
log_printf( &logger, " > Battery voltage: %.2f\r\n", vbat );
log_printf( &logger, "****************************************************\r\n" );
}
counter++;
Delay_ms ( 100 );
}
int main ( void )
{
/* Do not remove this line or clock might not be set correctly. */
#ifdef PREINIT_SUPPORTED
preinit();
#endif
application_init( );
for ( ; ; )
{
application_task( );
}
return 0;
}
static void battman3_charge_status ( void )
{
static uint8_t charge_status1 = 0;
static uint8_t charge_status2 = 0;
uint8_t temp_data = 0;
battman3_reg_read( &battman3, BATTMAN3_REG_CHARGER_STATUS1, &temp_data );
temp_data &= 0x7;
if ( charge_status1 != temp_data )
{
charge_status1 = temp_data;
switch ( charge_status1 )
{
case BATTMAN3_CHARGE_STATUS1_OFF:
{
log_printf( &logger, " > Charge status: off\r\n" );
break;
}
case BATTMAN3_CHARGE_STATUS1_TRICLE_CHARGE:
{
log_printf( &logger, " > Charge status: tricle charge\r\n" );
break;
}
case BATTMAN3_CHARGE_STATUS1_FAST_CHARGE_CC:
{
log_printf( &logger, " > Charge status: fast charge(CC mode)\r\n" );
break;
}
case BATTMAN3_CHARGE_STATUS1_FAST_CHARGE_CV:
{
battman3_ldo( BATTMAN3_ENABLE );/*< Battery is full reenable LDO's*/
log_printf( &logger, " > Charge status: fast charge(CV mode)\r\n" );
break;
}
case BATTMAN3_CHARGE_STATUS1_CHARGE_COMPLETE:
{
log_printf( &logger, " > Charge status: charge complete\r\n" );
break;
}
case BATTMAN3_CHARGE_STATUS1_SUSPEND:
{
log_printf( &logger, " > Charge status: suspend\r\n" );
break;
}
case BATTMAN3_CHARGE_STATUS1_TIMER_EXPIRED:
{
log_printf( &logger, " > Charge status: ticle, fast or safety charge timer expired\r\n" );
break;
}
case BATTMAN3_CHARGE_STATUS1_BATTERY_DETECTION:
{
log_printf( &logger, " > Charge status: battery detection\r\n" );
break;
}
default:
{
log_error( &logger, " Status." );
break;
}
}
}
battman3_reg_read( &battman3, BATTMAN3_REG_CHARGER_STATUS2, &temp_data );
temp_data &= 0x07;
if ( charge_status2 != temp_data )
{
charge_status2 = temp_data;
switch ( charge_status2 )
{
case BATTMAN3_CHARGE_STATUS2_BATTERY_MONITOR_OFF:
{
log_printf( &logger, " > Battery monitor off\r\n" );
break;
}
case BATTMAN3_CHARGE_STATUS2_NO_BATTERY:
{
log_printf( &logger, " > No battery\r\n" );
break;
}
case BATTMAN3_CHARGE_STATUS2_VBSNS_LESSTHEN_VTRK:
{
log_printf( &logger, " > Battery voltage less then trickle threshold\r\n" );
break;
}
case BATTMAN3_CHARGE_STATUS2_VBSNS_MIDDLE_VRK_VWEAK:
{
log_printf( &logger, " > Battery voltage in middle between tricle and weak threshold\r\n" );
break;
}
case BATTMAN3_CHARGE_STATUS2_VBSNS_MORETHEN_VWEAK:
{
log_printf( &logger, " > Battery voltage more then weak threshold\r\n" );
break;
}
default:
{
log_error( &logger, " Status." );
break;
}
}
}
}
static void battman3_ldo( uint8_t enable )
{
battman3_set_ldo_state( &battman3, BATTMAN3_LDO1, enable );
battman3_set_ldo_state( &battman3, BATTMAN3_LDO2, enable );
battman3_set_ldo_state( &battman3, BATTMAN3_LDO3, enable );
}
// ------------------------------------------------------------------------ END