Circuit power source switching

Hi All. Not sure my question subject accurately describes what I am actually asking, but....what I want to do is this:

I have a circuit that runs off a fixed 5v source. By fixed I mean its a hard wired 5V adapter. What I want to do is have the circuit detect that this 5V source is gone, and it now needs to start running off a battery backup...which is also 5V. This is so when I turn off off the 5V hardwired source, the circuit will now run off the battery input.

Is this hard to do? What would I need to do?

Thanks, Jeremy

The simplest would require two diodes.

Ok cool. How would I set them up in a circuit to use them? I have a thought in mind....but would like to know what somoeone else says before I look like an idiot :D


Does it have to involve an Arduino?

Put in a big capacitor, enough to power the Arduino for a few seconds. Now get the Arduino to monitor the voltage via an input pin and switch over to battery if it notices a change.

Ok, so say I do use a big capacitor, how do I tell the Arduino....or in this case a standalone use a different power source. Thats the bit I cant figure out.


Ok, so say I do use a big capacitor, how do I tell the Arduino…or in this case a standalone circuit…to use a different power source. Thats the bit I cant figure out.

That was a bit of a joke…

Connect the battery up via a P-channel “logic level” MOSFET with the 5V supply connected to the gate. The transistor will switch on when the 5V supply drops to zero (helped by your pull-down resistor)

You’ll still need a big capacitor though - to keep the Arduino safe during the switchover…

Ok Cheers. I can prob. figure it out from that info...well hope so :-)

Thanks, Jeremy

HI. Well I found a solution in the end that works on the breadboard at least :smiley: It was suggested a couple of posts back, but I wasnt sure what to do…well I knew WHAT to do, just not how to do it…if you get what I mean :~

I have tested it and its working ok. I can deal with the loss over the diode because then I know I can turn my screen off and just keep the GPS going…an alomost perfect solution :slight_smile:


Just a final follow up, I have now integrated it into my circuit and it works a charm....

Thanks, Jeremy

it works a charm....

That's why good engineering is about simple and elegant solutions.