The TP4056 chip is a lithium Ion battery charger for a single cell
battery, protecting the cell from over and under charging. It
has two status outputs indicating charging in progress and charging complete. It also has a
programmable charge current of up to 1A.
You can use it to charge batteries
directly from a USB port since the working input voltage range is 4V ~
There are two types of common breakout boards for this chip:
One with only the charger chip on board.
One with three chips on board.
Here you are looking at the 3 chip breakout board (TP4056, DWO1A and 8205A MOSFET).
What you can learn here:
How to use the TP4056 breakout board.
How to use the TP4056 safely.
How the DWO1A works on the TP4056 breakout board.
How to set temperature limits using the TP4056 TEMP input.
Lithium batteries can be dangerous if not charged properly and that's
why the TP4056 is useful as it stops over voltage and current charging
at specific conditions.
There are a lot of circuits out there that show the
use of the TP4056 as both a charger and a load driver - Not Good.
If a load is attached to the battery while charging, then the TP4056 can
not detect when the charge current has fallen to C/10. So it carries on charging- this could be dangerous
You should never use the TP4056 as a charger and as a load driverat the same time. When charging
the battery, switch off the load, and when loading the battery, switch off the charger.
Alternatively use a PMOSFET, a resistor and a schottkey diode.
Lithium batteries can notabsorb overcharge - the current must be cut
off after charging. If not there could be
Constant Current / Constant voltage charging method.
The programming resistor (R3 or Rprog) is set to 1k2 which provides
1A programming charge rate or 1C. If your battery is not 1000mAh (1Ah),
then you need to remove R3 and replace it with the correct one following the
information in the table on the right.
TP4056 Status indicator LEDs
The table on the left shows the state of LEDs for various charging states:
When charging a battery using the above board connect the battery to
B+ and B- and disconnect OUT+ and OUT- from your circuit. When using the
battery disconnect the 5V input and take the output voltage from OUT+
and OUT- to your circuit.
The following diagram shows a typical setup (from the datasheet).
Here you can see the two status LEDs (CHRGn, STDBYn), Battery connection
(BAT), Current control connection (PROG) and TEMP connection. Some LI
batteries have an internal thermistor that you can connect as shown
above. In the breakout boards available generally TEMP is not used and
connected to Ground.
The TP4056 does not give you reverse polarity protection so
if you wire up the battery the wrong way round then you'll get smoke!
Actually, there is no TP4056 reverse polarity protection and the
DWO1A battery protection IC (on the breakout board) is being used in the
wrong way (or not in the best way)! If used correctly the DWO1A does provide reverse polarity protection for a battery.
DWO1A Battery Protector Chip
On some breakout boards there are an extra 2 chips. One is the DWO1A
and the other is a dual N Channel MOSFET required by the DWO1A chip.
Learn more about the DWO1A Battery protector here.
On the breakout board, the chip is soldered to the TP4056 so this can
never be connected the wrong way round at the "charger input". At the other side the DWO1A does not protect
from connecting the battery the wrong way round!
This chip will not activate for battery voltage level problems (unless the TP4056 fails) since the TP4056:
Stops discharging at voltages below 2.9V; Here trickle charge activates. The DWO1A threshold is ~ 2.4V; So it will never activate.
Stops charging at voltages above 4.2V. The DWO1A threshold is ~ 4.3V; So it will never activate.
The only function that will operate is the overcurrent protection and
short circuit protection. These will activate at around 3A when using
the 8205A dual Mosfet.
One problem with this circuit is that you must disconnect the load
when charging. The reason is that the charging circuit detects when the
charge rate falls below C/10 (Constant current charge mode near the
end of the charging cycle). C is the battery capacity in mAh.
If you have a load connected to the battery then this will change the
current detected so the TP4056 may never terminate the charging
Using 3 Components to achieve safe charging
A way around this problem is to use a switching circuit employing a
P Channel MOSFET - this is sometimes called load sharing or automatic
power path control. it is a controlled switch that disconnects the
battery when external power is applied.
The idea is that when a power source is connected to the
Battery charger chip, the PMOSFET disconnects the battery from the load.
The TP4056 still charges the battery but without a load. Power to the
load is supplied from the power source directly.
When the power source is disconnected, the PMOSFET is turned on connecting the load to the battery.
With this configuration the TP4056 can safely charge the battery with
the load connected, as the battery is isolated from the load during
external power application.
PMOSFET power Sharing
The following diagrams show how the PMOSFET is used for power sharing.
To turn ON the PMOSFET, the Gate must be negative (<VGS(th)) w.r.t the Source.
To turn OFF the PMOSFET, the Gate must higher than VGS(th) w.r.t the Source.
Note: VGS(th) is the threshold voltage of the MOSFET.
PMOSFET ON (Just the battery)
Here the gate of Q1 is low (pulled down by RPULL) and the PMOSFET is on, so current flows from the battery to the load.
[Source: Microchip application note AN1149]
To see what is going on here start with the battery with no external power supplied:
State of D1 No Input Power
When the battery is connected to the circuit, the parasitic diode (of
Q1) is forward biased and Vbat-0.6V appears at the negative side of D1.
Since the other side of D1 is pulled to ground D1 is reversed biased so
no current flows through it. So it can be ignored (except for leakage
current = small so ignore anyway - but some schottkey diodes may leak a lot requiring lower RPULL).
State of Q1 No Input Power
The cathode of D1 is also connected to the Source of Q1. The gate of Q1 is also pulled to Ground by Rpull. So VGS is "0 - (Vbat-0.6V)" = -(Vbat-0.6V). Vbat is between 2.9V and 4.2V.
As long as VGS
is more negative than the Gate Threshold voltage of Q1 (VGS(TH)), Q1 is on and
conducts current between the Drain and the Source.
So the Gate to Source threshold
voltage of Q1 (VGS(TH)) must be better than -2.3V -(2.9-0.6)
to turn Q1 on. You can select this threshold by choosing the right
MOSFET (See the table below for example MOSFETs).
Note: The TP4056 will trickle charge a very deeply discharged battery
where Vbat is< 2.9V until it reaches that 2.9V so you will want a
threshold voltage better than -2.3V. e.g. -1.0 ~ -1.5 would be good.
Once Q1 is on the parasitic diode is bypassed and Vbat is connected to the load via the internal resistance of Q1 (RDS).
Note: RDS is an important parameter here;
As more current is drawn by the load, more voltage is dropped across RDS.
So the output voltage at the load is dependent on the current drawn by the load.
Lower RDS gives higher output voltage.
PMOSFET OFF (Power source connected)
[Source: Microchip application note AN1149]
Here the gate of Q1is high and the PMOSFET is off. so the
battery is isolated from the load. The power source drives current
through the schottkey diode (D1) to the load.
VG = VIN
VGS = VPOWER - VD1FV
Conditions for the PMOSFET to be OFF are:
The Gate is higher voltage than the Source : Vgs > VGS(TH) i.e. more positive.
Since the Gate is equal to Vin (~5V) and the diode drops 0.4V, Vgs is positive by 0.4V, therefore the MOSFET is off.
You would probably want to avoid the higher RDS(ON) device as you loose volts when drawing more current.
Example of a Schottkey Diode
MBRS130LT3: Forwards voltage drop of 0.395V (max for 1A and @ 25°C).
Note: The schottkey diode will heat up when the charger is externally
powered. The Power used depends on the load attached to the output - current through it and voltage drop accross it.
An alternative to the schottkey diode is to use the 2nd PMOSFET in the IRF7329 above to
replace the diode. This would need controlling using a microcontroller
or using the status outputs of the TP4056 (see the LTC4056 datasheet -
which is a different chip but provides a design reference).
How to use the TP4056 TEMP control Input
Although the TEMP input is not used on most breakout boards, it can be
used to disable charging of a battery when it reaches low or high
internal temperatures. This is an important safety feature when the
ambient temperature is below 10°C or above 45°C.
The diagram below (from the datasheet) shows use of the TEMP input with a
battery that includes a NTC (Negative Temperature Coefficient)
The TEMP input is used to disable charging if the internal battery
temperature becomes too high or too low. It is usually grounded at the
chip pin on breakout board.
Using this input in your own designs ensures safer charging but you need
a battery with an internal thermistor. The TP4056 can then shut down
charging if the temperature inside the battery becomes too high or too
Working out R1 and R2 for the TP4056
R1 and R2 are not specified in the datasheet so you have to work these
out based on the thermistor specification in your specific battery. From
" If TEMP pin’s voltage is below 45% or above 80% of supply voltage VIN for more than 0.15S, this means that battery’s temperature is too high or too low, charging is suspended. " [ source TP4056 Datasheet ]
Note: Use these calculations at your own risk. Also you must use the
battery manufacturer's data on the thermistor for operational use. Also
other standards suggest charging at even tighter temperature limits.
Temperature Limit Design Calculations
The battery's internal NTC thermistor reads 10k at 25°C and has a Beta value of 3950 (this is for a type MF52 thermistor).
Note: You can charge outside
these temperatures ( 5°C ~ 45°C ) but with a more complex chip than the
TP4056, one that reduces charge/voltage at outside these temperatures
but never charge below 0°C.
For 45°C the thermistor resistance is about 4k2.
For 5°C the thermistor resistance is about 26k.
Warning: This is just an example calculation. Always use the battery
manufacturer data sheet for the thermistor inside the battery to ensure correct operation.
If Vtemp is below 45% of the supply (hotter) or above 80% of the supply
(colder), this indicates an out of temperature condition. For an NTC
thermistor, its resistance falls with increased temperature.
You can see that R1 is pulled high and R2 is pulled low and and they connect to one side of RNTC. The other side of RNTC is attached to ground.
So R2 is in parallel with RNTC. This parallel resistance forms the lower half of a voltage divider with R1. As temperature increases so RNTC falls pulling the TEMP input voltage down.
The trick is to select resistors that give you the correct %output when RNTC changes resistance at specific temperatures.
It can be a bit tricky selecting the correct resistors but remember the
battery will heat up as current is drawn so the most important
parameter is the high temperature cut off. You want to stop charging
above 45°C (low NTC thermistor value).
You can scratch your head trying to figure out algorithms for a while as
there are three variables to change and with two set points to get
right. But an easier way is to write a program for a brute force method.
Using the above equations in the program and stepping through resistance
values from 100 to 250e3 with 100R steps and using the following input
values gives quite a few output results. This one seems quite good.
Found 4900 86200 Ratio1 0.450 Ratio2 0.803
The closest Standard resistors (E48) are:
(E48) R2 = 86600
(E48) R1 = 4870
These standard values result in the following ratios:
Real Time Clock Design (FREE): A Free and Complete RTC design using the DS1307 and a PIC micro (16F88) also re-targetable. This PIC project uses an I2C Clock chip and 7-segment display to create a fou…