Skip to content
Home > Components > Power Components > Li-ion Charger Module

Li-ion Charger Module

A complete constant-current/constant-voltage linear charger for single-cell lithium-ion batteries.

Component Preview

Li-ion ChargerTP4056 Module

This module typically uses the TP4056 chip to safely charge a standard 3.7V Li-ion or Li-Po battery. It takes 5V power (either from a USB input or direct wire) and carefully manages the charging curve up to a maximum of 4.2V, cutting off automatically when full.

Power ComponentsChargingTP4056

Overview

Rechargeable batteries require precise charging curves to prevent overheating or explosion. You cannot simply attach 5V to a Li-ion battery. This module acts as the middleman to handle the complex charging logic safely.

Pin Reference

PinTypeDescription
IN+powerPower input. Connect to a 5V source (like a solar panel or wall adapter).
IN-powerGround input. Connect to the power source ground.
BAT+powerBattery positive terminal. Connect to the VCC pin of a Li-ion Battery component.
B-powerConnects to the negative terminal of the Li-ion battery.

Wiring Diagram

Wiring Diagram

Configurable Attributes

AttributeTypeDefaultDescription
chargeCurrentManumber1000The simulated charging rate in mA. Defaults to 1A (1000mA).

Working Principle

In the simulator, when 5V is applied to IN+/IN-, the module will output a charging voltage to BAT+/BAT-. If connected to a simulated Li-ion battery, the battery's currentChargeMah will steadily increase over time based on the chargeCurrentMa rate, until it reaches its maximum capacity.

Wiring Diagram

  1. Connect a 5V power source (e.g., from a simulated wall adapter or generator) to IN+ and IN-.
  2. Connect a simulated Li-ion Battery to BAT+ and BAT-.
  3. If the battery supports a load (like an ESP32), connect the ESP32 directly to the battery in parallel with the charger.

Example Arduino Code

The charger is entirely self-contained and operates purely via hardware physics. It does not require code to run.

If you wish to monitor it using an Arduino, you can read the battery voltage via an analog pin:

cpp
const int monitorPin = A0;

void setup() {
  Serial.begin(9600);
}

void loop() {
  // Simple voltage divider assuming 5V logic
  float voltage = analogRead(monitorPin) * (5.0 / 1023.0);
  
  if (voltage > 4.15) {
    Serial.println("Battery Fully Charged!");
  } else if (voltage < 3.2) {
    Serial.println("Battery Low!");
  } else {
    Serial.println("Battery Charging...");
  }
  
  delay(2000);
}

Simulation Notes

  • The physical module often features red (charging) and green/blue (full) LEDs. In the simulator, the module tracks the battery state and updates its visual LEDs appropriately.

Released under the MIT License.