Power and protection/Lithium cells/Charging with a TP4056

Charging with a TP4056

The TP4056 is the three-dollar red board everybody owns, and it is a complete lithium charger in a SOP-8 with one resistor to configure. That resistor is almost always the wrong value for the cell you have attached.

A TP4056 is a linear constant-current, constant-voltage charger for exactly one lithium cell. It has no microcontroller, no firmware, no configuration beyond a resistor, and it does the whole job correctly. The modules are cheap because the chip is cheap.

The cycle it runs

TP4056: four phases, and only one of them is fast
idle
Phase
idle
Cell
2.60 V
Going in
0 µA
A flat cell and a charger about to be plugged in. Watch the two traces separately: the voltage is what people look at, and the current is what actually decides when the cycle ends.

Press play and watch the two traces separately. The voltage is what people look at; the current is what actually decides when the cycle ends.

Trickle. Below 2.9 V the chip does not charge properly — it feeds about 130 mA and watches. A cell this flat may already be damaged, and a gentle current is how you find out without turning a short into a fire.

Constant current. The programmed current, held flat, while the cell's voltage climbs. This is the fast part and it is not where the difficulty is.

Constant voltage. The cell reaches 4.2 V — the chip's target, accurate to 1.5 % — with about a fifth of its charge still to go. From here the charger holds the voltage exactly and lets the cell take whatever current it wants, which falls away on its own. This phase takes as long as everything before it.

Termination. When the current falls to a tenth of what was programmed, the chip stops, the blue LED comes on, and it draws about 2.5 µA back out of the cell doing nothing.

That last rule matters more than it looks and it is the whole of the power path page.

The resistor

The charge current is set by one resistor from PROG to ground:

IBAT(A) = 1200 / RPROG(Ω)

Every module ships with 1.2 kΩ fitted, which is 1 A.

The PROG resistor, and the heat it books
IBAT = 1200 / RPROG
PROG resistor2 kΩ
Charge current
600 mA
C rate
0.50C
Heat in the chip
780 mW
600 mA at 0.50C, and 780 mW to get rid of. This is the comfortable region: the cell is charged at a rate it will not resent, and the chip is not fighting its own thermal limit. Changing that one resistor is the single most useful modification to a three-dollar charging module, and it is the one nobody makes.

1 A is right for a 2000 mAh cell and wrong for almost everything else a hobby project uses. A 500 mAh pouch charged at 1 A is being charged at 2C, twice what most cells are specified for, and you are trading cycle life for an hour of your afternoon.

The second thing the resistor decides is heat, and it is the one nobody calculates. A linear charger makes its current by dropping the difference across itself. 5 V in, a cell at 3.6 V, 1 A: 1.4 W in a SOP-8 with no heatsink but the copper it is soldered to.

The chip does not let this destroy it. It holds its own die at 145 °C and reduces the charge current until it can — thermal regulation. But a charger in thermal regulation is a charger delivering less than the resistor says, running hot, and looking faulty. Changing that one resistor is the single most useful modification to these modules and the one almost nobody makes.

Pick the resistor from the cell, not from the module. 0.5C is a sensible default. For a 1200 mAh cell that is 600 mA, which is 2 kΩ. For a 500 mAh pouch it is 250 mA, which is 5 kΩ. The datasheet prints the table; the module ships with the top row of it fitted regardless.

The pins the modules do not bring out

CE. Chip enable, active high. Pull it low and charging stops. Useful for letting a microcontroller refuse to charge below 0 °C, which is the one form of lithium damage no cheap protection board catches.

TEMP. A thermistor input. If it sits below 45 % or above 80 % of the supply voltage for more than 0.15 s, charging suspends. Most modules tie it to ground, which disables it — and that is why they cannot do the cold-charge check themselves.

CHRG and STDBY. Open-drain outputs driving the two LEDs. They are readable by a microcontroller directly: low means charging and low means finished respectively, and both high impedance means no input, no battery, or a temperature fault.

The two boards, and which one you have

The plain module is a TP4056, two LEDs, two resistors and a USB socket. It charges, and it does nothing else.

The protection module adds a DW01A and an FS8205A — the pair from the previous page — and brings out a second pair of pads marked OUT+ and OUT−. That pair is the protected side, and it is the one your load should be connected to.

You can tell them apart by counting: the protected board has two extra black chips next to the battery pads and six pads instead of four.

What it is not

A TP4056 cannot boost. Its output is a lithium cell at 3.0–4.2 V, which is not 5 V and is not even reliably 3.3 V once a regulator has taken its headroom.

It also has no concept of a load. The BAT pin is a battery pin, and what happens when you wire a project to it as well is the next page.

Edit this page — content/fundamentals/power/charging-with-a-tp4056.mdx

Discuss this article

Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.

Browse Fundamentals on the forum