My aim is to be able to power my Arduino while there is a power supply and if there isn't the Arduino automatically switches over to the battery. The components connected to the Arduino are pir sensor, smoke sensor, SIM 800L, temperature sensor, 6v relay.

2 Answers 2


Yes, to my knowledge this is done automatically, and there is no harm when connecting the Arduino to two power sources. When I power my Arduino I have it connected to my computer and the wall. So theoretically, if the electricity in the wall stopped coming, it would start taking power from the computer. Same works for battery.


Most mainstream and reputable Arduino variants (the UNO or Pro, for example) have protection circuitry that allows it to basically ignore where its power is coming from, as long as the voltage isn't above 20v. This is because almost every Arduino device funnels its power through an appropriate regulator, ensuring there is no problem with the voltages or available current suddenly changing (switching power feeds). However, you should account for what happens when you plug an external power source in the same loop as a battery that might be a different voltage. If you're going to try to have them manually switch then you'll need an external circuit (perhaps using a transistor that shuts off the battery when the power supply is active, with capacitors for a buffer), else you could have problems with popping batteries. But be warned, if you plug your battery into the PWR (5V/3V3) pin(s) of the Arduino, then you'll need to provide your own protection.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.