I'm trying to design a circuit that automatically switches power to battery when mains supply (wall wart) is cut. I'd rather not use relays. I have in my head an idea of using a npn controlling a pnp but I can't make it work in practice. Someone must have done this before?
Look at the Duemilanove schematic. They do that on there with the USB / DC input connector.
Thanks Mike - looks a little more complicated than I hoped. Would there be any harm in connecting a 12v lead acid to my circuit permanently via a diode? I'm using a regulated 12v psu and the battery is on permanent trickle charge (obviously not if the power is cut and battery backup is required)
Sounds like a plan.
Can't see anything wrong with that.
If the power is cut then is there a diode in line with the PSU to prevent the battery discharging through that?
Ooh good point.
Hmm my circuit simulator reckons that they’ll share the load during normal operation. Which will interfere with charging normal charging…
I think I can fudge it by putting 2 diodes on battery side to bring the voltage lower than the PSU.
Sorry to disturb your conversation but I'm following it with great interrest. Could you supply some type of schematic for me to understand it better?
Sorry to disturb your conversation
Didn’t want to be rude in any way.
I’m still not sure what to do with this. If I connect a battery in parallel with a psu - under normal conditions, will the battery share the load with the psu? I guess that as the battery has a slightly higher voltage than my supply it will. I can make it work in simulation by putting a extra diode in the circuit to reduce the battery voltage to less than the psu output. This seems to stop the current flow. Is this correct?
Have you had any luck with this? I am looking to do the exact same thing. I plan on running a project from mains, but I would like a battery to step in an power everything if there is an outage.
It would be extra great if the mains power kept the battery charged as well.
I designed a circuit to do this (though with NiMH batteries), had the PCB made, bought the parts, but never assembled or tested it. Here is that thread:
This sounds like something that can be done with a P-channel MOSFET. Think of it as a transistor* that turns ON when its gate (base) is grounded and OFF when brought near its drain voltage. Tie the gate to the wall-wart input and a pull-down resistor to ground, it should cut off the battery supply whenever the wall wart voltage rises to near the battery voltage or above.
*Unlike a transistor though, the gate of a MOSFET is essentially an insulated capacitor plate and won't transfer any charge to its source/drain (unless something goes seriously wrong!). Also, it won't incur the 0.7V or so diode voltage drop that a transistor does.