|
Li-ion Battery Charging Protection Circuit Design: TP4056 and DW01 Practical Guide

Li-ion Battery Charging Protection Circuit Design: TP4056 and DW01 Practical Guide

Lithium batteries are the most common power solution for all embedded projects, but if not used properly, they can become “time bombs”. Overcharging causes swelling, over-discharging causes permanent damage, and short circuits cause smoking. Today we’re going to talk about how to design a reliable lithium battery charging protection circuit.

Why do we need protection circuits?

Lithium batteries are more temperamental than you think:

  • Overcharge (>4.2V): Lithium plating on positive electrode, internal pressure increases, may swell or even catch fire

  • Over-discharge (<2.5V): Copper current collector dissolves, battery permanently fails

  • Overcurrent/short circuit: Instantaneous high current, heating and fire

  • Over-temperature: High temperature accelerates aging, extreme cases lead to thermal runaway

An 18650 cell is nominally 3.7V, with an actual operating range of 3.0V~4.2V. Exceeding this range and the battery starts to “act up”.

Core chip: TP4056

TP4056 is currently the most popular linear lithium battery charging management IC, for a simple reason - cheap, easy to use, and requires few external components.

Key parameters

ParameterValue
Input voltage4.5V ~ 6.5V (USB 5V direct supply)
Charging currentProgrammable, maximum 1A
Charging accuracy±1% (4.2V cutoff voltage)
Operating modePre-charge → Constant Current (CC) → Constant Voltage (CV)
PackageSOP-8 / MSOP-10
Unit priceAbout 0.3~0.8 yuan

Three charging stages

TP4056’s charging process is divided into three stages:

  1. Pre-charge stage: When battery voltage is below 3.0V, pre-charge with 10% of the set current to protect deeply discharged batteries

  2. Constant Current Charging (CC): After pre-charge completes, charge with constant current (maximum 1A), battery voltage rises quickly to 4.2V

  3. Constant Voltage Charging (CV): After voltage reaches 4.2V, maintain constant voltage, current gradually decreases, charging ends when current drops to 10% of the set value

Complete circuit design

If you don’t want to design your own PCB, using a ready-made TP4056 module is the fastest solution:

Hardware list:

ComponentModelQuantityUnit price (yuan)
TP4056 charging moduleWith protection version (DW01+8205A)11.5
18650 lithium batteryPanasonic/NCR18650B115
Micro-USB connectorThrough-hole type10.2
1N5819 Schottky diodeReverse charge protection10.1

Wiring method:

  • Micro-USB 5V → TP4056 module IN+

  • TP4056 module B+ → Battery positive

  • TP4056 module B- → Battery negative

  • TP4056 module OUT+/OUT- → Load power output

Note: TP4056’s OUT and B are connected together, load and battery are in parallel. When charging while load is working simultaneously, charging current will be divided by the load, this is normal.

Solution 2: Discrete component design (advanced)

If you want to design your own PCB, here’s the complete principle:

VCC (5V USB)

         ┌──┴──┐
         │ TP4056 │
         └──┬──┘
            │ BAT (4.2V)
         ┌──┴──┐
         │  Cell  │
         └──┬──┘

      ┌─────┴─────┐
      │  DW01 + 8205A │ ← Protection IC
      └─────┬─────┘

         PACK- (Output negative)

Core component list:

ComponentModelQuantityUnit price (yuan)Function
Charging ICTP405610.5Charging management
Protection ICDW01-A10.15Overcharge/over-discharge detection
MOSFET8205A (dual N-MOS)10.1Charge/discharge control switch
Charging current setting resistor1.2kΩ10.01Set 1A charging current
Input capacitor10μF/10V10.05Input filtering
Output capacitor10μF/10V10.05Output filtering
Status LEDRed/green 06031 each0.02Charging status indication
Schottky diode1N581910.1Prevent battery reverse charge

Charging current calculation formula:

I_CHARGE = 1000 / R_PROGRAM  (Unit: mA)

Example: R_PROGRAM = 1.2kΩ → I_CHARGE ≈ 833mA
         R_PROGRAM = 2kΩ   → I_CHARGE ≈ 500mA
         R_PROGRAM = 1.5kΩ → I_CHARGE ≈ 667mA

Choose charging current based on battery capacity, generally recommend 0.5C1C (C is battery capacity). 18650 commonly 20003400mAh, using 1A charging is appropriate.

DW01 protection circuit detailed explanation

DW01 is a single-cell lithium battery protection IC, with built-in overcharge comparator, over-discharge comparator and short circuit detection. Combined with 8205A (dual N-MOS) to achieve charge/discharge on/off control.

Protection thresholds

Protection typeTrigger conditionRecovery condition
Overcharge protectionBattery voltage ≥ 4.25V ± 0.05VCharging voltage drops to 4.15V ± 0.05V
Over-discharge protectionBattery voltage ≤ 2.4V ± 0.08VCharging voltage rises to 3.0V ± 0.1V
Overcurrent protectionDischarge current too large (MOS Rds voltage drop exceeds standard)Automatic recovery after load removed
Short circuit protectionOutput terminal directly shortedAutomatic recovery after short circuit removed

DW01 pin description

PinNameFunction
1COOvercharge control output → 8205A’s charging MOS
2VMOvercurrent/short circuit detection → in series in discharge loop
3DOOver-discharge control output → 8205A’s discharge MOS
4VSSGround
5CSBattery positive detection input
6VDInternal oscillator (float or connect capacitor)

Practical: Monitor battery status with Arduino

Protection circuits are the hardware level’s “last line of defense”, but we can also monitor battery status in real-time at the software level.

// Lithium battery voltage monitoring - Universal for Arduino/ESP32
// Read battery voltage through resistor voltage divider

const int BATTERY_PIN = A0;  // ADC input pin
const float R1 = 100000.0;   // Upper voltage divider resistor 100kΩ
const float R2 = 10000.0;    // Lower voltage divider resistor 10kΩ
const float ADC_REF = 3.3;   // ADC reference voltage (ESP32=3.3, Arduino=5.0)

float readBatteryVoltage() {
  int adcValue = analogRead(BATTERY_PIN);
  float voltage = (adcValue / 4095.0) * ADC_REF;  // ESP32 12-bit ADC
  // Restore voltage before voltage divider
  float batteryVoltage = voltage * (R1 + R2) / R2;
  return batteryVoltage;
}

float getBatteryPercent(float voltage) {
  // Simplified lithium battery discharge curve mapping
  if (voltage >= 4.20) return 100.0;
  if (voltage >= 4.10) return 95.0;
  if (voltage >= 4.00) return 85.0;
  if (voltage >= 3.90) return 70.0;
  if (voltage >= 3.80) return 55.0;
  if (voltage >= 3.70) return 40.0;
  if (voltage >= 3.60) return 25.0;
  if (voltage >= 3.50) return 15.0;
  if (voltage >= 3.40) return 8.0;
  if (voltage >= 3.30) return 4.0;
  if (voltage >= 3.00) return 1.0;
  return 0.0;  // Over-discharge protection triggered
}

void setup() {
  Serial.begin(115200);
  Serial.println("Lithium battery monitor started");
}

void loop() {
  float voltage = readBatteryVoltage();
  float percent = getBatteryPercent(voltage);

  Serial.printf("Voltage: %.2fV | Battery: %.0f%%\n", voltage, percent);

  if (voltage < 3.3) {
    Serial.println("⚠️  Warning: Low battery!");
  }

  if (voltage > 4.25) {
    Serial.println("⚠️  Warning: Overcharge! Check charging circuit");
  }

  delay(5000);
}

Voltage divider resistor selection key points:

The voltage after the divider must be ≤ ADC reference voltage. Taking 4.2V fully charged as an example:

V_ADC = 4.2 × R2 / (R1 + R2)

R1=100k, R2=10k → V_ADC = 4.2 × 10/110 ≈ 0.38V (safe)
R1=300k, R2=100k → V_ADC = 4.2 × 100/400 = 1.05V (safe)

Resistance values should not be too small, otherwise static power consumption is high. Recommend total resistance ≥ 100kΩ.

Common problem troubleshooting

1. Charging doesn’t complete (stops at 3.8V)

Cause:

  • Charging current set too large, battery internal resistance voltage drop causes CV stage to be reached early

  • Battery aged, internal resistance increased

  • USB power supply insufficient (computer USB port may only have 500mA)

Solution:

  • Check if R_PROGRAM resistance value is correct

  • Test with 2A charging adapter

  • Try replacing battery to rule out aging issues

2. Voltage drops rapidly after charging

Cause:

  • Battery internal resistance too large (aged or low-quality cells)

  • Charging disconnected before completion (CV stage requires longer time)

  • Load current too large

Solution:

  • TP4056’s CV stage may take 2~3 hours, be patient

  • Check if charging indicator light changed from red to green

  • Consider using battery with larger capacity

3. Protection board doesn’t discharge

Cause:

  • After over-discharge protection triggers, needs charging to recover

  • Load short circuit caused protection lockout

  • DW01’s CO/DO pin status abnormal

Solution:

  • Connect charger, charge above 3.0V to automatically recover

  • Remove load and reconnect

  • Use multimeter to check DW01 pin voltages

4. Charging chip overheating

Cause:

  • TP4056 is a linear charging chip, heating is normal when voltage difference is large

  • Input voltage too high (exceeds 6V)

  • Poor heat dissipation

Solution:

  • Ensure input voltage is 5V (USB standard)

  • Add thermal pad on bottom during PCB design (GND pad)

  • Consider adding small heatsink when charging with high current (>500mA)

  • If input voltage is high, switch to switching charging chip (such as CN3063)

5. Battery swelling

Cause:

  • Overcharge (protection circuit failed)

  • Charging current too large

  • Battery quality issues

Solution:

  • Immediately stop using swollen battery, safety risk exists

  • Check if protection circuit is working normally

  • Use branded cells (Panasonic, Samsung, LG)

  • Don’t mix new and old batteries

Design recommendations summary

  1. Calculate charging current based on battery capacity, R_PROGRAM resistor accuracy recommend selecting ±1%

  2. Must add DW01 + 8205A protection circuit, cannot rely solely on TP4056 for charging

  3. Input/output capacitors cannot be omitted, 10μF tantalum capacitor or X5R ceramic capacitor both work

  4. Use ADC to monitor battery voltage in real-time, software level provides dual protection

  5. Choose branded cells (Panasonic, Samsung, LG), avoid using salvaged or low-quality batteries

Hardware list summary

ComponentModelQuantityTotal price (yuan)
TP4056 charging ICSOP-810.5
DW01 protection ICSOT-23-610.15
8205A MOSFETSOT-2610.1
18650 battery holderSpring type10.3
Resistors and capacitors0603 packageSeveral0.5
Micro-USB connectorThrough-hole10.2
18650 lithium battery2600mAh branded cell112
TotalAbout 14 yuan

Hope this blog post is helpful to you!