# How to Use Diode Oring to Switch between Two Power Sources? [duplicate]

I want to switch Power Between a AC/DC adapter which is supplying power to the circuit when AC power is On and when power loss power the circuit using 12V 7Ah Battery. AC/DC adapter is rated 12V 1Ah.

First I thought switch power with a Relay and Arduino with a sensor to monitor AC power loss. but I Came to know there is a better way using a Diode Oring.

Please explain how to use diodes to switch between power Supplies and what diodes to use for this?

I saw that in a article, to Diode ORing to work main supply should greater than backup. so in my case both the main supply and backup supply is 12V.

so Diode ORing option will not work as expected?

## marked as duplicate by Ignacio Vazquez-Abrams, PeterJ, Asmyldof, Daniel Grillo, nidhinOct 14 '15 at 4:59

• – Fizz Oct 10 '15 at 20:33

You can do this, and EM Fields answer is correct as far as it goes.

But be aware that whichever source has the higher voltage will supply most of the current. This means that the battery cannot be charged to a higher voltage than the adapter. This will prevent giving it a full charge. This site indicates that the minimum voltage for charging should be more than 12 volts, although something near 12 will probably work to give a partial charge at a very slow rate. Even if you use an externally charged battery, a lead-acid maintained at 12 volts will not have anywhere near full charge. Here, for instance is a chart which suggests that if your battery is only allowed 12 volts it will only have about 50% charge.

That's not to say you can't do it and get something that sort of works (and may even be adequate to your needs), it's just that you'll need to do some experimenting and may be disappointed with the results.

Diode steering is much better used when the primary voltage is somewhat higher than the backup voltage. If possible, something like a 15 volt supply and a 12 volt battery would be a better match.

EDIT - The idea of using an Arduino to detect a power dropout and switch in a battery is certainly possible, but you can do it automatically.

simulate this circuit – Schematic created using CircuitLab

Here, if the supply is active the relay is pulled in and the output is about 11 volts. If the supply is interrupted the relay opens and selects the battery.

This has a number of features. Most importantly, the relay is not a 12 volt relay. The problem with a 12 volt relay is that it will not release until the voltage across the coil gets quite low - sometimes as low as 15% of the nominal voltage. With a 5 volt relay and 7 volt zener, the relay will drop out at a much higher voltage, decreasing the period of low voltage associated with the switchover.

The capacitor is quite large and depends on both the load current and the relay speed. The higher the current and the slower the relay, the larger the capacitor should be.

The diode allows for the possibility of a fast turnoff of the supply by preventing the cap from discharging back to the supply before the relay releases.

The biggest problem with this setup is the current surge associated with changing states. This can damage the relay contacts, so use a relay with considerably larger current rating than your load current.

• Thanks for detailed reply. so with diodes and a fully charged battery there is no way to give priority to AC/DC supply over Battery unless AC/DC supply voltage is higher than battery. first i thought switching supply with a relay using arduino to detect power failure and control relay when power fails and resume and i came to know there is a easy way with diodes. but it looks like diodes will not work for the need though – lasita Oct 10 '15 at 17:51
• @lasita - See edit. – WhatRoughBeast Oct 10 '15 at 21:48
• You could accomplish a similar effect with a single diode and a p channel fet with its gate connected to the outside of the diode. The fet will disconnect the battery when the gate is pulled up by the power supply. Probably more power efficient and cheaper – Loganf Oct 10 '15 at 22:08
• @loganf - Agreed, but I'm not certain of the poster's abilities, and this ought to be easily comprehensible. – WhatRoughBeast Oct 10 '15 at 22:11
• Thanks a lot for detailed information and answer. i will try relay method you suggest – lasita Oct 11 '15 at 13:51

It'll work fine if your load can take the reduction in supply voltage due to the diodes' forward voltage drop.

Following is a schematic, and an LTspice circuit list you can use to run a simulation to see how it works.

Basically, if V2 is enough more positive than V1 and the diodes are identical, then D1 will be reverse-biased and V2 will supply all of the current into the load, R1.

Then, when V2 disharges and V2 becomes enough less positive than V1, D2 will become reverse-biased and D1 will supply all the current into R1.

No matter what voltage V2 is, however, if the mains fail and V1 goes to zero volts, V2 will reverse bias D1 and will supply all of the current into R1.

There's a small penalty to be paid, and that's the voltage drop across the diodes, which amounts to about 0.55 volt with 5 amperes through either diode at an ambient temp of 25C. For more info on the diode, the data sheet is here

Version 4
SHEET 1 880 680
WIRE 224 48 32 48
WIRE 352 48 288 48
WIRE 224 160 144 160
WIRE 352 160 352 48
WIRE 352 160 288 160
WIRE 32 208 32 48
WIRE 144 208 144 160
WIRE 352 208 352 160
WIRE 32 336 32 288
WIRE 144 336 144 288
WIRE 144 336 32 336
WIRE 352 336 352 288
WIRE 352 336 144 336
WIRE 32 400 32 336
FLAG 32 400 0
SYMBOL schottky 224 64 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 0 32 VBottom 2
SYMATTR InstName D1
SYMATTR Value B520C
SYMATTR Description Diode
SYMATTR Type diode
SYMBOL voltage 32 192 R0
WINDOW 0 19 104 Left 2
WINDOW 3 17 8 Invisible 2
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
SYMATTR InstName V1
SYMATTR Value PULSE(12 0 15 1u 1u)
SYMBOL res 336 192 R0
SYMATTR InstName R1
SYMATTR Value 6
SYMBOL schottky 224 176 R270
WINDOW 0 32 32 VTop 2
WINDOW 3 0 32 VBottom 2
SYMATTR InstName D2
SYMATTR Value B520C
SYMATTR Description Diode
SYMATTR Type diode
SYMBOL Misc\\battery 144 192 R0
WINDOW 0 10 101 Left 2
WINDOW 3 10 129 Invisible 2
WINDOW 123 0 0 Left 2
WINDOW 39 0 0 Left 2
SYMATTR InstName V2
SYMATTR Value PULSE(13 11 0 20)
TEXT 46 368 Left 2 !.tran 20 startup uic