(August 2022)

I first heard about TP4056 from various Youtubers - many years ago.

Modules equipped with that chip are dirt-cheap; yet allow for easy and safe charging of the LiPos in our designs.

TP4056 module
 
TP4056 module

I proceeded to use these modules in my experiments. The setup was easy: the LiPo gets connected to B+ and B-, and my load was powered from OUT+ and OUT-.

Whenever I wanted to charge my LiPo, I'd plug my USB powerbank to the TP4056 module input - and everything worked fine; the LiPo charged at the max current I wanted (selected via a configuration resistor on the module board).

But sometimes, I wanted to charge the LiPo and feed my load. At the same time.

This is apparently called "Load Sharing", since the power provided at the input is shared by both your load, and your LiPo charging.

Following the example of the "expert" Youtubers, I did the same thing in this scenario as well: I'd plug my powerbank in the TP4056 module, and let it charge the LiPo, and simultaneously, power my circuit from the OUT+ and OUT- points.

What I did not know, was that this was stupid - and dangerous.

Why?

Zak's article, linked above, refers to a design that uses an MCP73831; but what he says applies identically to the TP4056 as well; and in fact, to any charging circuit.

TP4056 schematic
 
TP4056 schematic

Executive summary:

Solution - a P-channel MOSFET, setup in reverse

Zak's solution is shown on the schematic on the left, below. You'll notice that the MOSFET is actually connected in reverse to the usual P-channel setup (on the right) - input is to the Drain, and output is from the Source:

P-channel MOSFET to the rescue P-channel MOSFET to the rescue
 
The top-green-line carries 5V from USB input to the Gate;
the middle-green-line carries OUT+ from TP4056 to the Drain

So how does this work?

Put to use

I proceeded to modify one of my prototypes to implement this configuration on a design I did a couple of years ago, that uses a GPS/Galileo receiver, an RTC clock and a 16x2 LCD, driven and controlled by an Arduino. It works quite well, getting accurate location/time information.

And yes, as seen below, I put it all on cardboard. Fire hazard on steroids :-)

All I needed to do, was to find a place for the resistor, Schottky and the FQP27P06. Once I managed that, my multimeter showed that when I connected my TP4056 to my USB powerbank, the MOSFET's source ended up at 4.6V...

P-channel MOSFET to the rescue

...and when the powerbank was unplugged, the Source dropped to 3.65V (as expected; that was indeed my LiPo's charge level at the time):

P-channel MOSFET to the rescue

In plain words: it worked :-)

In this prototype, the Source of the FET is then connected to a B6288-based boost converter...

Boost converter

...that takes the voltage up to 5V. That is then used to feed the Arduino and all the rest - and it works regardless of whether the boost converter sees V(battery) or 4.7V as an input.

Summary

This was a very simple modification to my charging circuitry; and it allowed me to do proper load sharing. I strongly advise you to do a similar modification, if (like me) you used your TP4056 to power your load and charge at the same time. Don't do that. Also, checkout Zak's article: it has a lot more details and theory, and many interesting discussions he has with people that doubt his design.

They shouldn't - it works perfectly.




profile for ttsiodras at Stack Overflow, Q&A for professional and enthusiast programmers
GitHub member ttsiodras
 
Index
 
 
CV
 
 
Updated: Thu Dec 15 07:03:11 2022
 

The comments on this website require the use of JavaScript. Perhaps your browser isn't JavaScript capable; or the script is not being run for another reason. If you're interested in reading the comments or leaving a comment behind please try again with a different browser or from a different connection.