How does it work?
PowerBank Click can supply power from the connected battery through a USB port as well as charge the battery. The MP2632B can operate in both charge mode and boost mode to allow for full-system and battery-power management. It has an integrated VIN-to-SYS pass-through path to pass the input voltage to the system. The pass-through path has built-in over-voltage (OVP) and over-current protection (OCP) and a higher priority over the charging path.
This board can also re-charge connected battery from microUSB connector on the bottom side by providing input power. When the input power is present, the MP2632B operates in charge mode. The MP2632B detects the battery voltage automatically and charges the battery in three phases: trickle current, constant current, and constant voltage. Other features include charge termination and auto-recharge. The MP2632B also integrates both input current limit and input voltage regulation to manage the input power and prioritize the system load.
In the absence of an input source, the MP2632B switches to boost mode through PB to power SYS from the battery. In boost mode, the OLIM pin programs the output current limit, and the MP2632B turns off at light load automatically. The MP2632B also allows for output short-circuit protection (SCP) to disconnect the battery completely from the load in the event of a short-circuit fault. Normal operation resumes once the short-circuit fault is removed.
The operational mode selector button on the PowerBank Click has few purposes. If the button is pressed for more than 1.5ms, the boost is enabled and latched if V IN is not available. LEDs 1-4 are ON for five seconds whenever the button is pressed for more than 1.5ms. If the button is pressed for more than 1.5ms twice within one second, it serves as a torch light ON/OFF switch. If the button is held pressed for more than 2.5 seconds, this is defined as a long push, and boost is shut down manually.
A 4-LED driver is integrated for voltage-based fuel gauge indication. Together with torch-light control, the MP2632B provides an all-in-one solution for power banks and similar applications without an external microcontroller.
The PowerBank Click is also equipped with a MCP3221, a successive approximation A/D converter (ADC) with a 12-bit resolution to monitor battery voltage over I2C bus over mikroBUS™ socket.
This Click Board™ is designed to be operated only with 5V logic level. A proper logic voltage level conversion should be performed before the Click board™ is used with MCUs with logic levels of 3V3.
Specifications
Type
Battery charger
Applications
Battery Charger Applications, Power-Bank Applications for Smartphones, Tablets and Other Portable Devices
On-board modules
MP2632B switch-mode battery charger
Key Features
Switch-mode battery charger with system power-path management designed for single-cell Li-ion or Li-polymer batteries
Interface
I2C
Feature
No ClickID
Compatibility
mikroBUS™
Click board size
L (57.15 x 25.4 mm)
Input Voltage
5V
Pinout diagram
This table shows how the pinout on PowerBank Click corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).
Onboard settings and indicators
Label | Name | Default | Description |
---|---|---|---|
PWR | PWR | – | Power LED Indicator |
LD1-4 | LD1-4 | – | Battery Status LEDs / Fault Indicator |
LD5 | LD5 | – | Operation Mode Indicator |
T1 | – | – | Operation Mode Selector |
CN1 | – | – | USB Power/Communication Port |
CN2 | – | – | USB Charge Port |
Software Support
We provide a library for the PowerBank Click 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
The library covers all the necessary functions that enables the usage of the PowerBank click board. It offers reading from output register and calculations that result in relatively accurate measurement of connected batteries voltage.
Key functions:
uint16_t powerbank_read_data ( );
– Function is used to read raw data from MCP3221.uint16_t powerbank_read_voltage ( uint16_t v_ref );
– Function is used to calculate voltage of the connected battery.
Examples description
The application is composed of three sections :
- System Initialization – Initializes I2C module and LOG structure.
- Application Initialization – Initalizes I2C driver and makes an initial log.
- Application Task – (code snippet) This example shows the capabilities of the PowerBank click by measuring voltage of the connected battery. In order to get correct calculations user should change “v_ref” value to his own power supply voltage.
void application_task ( ) { voltage = powerbank_read_voltage( v_ref ); WordToStr( voltage, log_txt ); mikrobus_logWrite( "Battery voltage: ", _LOG_TEXT ); mikrobus_logWrite( log_txt, _LOG_TEXT ); mikrobus_logWrite( "mV", _LOG_LINE ); mikrobus_logWrite( "------------------------", _LOG_LINE ); Delay_ms( 2000 ); }
The full application code, and ready to use projects can be found on our LibStock page.
Other mikroE Libraries used in the example:
- I2C
- Conversions
- UART
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. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.
mikroSDK
This 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.
For more information about mikroSDK, visit the official page.