Author Options:

How to build a circuit that switches between battery or AC, like a boom box (for lack of another example)? Answered

I am designing something which will be lit by led's, and I want the device to be able to have the option of operating by way of either batteries(for the led's), or by plugging it in to 120V AC(the led's are the only things that will be powered). I know how do what I need to change the AC to DC(correct drivers etc.), however, I don't know how to design what I need to simply make it switch over to batteries if you unplug it from AC(automatically, as a boom box does if you remove the AC cord), or vice versa, switch to being able to plugging it in if batteries are dying/ are dead. Thanks. 



2 years ago

Here is how I would do it.

Get a mains to12 or14 volt wallwart that has more current then your leds need.

When plugged to AC the battery charges and the LED's are on.. If they flicker try a 470uF 25 volt electrolytic capacitor or 1000 uf.

When unplugged the LEDs run from the battery.

Be sure to click the pic to see the entire image....


Combine the battery plus pole and the plus side of your AC to DC power supply with diodes. The minus / Gnd can be connected directly. then make sure that the power supply voltage is a bit higher than the battery voltage. As long as there is power from AC it will flow into the LEDs, when it is not present, the battery takes over.

There exist coaxial power jacks with a switch inside, and this is the usual trick for something like a boom box. The boom box has battery holders and one of these jack+switch things. When no plug is inserted in the jack, the little switch inside is closed, connecting a circuit to the batteries. When a plug is inserted, the little switch inside the jack opens, and the batteries are disconnected.

Note that the power being carried by the coaxial plug is also DC, like the batteries. So this sort of implies there is some sort of brick shaped AC-to-DC adapter on the other side of that coaxial plug carrying the DC.

I'm not sure how they do it for a boom box that has on board AC-to-DC supply, and battery holders too. But how hard could it be? A single diode would work, if you made the AC-to-DC supply about 1 volt higher than the highest voltage expected from the stack of batteries.

Although for something you build yourself, the best approach might be something simple and reliable, like an actual switch.

Or build your battery box so its output is a coaxial plug. Then the act of switching from one power supply to another is done by unplugging that plug, and plugging in a different one.

Obviously you neither checked any of you battery and wall wart powered toys or did not find Google.
You can get switching power sockets in all sizes and shapes, even for headphones.
Nothing plugged in, contact closed - battery power.
Plugged in, contact open - direct power.
One day I will ask to have my username changed to Google ;)