# How to switch power supply between two 24V batteries automatically & efficiently

Currently, I have a circuit with two motors (200 W, 24V, 8A max), motor drivers, DC DC converters, controllers and other components powered by a 24V Li-ion battery. The problem with current setup is whenever the battery drains, we need to replace it with the fully charged battery which forces us to shut down the whole system while swapping batteries.

The proposed idea for this issue is to use two batteries and design a power management system such that if one battery drains below the threshold voltage, the circuit automatically switches power supply to the other battery and vise versa. Before the second battery depletes, the user will be prompted to replace the first battery and vice versa. The battery management circuit should also measure the voltage level via Arduino Analog pins so that user can be prompted.

Though, i found many useful information from similar posts, i am still feeling little bit lost.

How to use diode oring to switch between two power sources

From the above link, i found 2 simple circuits.

The main problem with the circuit above is that if we use batteries for both sources (V1 and V2) , they deplete concurrently which is not preferred in my case.

In the circuit above, When V1 is cut off or drops below threshold voltage, the relay switches two V2. But, the problem is once V1 is connected back, the circuit switches back from V2 to V1 which again is not desired.

What I am looking for is a solution where the circuit runs on first battery and when the first battery drops below the threshold value, the circuit should switch to second battery and the user will later replace the first battery. Again, when the second battery voltage drops below the threshold value, the circuit should switch back to the first battery. This is to ensure that the battery is fully drained before charging.

I am open to use diodes, relays, transistors and arduino (it's already in the circuit). I am afraid there might by huge power loss if we use diodes.

• 1) How much current would have to be switched? 2) Must switchover occur with no dropout? – EM Fields Aug 8 '16 at 7:55
• @EMFields 1) 5A to 10A may have to be switched. 2) Yes, the switchover must occur without a drop out (as the CPU turns off immediately if there's a dropout) – prasanth_ntu Aug 8 '16 at 8:31
• What happens when the 2nd battery becomes depleted and the first battery is not in position or recharged. You need to logically cover the what-ifs. – Andy aka Aug 8 '16 at 8:55
• @Andyaka Thanks for the prompt. Before the 2nd battery depletes & when the first battery is not recharged, user will be notified (via buzzers or screen) to manually replace the first battery. The same applies for the other battery. – prasanth_ntu Aug 8 '16 at 9:15
• No, you are missing my point. What if the battery is not replaced - you want a solution that has to cope with the what ifs. It's no good saying it will be replaced - what if it isn't - how does the system cope, what should the system do. Think about it more. – Andy aka Aug 8 '16 at 9:17

The battery that is currently switched in must keep the other battery switched out until the first battery is drained, and once switched over must stay that way until the other battery drains (even after the first battery is replaced). This implies a symmetrical bistable circuit.

Here is a possible solution using relays:-

simulate this circuit – Schematic created using CircuitLab

Each battery has a relay with a normally closed contact that keeps the other battery (and its relay) switched off. Whichever battery is connected first will have priority - until it is drained, then its relay will turn off and give control to the other battery.

This circuit has a few potential problems.

1. When the drained battery's relay releases and connects the other battery the voltage will rise, which may cause the relay to pick up again before the other relay has time to operate. If this happens the relays will chatter instead of switching over cleanly.

2. The relays may become sensitive to mechanical shock or vibration when close to the release point, and the cutoff voltages may not be well defined.

3. Relay contacts increase resistance and get noisier with use. Eventually the circuit may become unreliable.

For these reasons I would consider using a solid state circuit (comparators and logic gates or an MCU) to monitor the battery voltages and control the switchover, and MOSFETs to switch between batteries.

• Thanks for the detailed explanation including narrating the potential problems. Could you explain more on using the solid state circuit (MCU, i already have an arduino) to monitor the battery voltages and control the switchover, and MOSFETs to switch between batteries. I am more interested to explore this option. Note: I am using a 24V battery. For monitoring the battery voltage using an Arduino, would it be advisable to use resistors to do a voltage divider (from 24V to 5v) or is there any better way to do it? – prasanth_ntu Aug 10 '16 at 4:59
• You would use P channel MOSFETs (rated for at least 30V and 30A) with level shifting gate drivers, or DC solid state relays. The Arduino continuously measures the voltage on each battery, and operates the FETs/SSRs to switch each battery in and out as required. Using a voltage divider is fine. Only requirement is that the resistor going to ground should be 10k or less. – Bruce Abbott Aug 10 '16 at 6:56
• @BruceAbott: I added the circuit that i have came up with in the link shared below. I am quite new to electrical circuits and I am pretty sure that there are numerous mistakes in it. Any help/ suggestion/ advise would be highly appreciated. The intended functionality of the circuit is that if battery1 voltage is greater than threshold value, it will turn on NMOS1 using Arduino Digital Pin 1 and vise versa. **[Click here to access the Link for circuit diagram]**(drive.google.com/file/d/0B0F55gMRFtkWU1kxN1UzRmZtdm8/…). – prasanth_ntu Aug 11 '16 at 3:55
• Your circuit makes no sense. The load has two battery inputs and two switches going to a common ground, but how does it distinguish between them? The Arduino measures positive voltages only so you should common the battery negatives (= Arduino ground) and switch the positives using P channel MOSFETs. Level translators will be required to change the Arduino's 0~5V output to 24V~12V. These can just be a transistor and two resistors, like this:- electronics.stackexchange.com/questions/70729/… – Bruce Abbott Aug 11 '16 at 4:40
• Thanks again. Any reason for recommending to use P channel MOSFETs and not N Channel? I assume, for N channel, we don't need a level translators – prasanth_ntu Aug 11 '16 at 4:56

From your comment question, here are some high side and some low side switched circuits:

From your subject question, and as has has already been suggested, at first glance it might seem attractive to use a couple of P-channel MOSFETs, as shown below, to switch between the batteries.

Unfortunately, the MOSFET substrate diodes will create a problem when either battery voltage drops about 0.7 volt lower than the other one.

When that happens, the lower voltage diode will no longer be reverse biased and the higher voltage battery will begin pumping current into the lower voltage one when the higher voltage one is turned on.

In the schematic included below I've shown external diodes, for clarity, and have indicated the path the conventonal current will follow, with R1 representing the 10 ampere load you mentioned.

Note that, in this instance, Q1 is completely turned off and Q2 is in saturation.

I've included the LTspice circuit list so you can play with the circuit if you want to.

The same thing happens if you do low side switching using NMOS.

R2 is the 10 ampere load, and R1 represents control stuff that needs to be ON all the time.

Version 4
SHEET 1 2680 2660
WIRE -3280 -400 -3328 -400
WIRE -3168 -400 -3216 -400
WIRE -2944 -400 -2992 -400
WIRE -2832 -400 -2880 -400
WIRE -3328 -304 -3328 -400
WIRE -3328 -304 -3408 -304
WIRE -3296 -304 -3328 -304
WIRE -3168 -304 -3168 -400
WIRE -3168 -304 -3200 -304
WIRE -3088 -304 -3168 -304
WIRE -2992 -304 -2992 -400
WIRE -2992 -304 -3088 -304
WIRE -2960 -304 -2992 -304
WIRE -2832 -304 -2832 -400
WIRE -2832 -304 -2864 -304
WIRE -2736 -304 -2832 -304
WIRE -3408 -240 -3408 -304
WIRE -3344 -240 -3408 -240
WIRE -3280 -240 -3280 -256
WIRE -3280 -240 -3344 -240
WIRE -3088 -224 -3088 -304
WIRE -3408 -208 -3408 -240
WIRE -2736 -208 -2736 -304
WIRE -2880 -192 -2880 -256
WIRE -3408 -64 -3408 -128
WIRE -3088 -64 -3088 -144
WIRE -3088 -64 -3408 -64
WIRE -2880 -64 -2880 -112
WIRE -2880 -64 -3088 -64
WIRE -2736 -64 -2736 -128
WIRE -2736 -64 -2880 -64
WIRE -3408 0 -3408 -64
FLAG -3408 0 0
FLAG -3344 -240 BT1
SYMBOL res -3104 -240 R0
SYMATTR InstName R1
SYMATTR Value 2.4
SYMBOL Misc\\battery -3408 -224 R0
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
WINDOW 0 9 98 Left 2
WINDOW 3 24 104 Invisible 2
SYMATTR InstName BT1
SYMATTR Value PULSE(24 20 0 1)
SYMBOL Misc\\battery -2736 -224 R0
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
WINDOW 0 13 100 Left 2
WINDOW 3 10 9 Left 2
SYMATTR InstName BT2
SYMATTR Value 24
SYMBOL pmos -3200 -256 M270
WINDOW 0 -10 34 VRight 2
WINDOW 3 74 -13 VRight 2
SYMATTR InstName Q1
SYMATTR Value HAT1072H
SYMBOL pmos -2960 -256 R270
WINDOW 0 -10 34 VRight 2
WINDOW 3 74 -13 VRight 2
SYMATTR InstName Q2
SYMATTR Value HAT1072H
SYMBOL voltage -2880 -208 M0
WINDOW 0 -45 9 Left 2
WINDOW 3 24 96 Invisible 2
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
SYMATTR InstName V7
SYMATTR Value 14
SYMBOL diode -3216 -416 R90
WINDOW 0 0 32 VBottom 2
WINDOW 3 32 32 VTop 2
SYMATTR InstName D1
SYMATTR Value RF2001NS2D
SYMBOL diode -2944 -416 M90
WINDOW 0 0 32 VBottom 2
WINDOW 3 32 32 VTop 2
SYMATTR InstName D2
SYMATTR Value RF2001NS2D
TEXT -3392 -32 Left 2 !.tran 2


## UPDATE:

While it appears that MOSFETS won't work because of interactions between their substrates which allow reverse currents to flow when the MOSFET is in forward cutoff, it seems like a couple of relays, with thousands of megohms between their contacts when they're open, might.

To that end, here's a circuit which seems to work pretty well in a simulator, with one small caveat: during switchover there's about a 3 microsecond load dropout which doesn't affect the circuit's control circuitry, but only the heavy switched current to the load.

With proper "tuning" that dropout can be brought under control and a seamless switchover achieved, but why should I have all the fun? ;)

Here's the schematic, the plot, and the LTspice circuit list so you can play with/optimize the circuit if you want to.

Version 4
SHEET 1 2680 2660
WIRE -1568 -912 -2320 -912
WIRE -1504 -912 -1568 -912
WIRE -1120 -912 -1184 -912
WIRE -368 -912 -1120 -912
WIRE -1568 -864 -1568 -912
WIRE -1120 -864 -1120 -912
WIRE -1728 -768 -1728 -800
WIRE -1488 -752 -1184 -912
WIRE -1488 -752 -1536 -752
WIRE -1200 -752 -1504 -912
WIRE -1152 -752 -1200 -752
WIRE -1120 -736 -1120 -752
WIRE -1088 -736 -1088 -752
WIRE -1088 -736 -1120 -736
WIRE -1568 -672 -1568 -752
WIRE -1504 -672 -1568 -672
WIRE -1392 -672 -1424 -672
WIRE -1248 -672 -1296 -672
WIRE -1120 -672 -1120 -736
WIRE -1120 -672 -1168 -672
WIRE -1728 -624 -1728 -688
WIRE -1664 -624 -1728 -624
WIRE -1600 -624 -1600 -752
WIRE -1600 -624 -1664 -624
WIRE -1728 -592 -1728 -624
WIRE -1568 -576 -1568 -672
WIRE -1504 -576 -1568 -576
WIRE -1392 -576 -1392 -672
WIRE -1392 -576 -1440 -576
WIRE -1344 -576 -1344 -720
WIRE -1344 -576 -1392 -576
WIRE -1296 -576 -1296 -672
WIRE -1296 -576 -1344 -576
WIRE -1248 -576 -1296 -576
WIRE -1120 -576 -1120 -672
WIRE -1120 -576 -1184 -576
WIRE -1568 -512 -1568 -576
WIRE -1120 -512 -1120 -576
WIRE -1728 -496 -1728 -528
WIRE -1568 -400 -1568 -448
WIRE -1120 -400 -1120 -448
WIRE -1600 -368 -1616 -368
WIRE -1520 -368 -1536 -368
WIRE -1152 -368 -1168 -368
WIRE -1072 -368 -1088 -368
WIRE -1552 -256 -1552 -336
WIRE -1344 -256 -1344 -336
WIRE -1344 -256 -1552 -256
WIRE -1136 -256 -1136 -336
WIRE -1136 -256 -1344 -256
WIRE -1584 -192 -1584 -336
WIRE -1104 -192 -1104 -336
WIRE -1584 16 -1104 -192
WIRE -1104 16 -1584 -192
WIRE -2080 48 -2192 48
WIRE -1376 48 -2080 48
WIRE -1328 48 -1376 48
WIRE -608 48 -1328 48
WIRE -496 48 -608 48
WIRE -1920 128 -2032 128
WIRE -1856 128 -1920 128
WIRE -1792 128 -1856 128
WIRE -1728 128 -1792 128
WIRE -1376 128 -1376 48
WIRE -1376 128 -1664 128
WIRE -1328 128 -1376 128
WIRE -1056 128 -1328 128
WIRE -944 128 -992 128
WIRE -864 128 -944 128
WIRE -784 128 -864 128
WIRE -656 128 -784 128
WIRE -2320 144 -2320 -912
WIRE -2320 144 -2416 144
WIRE -368 144 -368 -912
WIRE -272 144 -368 144
WIRE -1328 160 -1328 128
WIRE -2416 176 -2416 144
WIRE -2320 176 -2320 144
WIRE -2192 176 -2192 48
WIRE -496 176 -496 48
WIRE -368 176 -368 144
WIRE -272 176 -272 144
WIRE -1792 192 -1792 128
WIRE -944 192 -944 128
WIRE -2032 272 -2032 128
WIRE -1328 272 -1328 240
WIRE -1328 272 -1424 272
WIRE -656 272 -656 128
WIRE -2416 288 -2416 240
WIRE -2320 288 -2320 256
WIRE -2320 288 -2416 288
WIRE -2080 288 -2080 48
WIRE -1328 288 -1328 272
WIRE -1264 288 -1328 288
WIRE -608 288 -608 48
WIRE -368 288 -368 256
WIRE -272 288 -272 240
WIRE -272 288 -368 288
WIRE -1328 320 -1328 288
WIRE -2192 336 -2192 256
WIRE -2080 336 -2192 336
WIRE -1792 336 -1792 272
WIRE -1728 336 -1792 336
WIRE -1584 336 -1584 16
WIRE -1584 336 -1728 336
WIRE -1104 336 -1104 16
WIRE -1024 336 -1104 336
WIRE -944 336 -944 272
WIRE -944 336 -1024 336
WIRE -496 336 -496 256
WIRE -496 336 -608 336
WIRE -2192 384 -2192 336
WIRE -1424 384 -1424 272
WIRE -496 384 -496 336
WIRE -1792 400 -1792 336
WIRE -944 400 -944 336
WIRE -1920 416 -1920 128
WIRE -784 416 -784 128
WIRE -2320 432 -2320 288
WIRE -2256 432 -2320 432
WIRE -1328 432 -1328 384
WIRE -1264 432 -1328 432
WIRE -368 432 -368 288
WIRE -368 432 -432 432
WIRE -1328 448 -1328 432
WIRE -2320 480 -2320 432
WIRE -368 480 -368 432
WIRE -2192 544 -2192 480
WIRE -1920 544 -1920 496
WIRE -1920 544 -2192 544
WIRE -1856 544 -1920 544
WIRE -1792 544 -1792 480
WIRE -1792 544 -1856 544
WIRE -1424 544 -1424 448
WIRE -1424 544 -1792 544
WIRE -1376 544 -1424 544
WIRE -1328 544 -1328 512
WIRE -1328 544 -1376 544
WIRE -1136 544 -1328 544
WIRE -1104 544 -1136 544
WIRE -1072 544 -1104 544
WIRE -944 544 -944 480
WIRE -944 544 -1072 544
WIRE -784 544 -784 496
WIRE -784 544 -944 544
WIRE -496 544 -496 480
WIRE -496 544 -784 544
WIRE -1136 576 -1136 544
WIRE -1104 576 -1104 544
WIRE -1072 576 -1072 544
WIRE -2320 592 -2320 544
WIRE -368 592 -368 544
WIRE -2192 624 -2192 544
WIRE -1376 624 -1376 544
WIRE -496 624 -496 544
WIRE -2032 784 -2032 352
WIRE -1376 784 -1376 704
WIRE -1376 784 -2032 784
WIRE -656 784 -656 352
WIRE -656 784 -1376 784
FLAG -1856 544 0V
FLAG -1616 -368 0V
FLAG -1072 -368 0V
FLAG -1728 -496 0
FLAG -1728 -800 VCC
FLAG -1264 432 VREF
FLAG -1728 336 BT1_OFF
FLAG -1024 336 BT2_OFF
FLAG -1856 128 VBT1
FLAG -864 128 VBT2
FLAG -1328 48 VBAT
FLAG -1664 -624 INIT_BT1
FLAG -1344 -336 VREF
FLAG -2192 624 0
FLAG -496 624 0
FLAG -1344 -720 VCC
FLAG -1520 -368 VCC
FLAG -1168 -368 VCC
FLAG -1264 288 VCC
FLAG -2320 592 0
FLAG -368 592 0
SYMBOL schottky -1728 144 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 0 32 VBottom 2
SYMATTR InstName D3
SYMATTR Value 1N5819
SYMATTR Description Diode
SYMATTR Type diode
SYMBOL res -1344 144 R0
SYMATTR InstName R7
SYMATTR Value 2k
SYMBOL zener -1312 384 R180
WINDOW 0 -45 35 Left 2
WINDOW 3 -100 -3 Left 2
SYMATTR InstName D7
SYMATTR Value EDZV6_2B
SYMBOL res -960 176 R0
SYMATTR InstName R8
SYMATTR Value 100k
SYMBOL res -960 384 R0
SYMATTR InstName R12
SYMATTR Value 43k
SYMBOL res -1808 176 R0
SYMATTR InstName R6
SYMATTR Value 100k
SYMBOL res -1808 384 R0
SYMATTR InstName R11
SYMATTR Value 43k
SYMBOL zener -1312 512 R180
WINDOW 0 -42 30 Left 2
WINDOW 3 -117 -9 Left 2
SYMATTR InstName D8
SYMATTR Value EDZV6_2B
SYMBOL Comparators\\LT1017 -1568 -368 M270
WINDOW 0 -87 -49 Left 2
WINDOW 3 -104 -83 Left 2
SYMATTR InstName U2A
SYMBOL Comparators\\LT1017 -1120 -368 R270
WINDOW 0 -91 43 Left 2
WINDOW 3 -108 75 Left 2
SYMATTR InstName U2B
SYMBOL Misc\\battery -1920 400 R0
WINDOW 3 24 104 Invisible 2
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
WINDOW 0 13 96 Left 2
SYMATTR Value PULSE(24 16 5 1 1m 3 10)
SYMATTR InstName BT1
SYMBOL res -1712 -784 M0
SYMATTR InstName R1
SYMATTR Value 100k
SYMBOL cap -1712 -592 M0
SYMATTR InstName C1
SYMATTR Value 100n
SYMBOL cap -1584 -512 R0
SYMATTR InstName C2
SYMATTR Value 100n
SYMBOL cap -1136 -512 R0
SYMATTR InstName C3
SYMATTR Value 100n
SYMBOL res -1408 -688 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R2
SYMATTR Value 100k
SYMBOL res -1264 -688 M90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R3
SYMATTR Value 100k
SYMBOL cap -1440 384 R0
WINDOW 0 -20 7 Left 2
WINDOW 3 -44 58 Left 2
SYMATTR InstName C5
SYMATTR Value 100µ
SYMBOL diode -1504 -560 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 0 32 VBottom 2
SYMATTR InstName D1
SYMATTR Value 1N4148
SYMBOL diode -1184 -560 M270
WINDOW 0 32 32 VTop 2
WINDOW 3 0 32 VBottom 2
SYMATTR InstName D2
SYMATTR Value 1N4148
SYMBOL sw -2032 368 M180
SYMATTR InstName K1
SYMBOL sw -656 368 R180
SYMATTR InstName K2
SYMBOL res -1392 608 R0
SYMATTR InstName R13
SYMATTR Value 2.4
SYMBOL npn -2256 384 R0
SYMATTR InstName Q1
SYMATTR Value 2N3904
SYMBOL res -2208 160 R0
SYMATTR InstName R5
SYMATTR Value 1500
SYMBOL npn -432 384 M0
SYMATTR InstName Q2
SYMATTR Value 2N3904
SYMBOL res -480 160 M0
SYMATTR InstName R9
SYMATTR Value 1500
SYMBOL res -2336 160 R0
SYMATTR InstName R4
SYMATTR Value 10k
SYMBOL Misc\\battery -784 400 R0
WINDOW 3 24 104 Invisible 2
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
WINDOW 0 12 97 Left 2
SYMATTR Value PULSE(24 16 10 1 1m 3 10)
SYMATTR InstName BT2
SYMBOL CD4023B -1648 -800 R270
WINDOW 0 29 121 VRight 2
WINDOW 3 59 95 VRight 2
SYMATTR InstName U1A
SYMATTR SpiceLine VDD=12  SPEED=1.0  TRIPDT=5e-9
SYMBOL CD4023B -1040 -800 M270
WINDOW 0 29 121 VRight 2
WINDOW 3 59 95 VRight 2
SYMATTR InstName U1B
SYMATTR SpiceLine VDD=12  SPEED=1.0  TRIPDT=5e-9
SYMBOL CD4023B -1024 624 R90
WINDOW 0 5 153 VRight 2
WINDOW 3 30 125 VRight 2
SYMATTR InstName U1C
SYMATTR SpiceLine VDD=12  SPEED=1.0  TRIPDT=5e-9
SYMBOL schottky -992 144 M270
WINDOW 0 32 32 VTop 2
WINDOW 3 0 32 VBottom 2
SYMATTR InstName D4
SYMATTR Value 1N5819
SYMATTR Description Diode
SYMATTR Type diode
SYMBOL cap -2336 480 R0
SYMATTR InstName C4
SYMATTR Value 10n
SYMBOL diode -2400 240 R180
WINDOW 0 24 64 Left 2
WINDOW 3 24 0 Left 2
SYMATTR InstName D5
SYMATTR Value 1N4148
SYMBOL res -352 160 M0
SYMATTR InstName R10
SYMATTR Value 10k
SYMBOL cap -352 480 M0
SYMATTR InstName C6
SYMATTR Value 10n
SYMBOL diode -288 240 M180
WINDOW 0 24 64 Left 2
WINDOW 3 24 0 Left 2
SYMATTR InstName D6
SYMATTR Value 1N4148
TEXT -2024 576 Left 2 !.tran 30 startup uic
TEXT -2024 600 Left 2 !.inc CD4000.lib
TEXT -2024 624 Left 2 !.MODEL  SW SW (Ron 0.01 Roff 1g Vt 6V  Vh 0)
TEXT -1224 680 Left 2 ;SPARE
TEXT -1912 416 Left 2 ;24V
TEXT -776 416 Left 2 ;12V

• Again, thanks for the insight. I have modified a circuit that was shared by another user. Things looked fine until i realised that when one battery is cut off or voltage drops than other, the reverse current from higher voltage battery flows to the lower voltage battery which is kind of troublesome (As if what you have mentioned in the answer above). The update you have provided is beyond my knowledge & needs lot of components. Is there any fix or alternative solution for this issue within existing circuit that i have shared below: Link – prasanth_ntu Aug 16 '16 at 8:19
• @prasanth_ntu: Not that I know of. – EM Fields Aug 16 '16 at 9:47