really noob question..

I am thinking of using a 12v power source and a 5v power source as an external power supply for my 5v relay (and some other stuff that I might add up to my project that will need 5V) and the 12v is for my 12V solenoids. Is it right to connect all ground wires to the ground of the Arduino? I am really sorry that I have to ask this question cause all tutorials I see online are only connecting one external power supply to their Arduino.

Any form of correction is highly appreciated. Thank you so much

  • First make sure the voltages are stable enough even under any and all expected changes in current load - solenoids take quite a bit of juice and have interesting magnetic field effects. No sense subjecting your arduino to potential overvoltage in AC from an accidentally bucking inductor.
    – Abel
    Commented Nov 10, 2020 at 2:17
  • 1
    Yes, in general all grounds need to be connected
    – Sim Son
    Commented Nov 10, 2020 at 9:57

1 Answer 1


Besides connecting all the grounds, a "good idea" whenever working with solenoids or magnetic (as opposed to solid state) relays is to add protection against inductive kickback, which can create really high voltages (hundreds of volts) when the current through an inductor changes suddenly. (The voltage is the product of the inductance and the rate-of-change of the current.) The protection is simple: Put a rectifier diode across each coil, with the arrow pointing to positive (reverse-biased). The rectifier has to handle a big spike of current as well as the high voltage, so use something like 1N4004. This protection will reduce the likelihood of spikes causing mysterious state changes in your circuits.

  • Hi, correct me, but a snubber diode is like a safety precaution to avoid frying your relays right? so it should work for DC Motors too cause its an inductive load right? thanks Commented Apr 23, 2021 at 12:11
  • 1
    Correct. Google for "snubber diode on DC motor"
    – Boggyman
    Commented Apr 24, 2021 at 12:15
  • thanks a lot! I wish you a happy day :) Commented Apr 25, 2021 at 4:01

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.