# How to prioritize a current path in a circuit [duplicate]

Here's my problem:

I have a power supply rated at 5V, 2.1A

I need this to feed two devices, both running at 5V

• Device one is a single-board computer that can consume anything between 0.5A and 1.5A depending on what it's doing.
• Device two is a battery charger, which is happy to take anything it can get up to (and quite possibly beyond) 2A, and equally happy to take no power at all.

I need a way to feed device one with as much current as it is demanding right now, and give whatever is left to device two. In order to stay within the PSU limits, I'm going to be limiting the input current to 2A. I'm a beginner, and from my limited understanding (so please correct me if I'm wrong) the chances are that device one could end up current-starved otherwise.

I'm not happy with simply making two fixed current-limited paths (1.5A to A, 0.5A to B) - I really do want any excess current delivered to device B, if there is any available for it.

The only thing I can think of is to dynamically monitor the amount of current currently going to devices A and B, and to throttle down device B by opening and closing current-limited gates with transistors (or using a variable current-limiting circuit controlled by a digital pot) with a microcontroller until the sum of the two is less than (2A minus a safety buffer), along with some caps in there to keep things running during switching. However, that sounds a bit complex for something that I have a gut feeling ought to be much simpler, and possibly involves using some kind of specialized IC that I don't know the name of in order to search for it.

This is a problem I feel I'm going to run into with other things as well - not just charging a battery, so I'd like to know if there's any way (simpler than the complex microcontroller solution I imagined earlier) to manage the current distribution in a circuit when the supply doesn't meet the demand - some way to simply say "current goes here first, and what is left over goes there"

• Are the batteries going to be powering device A? May 3, 2016 at 10:51
• The batteries will, indeed, be powering device A. However, the charger turns off output while charging - otherwise I'd be happy simply letting the current flow in and out the other side ;) So, the batteries will only power device A when there is no external power coming in. Essentially, I'm trying to build an external pass-through for a battery charger that doesn't have one built-in. May 3, 2016 at 10:52
• Get a better battery charger. May 3, 2016 at 10:56
• The problem is, nothing I can find with load-sharing built in can handle that 2A input/output. I really don't want to get into designing a lipo charger myself, as I feel that's probably going to end up with me blowing up some batteries ;) The original question, however, stands - is it possible to prioritize current in a circuit in the way I'm asking? What if, for arguments sake, device B was not a battery charger but a set of lights which I only wanted powered if there was enough excess power to do so? May 3, 2016 at 11:03
• Why not try doing this with a well chosen transistor?You can feed the board's GND to the base and connect the other end of the power supply to the collector.The other charger will be in parallel with this collector.You run this transistor in active mode. May 3, 2016 at 11:28

First, some clarification. There are two loads for one power supply: load A and load B. Load A needs to get power at 5 V with (at most) 10% tolerance. It can take any current in range from 0 (or 0.5 A, it does not matter) to the maximum capacity of the power supply. Load B must get "what remains".

There is no common solution for this problem. The design depends on properties of the second load B. Consider these cases:

Then our circuit can control its power consumption by lowering the voltage on the load B. Then the right design is: make the step-down (buck) DC-DC power supply for load B. It regulates the voltage on the load B in range from 0 V to 5 V in such a way that the common current by loads A and B does not exceed the capacity of the power supply.

This is not so simple, but doable.

Load B has some external (analog) control input to adjust its current

Then the design is similar: the control circuit controls the voltage on this "load B control input" to keep the total current below the maximum one.

Load B is a step-down DC-DC controller that powers up a computer

There is no good solution for this task. The best we can do is to switch off the second load when the total current by loads A and B exceeds the upper limit.

The reason is simple: the step down power supply would increase the input current on any attempt to lower the input voltage (until it shuts down due to undervoltage). This feature makes a positive feedback. Any attempts to regulate the power for load B leads to shut down of this load B.

It seems your case falls to the last class: you can not control the current consumed by the battery charger. So you can only switch it off by any kind of switch (N channel MOSFET is the best choice, until you do not need to keep devices on the same ground).

You can build a circuit that behave as you say. Basically, you need a small shunt resistor that measure the total current consumed by both device, a P-channel mosfet that will limit the power provided to device two, and an opamp inbetween that adjusts the gate voltage of the mosfet depending on the total current (i.e. that will shut down gradually the mosfet as the total current reaches the maximum).

The thing is: such a monitoring circuit can only work if you have a resistive circuit as device two (e.g. a set of lights). However, a battery charger is an active circuit. It will probably not work at all if the voltage is below a given limit. So in the end, this will not work for your application, or be completely unstable (when the battery charger uses too much current, the monitoring circuit will shut down the mosfet a little bit, leading the battery charger to go undervoltage, so it will shut down, not using any current at all, then the monitoring circuit will rise again the battery charger voltage, which will draw too much current, etc...).

The only way is to be able to tell the battery charger how much power it can suck. So, either you find a battery charger designed with this capability, or you have to design your own.

Plenty of single-board computers have battery charging chips built-in . If you don't want to design your own charger circuit, the most logical thing for you is to get one such SBC and simply connect a battery to it.

This solution will have the added benefit of battery status being known to the SBC, so it can shut down properly when the battery is getting low. You'll also have plenty of settings available, like maximum PSU current, maximum battery charging current, target battery voltage etc.

Alternatively, get a battery charger with charge current limited below 600mA.