TP4056 Part 2

This page is a continuation from page 1 here.

This page shows you Two aspects of using the TP4056:

  1. How to use the TP4056 in the correct way (load disconnection during charging).
  2. Automatic charge stop on internal battery temperature limit.

TP4056 Power Sharing Problem

This is the schematic of the popular breakout board with label 03962A this shows the TP4056 pinout for the breakout board.

TP4056 breakoutboard schematic

[ Source:www.sunrom.com/p/lithum-battery-charger-with-protection-microusb ]

One problem with this circuit is that you must disconnect the load when charging the battery. 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 process!

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.

charger powerpath PMOSFET on
[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 Schottky 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 - it's the internal resistance of the PMOSFET from Drain to source i.e. the internal resistance of the MOSFET.

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)

charger powerpath mosfet off state
[Source: Microchip application note AN1149]

Here the gate of Q1 is high and the PMOSFET is off. so the battery is isolated from the load. The power source drives current through the Schottky 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.

Examples of P MOSFET Selection


Device
Manufacturer
RDS(ON) mΩ @Vth=-2.5
VGS(th)
V(max)
IDMAX (25°C)
(cont.) A

Pdiss
W
Package
AO3401 Alpha and Omega
Semiconductor
85
-1.3
-4
1.4
SOT23
FDN336P
On Semiconductor
270
-1.5
-5
0.5
SOT23
DMP1045U
Diodes Incorporated
45
-1.0
-4.3
0.8/1.5[1]
SOT23
IRF7329 (DUAL FET)
International Reftifier
21
-0.9
-9.2
2.0
SO-8
[1] (Depends on mounting)

You would probably want to avoid the higher RDS(ON) device as you loose volts when drawing more current.

Example of a Schottky Diode

MBRS130LT3: Forward voltage drop of 0.395V (max for 1A and @ 25°C).

Note: The Schottky 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 across it.

An alternative to the Schottky 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) Thermistor:

Typical circuit for tp4056
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 low.

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 the datasheet:

" 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 ]

Recommended operating temperature

Battery University recommends charging only from 5°C to 45°C.

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

Assumption:


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.

Typical circuit for tp4056
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.

RNTC is in parallel with R2. Therefore:

    RPARALLEL = RP = ( RNTC * R2 ) / ( RNTC + R2)

    VTEMP = Vsup * (  RPARALLEL ) / ( RPARALLEL + R1)

and

    VRATIO = VTEMP / Vsup = (  RPARALLEL ) / ( RPARALLEL + R1)

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:

r1 4780 r2 86600 Rntc1 4.2e3 Rntc2 26e3
Ratio1  0.4559
Ratio2  0.8071

These will stop the TP4056 charging below 5°C and above 45°C (approx).

Note: Remember to account for resistor tolerance and thermistor accuracy.

Program to calculate Ratios

This is a tcl program. You can download (the completely free) tcl language at Activestate.com.

# Inputs  for MF52 (B=3950)
set vratio1 0.45
set vratio2 0.80
set ratio_tol1 0.01
set ratio_tol2 0.05
set Rntc_min 4.2e3
set Rntc_max 26e3

# Stepping controls
set tpPriv(step) 100 ;# Step size
set tpPriv(startR)  100  ;#Step start
set tpPriv(maxR1R2) 250e3 ;# Step end
set tpPriv(stop) 0

console show

################################################################
proc get_ratio { Rntc r1 r2 } {
   set Rpara   [expr { ( 1.0* $Rntc * $r2 )/( $Rntc  + $r2)} ]
   set Vratio  [expr { ( 1.0* $Rpara      )/( $Rpara + $r1)} ]
   return $Vratio
}

################################################################
proc within_tol {num val tol} {
   if {$num >= ($val-$tol) && $num <= ($val+$tol)} {return 1}
   return 0
}

################################################################
proc  testTP4056Temp {Rntc1 Rntc2 Ratio1 Ratio2 tol1 tol2} {
global tpPriv
   set op {}
   set tpPriv(found) 0
   for {set r1 $tpPriv(startR)} {$r1<$tpPriv(maxR1R2)} {incr r1 $tpPriv(step)} {
   puts "$r1" ; update
       for {set r2 $tpPriv(startR)} {$r2<$tpPriv(maxR1R2)} {incr r2 $tpPriv(step)} {

          set VratioCalc1  [ get_ratio $Rntc1 $r1 $r2]

          if { [within_tol $VratioCalc1 $Ratio1 $tol1] } { ;# if this is ok check the other ratio

             set VratioCalc2 [ get_ratio $Rntc2 $r1 $r2]

             if { [within_tol $VratioCalc2 $Ratio2 $tol2] } {

                set frat1 [format "%2.3f" $VratioCalc1]
                set frat2 [format "%2.3f" $VratioCalc2]
                puts "Found $r1 $r2 Ratio1 $frat1 Ratio2 $frat2" ; update
                lappend op  "Found $r1 $r2 Ratio1 $frat1 Ratio2 $frat2\n"
                incr tpPriv(found)
             }
          }
          if {$tpPriv(stop)} {break}
       }
       if {$tpPriv(stop)} {break}
   }
   set fh [open op.txt w]
   puts $fh [ join $op ]
   close $fh
}

proc stop {} {set ::tpPriv(stop) 1}

pack [ button .b -text Stop -command stop ]

testTP4056Temp $Rntc_min $Rntc_max $vratio1 $vratio2 $ratio_tol1 $ratio_tol2

puts "\nFound: $tpPriv(found)\n\n"

Conclusions

The TP4056 is designed for charging control of a Lithium Ion/Poly battery pack that you charge at home, and take out with you, just in case you run out of charge when you are out.

Note: The DW01A only provides current limit protection. See here.

For this battery pack you attach a cable at home from the charger socket (Flat USB) to the micro USB socket of the battery pack. You then wait until it has charged and remove the charging cable. When you are out and about, you plug in the Flat USB cable to the battery pack and from there to your phone's micro-USB socket (or whatever your phone uses) to charge the phone.

Notice that you never both charge the battery pack and charge the phone from the battery pack. You always charge the phone directly from the charger socket at home and you can't charge the battery pack when you are out.

This is the exact problem the TP4056 was designed to solve and it should not both charge a battery AND power a load (phone or circuit) at the same time. That is why adding the PMOSFET, Zener, and resistor makes it safe to use.

However, I have never heard of any problems in using the breakout board as it is commonly used - as a charger and power source at the same time. But it is far safer to tack on three components as discussed in this page.

P.S. If I was designing this in a commercial setting, I would definitely add these components - Would not want to be blamed for the consequences!


New! Comments

Have your say about what you just read! Leave me a comment in the box below.




Privacy Policy | Contact | About Me

Site Map | Terms of Use