# switch between wall and battery power

Discussion in 'Power Electronics' started by icydash, May 22, 2013.

1. ### icydash

12
0
May 22, 2013
I'm trying to make a circuit that runs off wall power when it's plugged in (a 9v DC power adapter), otherwise it runs off the attached 9v battery. I'm not sure how to make the circuit detect if it's plugged into the wall or not, though. Is there some IC that is commonly used for this or something?

2. ### (*steve*)¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥdModerator

25,501
2,841
Jan 21, 2010

Whichever one has the highest voltage will power the circuit.

Another approach is to have a relay energised by the external power to change over the power connections from the internal battery to external power.

The latter approach will cause larger glitches when power is plugged in and removed than the diode solution.

3. ### icydash

12
0
May 22, 2013
Thanks for your reply. The diodes seems like a good solution. So when the wall power is plugged in, if it has a higher voltage than the battery, the wall will power the circuit. If the battery has a higher voltage (even when the wall power source is plugged in) the battery powers the circuit. If no wall power is connected, the battery powers the circuit. Is that correct?

What if the battery and wall power have the same voltage (i.e the wall adapter is plugged in and the battery starts off with a higher voltage than the wall power, but drains over time until they both have the same voltage in some instant)?

My concern is that people using this circuit will often install fresh 9v batteries, which may have equal (or greater) voltage than the 9v DC wall power supply.

Last edited: May 22, 2013
4. ### CDRIVEHauling 10' pipe on a Trek Shift3

4,960
652
May 8, 2012
Are two Diodes really necessary? Unless it's a regulated 9V wallwart, I doubt that it is, the battery can't back feed into it when the mains are lost. In fact it will just add some filter caps across the rails. I think it's only important to prevent the wallwart from feeding the battery. So one Diode in line with the battery should suffice. This gives the wallwart an extra (.7V) chance of being the dominant voltage.

CYA: All of the above may be ignored if I missed something!

Chris

5. ### icydash

12
0
May 22, 2013
What is the difference between a regulated 9V wall wart and an unregulated 9V wall wart? I'm not really sure what "regulated" means.

So you don't think the battery will some how feed back into the wall wart if the wall wart has a lower voltage than the battery supply?

6. ### CDRIVEHauling 10' pipe on a Trek Shift3

4,960
652
May 8, 2012
If it's unregulated then battery current would have to find a path through the rectifier bridge. Normally this shouldn't happen. When a pack is regulated it usually states it. Current can back feed into the output side of a regulator and should be avoided. I'm not sure if I've seen a regulated 9V pack. I'm sure they make em but they're not common.

Chris

7. ### icydash

12
0
May 22, 2013
Ok so it sounds like I probably only need one diode. And then if the 9v battery and the 9v from the wall wart are too close in voltage, it sounds like the circuit will run off the battery until it drains enough such that there is a .7v difference between the wall wart voltage and the battery voltage, at which time it'll switch to using the wall wart. is that right?

8. ### CDRIVEHauling 10' pipe on a Trek Shift3

4,960
652
May 8, 2012
I'm going to post a plot for you so you can see how the battery current never back feeds to the wallwart.
Also, you can reduce the Diode voltage drop considerably by using a more expensive Schottky Diode.

Chris

9. ### icydash

12
0
May 22, 2013
Oh sweet. That's great to know. It looks like the Schottky diodes only have a forward drop of around .3v, which is a big difference.

10. ### CDRIVEHauling 10' pipe on a Trek Shift3

4,960
652
May 8, 2012
Just a few notes about this schematic and plot. It assumes there is no bleeder resistor or voltage regulator integral to the wart. You can test for a back current path using an Ohmmeter with the (+ & -) probes connected to the wart's respective (+ & -) pins. This must be done with the wart unplugged from the mains and the cap discharged. A wart with no back current path will measure infinity after the cap charges from the Ohmmeter. Also, a modern DMM (Ohms Function) will not forward bias a diode junction so you will also want to also place the DMM in Diode Test mode to test again. This mode produces a voltage and current at the probes usually high enough to light a LED.

If you have any doubt and since you're going to use Schottky's you may want to use 2 diodes (the second in series with the wart) as Steve suggested. Your call.

Chris

File size:
47.6 KB
Views:
455
11. ### CDRIVEHauling 10' pipe on a Trek Shift3

4,960
652
May 8, 2012
I had an error in that last schematic. After checking the specs for a typical fresh 9V alkaline battery it should have been 9.48V as opposed to 9,6V. Not a huge difference but .... Anyway, I also greatly expanded the 'X' scale (Wallwart (V)) too.

Chris

File size:
54.4 KB
Views:
3,531