Go Down

Topic: Switch power sources without restarting Arduino (Read 73 times) previous topic - next topic


I'm new to Arduinos, and I'm trying to build a circuit that switches between wall power and battery power for my Uno. Both are connected to the 5V pin, which is a bit scary. I've got a relay (JCZ-11F) that can switch fast apparently, and I was wondering if it could switch fast enough to avoid losing power to the Arduino? It seems dangerous, so I'm considering forcing it to restart anyway by delaying it with a 555 timer.

The thing is, the battery outputs 3.7V and the wall power is 5V. Would the voltage difference cause a problem? Maybe I could solve that with a capacitor to make it change more slowly, but I don't know how well that would work.



Not sure how you are going to get the 5V arduino to run from a 3.7V battery. If you have them both connected, you are surely charging the battery. Being 3.7V it is a sure bet it is a LiPo or LiIon battery. Connected to 5V you are risking fire and explosion by not having a proper charging circuit.

If you are looking to switch between 5V source and some battery power there are many circuit you could build. One would be a simple capacitor on the Arudino side of the relay. Just larger enough to keep power applied as the relay switches. Other circuits require more parts.

But since you are using a LiPo/LiIon battery and 5V. Then I would suggest AdaFruit PowerBoost 1000C (can be had for ~$20). You can put 5V in, you get 5V out, Additionally it is a LiPo/LiIon battery charger. In the event that power is lost, the LiPo/LiIon battery will keep bumplessly and maintain power. In other words, The PowerBoost 1000C will act as a very small UPS, just as you have described.

Geek Emeritus

feed one source to V In pin, fed by a diode
feed one source to the barrel pin, fed by a diode

that is an OR gate. if either source has power, you are alive. if either source fails, the handover is instantaneous. a capacitor is a wise precaution. 220 - 1000 uf would be my choice.
All PMs will be deleted unopened due to arrogant argumentative pot stirring Malfoys.
 If you have not read "How to use this forum - please read", in particular: "7. If you are posting code or error messages, use "code" tags":  expect rude responses

Go Up