Switching Power Supplies for Arduino


My year 12 major project is powered by 12V from one source and a 9V battery pack from another source.

I would like to effectively disconnect the 9V battery pack when the 12V power supply is connected without destroying the arduino. I was thinking of using a relay somehow or having the arduino ‘listen’ to when the 12 V power supply is connected but I’m not sure how to do it.

I have googled it and I understand that it can be done but I am unable to make sense of exactly how i.e what parts I need and how it needs to be wired up.

I would really appreciate somebody taking the time to explain this to me.

Thank you!


Hi Bella,

Perhaps the easiest way to go about this is a diode on each +V power, they’ll effectively allow either/both of the supplies to power the Arduino. Use a diode that can handle the power consumption of the circuit.

There are lots of ways to go about this, some that would use less energy, I am just aiming for the easiest solution :slight_smile:

Here’s a quick simulation with Proteus (will be less blurry if you click on it to view full size):


Thank you so much!

Let me know if it worked for you :slight_smile:

Hi Graham,

It did work, sort of. I don’t know if we wired it up correctly but we think this is working correctly.

We have included two voltage regulators. The left one is giving us 5V only when the 12V power source is plugged in. The voltage is then travelling over to the right hand one which at the input pin is giving us 12V when the 12V is plugged in and 9V when the 12V is unplugged.

We are not using the 5V output of the right hand voltage regulator as the arduino requires 7-12V to operate correctly. I don’t even know if the right hand voltage regulator is even required?

I don’t know if this has stopped the current being drawn from the 9V battery pack when the 12V is plugged in?

Thanks for all your help. We really appreciate it!

Kind regards,
Mark Gregory (Bella’s teacher)