Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Battery Charger in Parallel with System Load Current Sharing
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Battery Charger in Parallel with System Load Current Sharing

by mrnoisytiger on Fri Aug 07, 2020 1:30 am

Currently, I'm building a project which can either run connected over USB or via a battery. The project itself switches between either high current draw at around 450mA or low current draw at 50mA.

Right now, my circuit is designed such that my battery charging circuit is using a TP4056 in parallel with my main system load. The battery is connected to the TP4056 as well as a boost converter to 5V [more accurately, 4.6V]. An example of the schematic is below, assume all supporting components and diodes are there.

Screen Shot 2020-08-06 at 10.10.21 PM.png
Screen Shot 2020-08-06 at 10.10.21 PM.png (117.81 KiB) Viewed 28 times


The System load is, at worst case, drawing 450mA continuously, driving about 80 LED's at 5mA and some support circuitry. The TP4056 battery charger IC is limited to a current draw of 400mA through a resistor on it's programming pin. However, the USB is limited to 500mA, according to standard USB specs.

This brings a problem since the total power needed is greater than the power budget. My goal is to prioritize the system load, giving it the full 450mA when needed, leaving the remaining 50mA for the TP4056. When the system load drops to a low power state at 50mA though, the TP4056 should get the remaining 400mA it asks for.

How can I accomplish something like this? My understanding of parallel devices is that they split current based on resistance calculated using Ohms law. However, I don't have a way of measuring resistance on my system load as it's a dynamic system.

Additional Info
One of my primary concerns is, when USB is connected, driving the project exclusively off USB. Hence, I'm boosting the battery to 4.6V, well below USB min-voltage standard, so the circuit will always "pick" the USB voltage over the battery. I don't need the battery to supply additional current if the USB can't keep up.

mrnoisytiger
 
Posts: 5
Joined: Sun Jul 12, 2020 6:26 pm

Re: Battery Charger in Parallel with System Load Current Sha

by adafruit_support_mike on Mon Aug 10, 2020 3:52 am

That's possible, but you'll need a circuit like this:

limiter.png
limiter.png (78.09 KiB) Viewed 13 times


Moving from right to left, Q3 controls current to the LiPo charger. It's a PNP transistor, so as the voltage at its base falls, the current through Q3 increases. Ignoring everything to the left, the values of Ra and Rb are chosen to let 450mA flow through the charger.

Q2 sits in parallel with Ra and sends a varying amount of current to Rb. The extra current makes the voltage across Rb rise, shutting off Q3 and reducing current to the charger.

Q1 controls the voltage at Q2's base, relative to the voltage across the sense resistor Rs. As the voltage across Rs rises, Q1 turns on further, pulling the base of Q2 lower. That sends more current through Q2 to Rb, shutting off Q3.

Going the opposite direction, if the main load uses less current, the voltage across Rs falls, shutting Q1 down a bit. That sends the voltage at Q2's base higher, shutting that off a bit as well. The loss of additional current through Q2 makes the voltage across Rb fall, pulling Q1's base lower and sending more current to the charger.

I've used bipolar transistors for the sketch because the relationship between base-emitter voltage and collector current is well defined. You can also use mosfets, but you'll need more voltage swing at the gates, and probably some level shifting. The key idea is that increasing current through the main load shuts off the device that controls current to the charger.

adafruit_support_mike
 
Posts: 61422
Joined: Thu Feb 11, 2010 2:51 pm

Re: Battery Charger in Parallel with System Load Current Sha

by mrnoisytiger on Mon Aug 10, 2020 2:10 pm

Thank you Mike! This is a beautiful and elegant solution! Appreciate the help!

mrnoisytiger
 
Posts: 5
Joined: Sun Jul 12, 2020 6:26 pm

Re: Battery Charger in Parallel with System Load Current Sha

by adafruit_support_mike on Tue Aug 11, 2020 8:00 pm

Actually, here's a more mature design:

current-balancer.png
current-balancer.png (184.56 KiB) Viewed 7 times

Transistor pairs Q1-Q2 and Q3-Q4 are current mirrors: Q1's collector sets its base voltage to whatever is necessary to let a given amount of current flow through Rs. Q2's base is connected to the same voltage, so if Ra=Rs, the same amount of current will flow through Q2. If Ra and Rs have different values, and the voltage across Rs is more than about 500mV, the current through Q1 will be Rs/Ra of the current through Q1. The 1000:1 ratio mentioned in the diagram turns 450mA through the main load into 0.45mA through the current balancing system.

The current through Ra and Rb flow into Rc. The op amp controls Q5 to keep the voltage across Rc equal to Vref, chosen to make the total load current 450mA.

That design has a weakness though: the voltage across Rs and Q1 will be about 1V, which could be a significant loss for the main load. Also, if the voltage across Rs is more than 500mV @450mA, each Rs will generate more than 225mW of heat.

This more complex design improves on that, but works on the same principle:

complex-balancer.png
complex-balancer.png (239.82 KiB) Viewed 7 times

The op amps at the top produce gain of 23:1. At that level, 450mA through a 0.1 Ohm sense resistor will produce 45mV @ 20mW and dissipate 20mW, and the amplifier will turn that 45mV into about 1V. Diode-connected transistor Q1 and its 33k pull-down provide about 0.6V of drop below the op amp's output voltage. That cancels Q2's base-emitter voltage, making the voltage across its 10k emitter resistor close to the same as the op amp's output voltage. The end result is that 450mA through the load creates a proportional current between 0mA and 0.1mA in the balancing circuit.

That maximum current of 0.1mA produces 2.2V across the 22k resistor.

The op amp at the bottom controls Q5, which controls the current through the charger, to hold the voltage at the top of the 22k at 2.2V.

The voltages across the 10k balancing resistors are directly proportional to the currents through each load. The 22k resistor and op amp ensure that the sum of the currents through the 10ks remains constant, and that amount is controlled directly by the 2.2V reference voltage.

adafruit_support_mike
 
Posts: 61422
Joined: Thu Feb 11, 2010 2:51 pm

Please be positive and constructive with your questions and comments.