Backup PS?

I'm implementing a backup 9v power supply to the arduino for when power is lost at my house and the wall wart PS becomes n/a. I'll bring the 9v to the Vin pin and GRD. My question is, is there a set variable that i can access that tells the board where the power source is coming from, or is there a hierarchy for what input power the board uses? USB 1st, then Wall wart 2nd, then Vin last?

I don't want the battery to be used unless a power outage occurs.

This could just be a "plug-n-play" and it might work i havent tried it yet, but just out or curiosity if all three had power which input get priority?

USB 1st, then Wall wart 2nd, then Vin last?

Well it's a little more complex then that. If there is only USB power or only external power then the Arduino uses it's internal power switch to utilize the avalible source. If both USB and external power is avalible then the Arduino power switch uses the external power (if it is above around 7.5vdc) first. Also external DC voltage input and Vin are the same voltage (only a polarity protection diode between these two points) so there are only two power paths to the Arduino power switching circuit.

To utilize a standby battery solution without any internal Arduino board modification you would have to have a wall wart DC module plugged into a home AC outlet and the Arduino external power plug, and then utilize a modified USB cable (isolate just the two 5vdc power wires) and wire this USB cable to a battery supply and plug the other unmodified end of the USB cable to the Arduino's USB connector. The battery supply must not exceed +5vdc and you would have to work out how to keep the battery charged without exceeding the Arduino getting more then +5vdc via the USB power cables.

A better solution might be an external power module that takes a say 15vdc wall wart voltage input, uses an internal 12vdc rechargable battery that then feeds a switching 9vdc regulator that then plugs into the Arduion's external power input. That would effectively be a small DC UPS system.

So does that make sense?


Not really a software/syntax&programs sort-of question though, is it?


So just have one input to the ardunio and then have the simple power switching circuit on an external board. EZ enough, thanks for the quick reply and knowledge.

-Not really a software/syntax&programs sort-of question though, is it?

no, it turned out not to be. if it were a variable that could be controlled in the software then it could of been.

sorry for wrong topic forum fail-post-sauce :slight_smile:

Not all the Arduino clones have the power switch circuitry. For instance the Arduino Pro series from Sparkfun.

I power my bedside weather station / atomic clock from this:

which is running off one of the dozen or so 5V mini-USB wall-warts I have collected from cell phone, etc. purchases and charging one of these 100 mAh lipo batteries:

When the AC power fails or I need to unplug it and move it somewhere else, the lipo automatically takes over because it is actually running the system anyway but is getting periodically recharged by the wall-wart and charger board.

My Arduino Pro monitors the Vin voltage through a simple voltage divider and puts the Arduino to sleep when the battery voltage drops below 3V.

Which brings the thread back around to a software issue. :smiley:

I could be wrong, and I will find out when I get home, but IIRC you can power the arduino via this backpack and might be able to change it via it's USB port from an AC adapter. As I said, I could be wrong and looking at the little switch on the board, I can't remember if that disables the 5v line or just enables the charging circuit....

-Chris G.

Yeah, that's the far cooler looking but twice the cost commercial version of what I described above. Just substitute the mAh capacity lipo that you require.

On my board, ZB1, I diode-or the wall adapter and the USB 5V onto a voltage
bus (VBUS). You could easily diode-or an external battery onto the board.
Maybe you could diode-or the battery.

The schematic for my board is in the datasheet at

(* jcl *)

I quote Lefty:

"Well the concept of an automatic battery backup is pretty straight forward, the details and added features (like auto recharging or auto power down on low battery) one might want can take some extra thought.

The easiest way to implement automatic battery back-up while normal power is being supplied to the Arduino external power jack is to wire a battery with greater then around 8vdc to the Vin pin and ground pin, with a series isolation diode (1N4001 is fine) between the battery positive lead and the Vin pin, with the cathode wired to the Vin pin. With a two resistor voltage divider you can also monitor the battery terminal voltage via a analog input pin.

Lefty "