I want to know the recommended wiring for relay. I am setting it up as NO.

  1. Where should I connect the relay, the hot wire or the ground wire?
  2. Where should I connect the wire going to bulb, NO or C pins of relay? Where should I connect the wire going to AC, NO or C?
  • For that setup it doesn't matter in the slightest. – Majenko Sep 11 '20 at 11:52
  • 1
    ALWAYS switch the hot wire with the relay (or any switch), never the neutral wire. This prevents a hazardous voltage being present at the bulb, when the switch/relay is turned off. Important safety measure for electricians. – chrisl Sep 11 '20 at 14:47
  • @chrisl good point. I added that bit to my answer. It's an important safety measure for non-electricians as well. (Electricians should know better) – Duncan C Sep 11 '20 at 19:14
  • @chrisl While that may be good in principle, in practice it's generally irrelevant. At least in countries with non-polarized sockets, like the USA and most of Europe and Asia. That is, pretty much anywhere except the UK and India... There's no "Hot" (I HATE that word!) or neutral wire in an appliance. – Majenko Sep 12 '20 at 21:27

A relay is a simple switch controlled by an electromagnet coil. The "NO" (normally open) side is off until you apply power to the coil. The "NC" (Normally closed) side is on until you supply power to the coil, at which point it turns off. Switches don't have polarity. If you connect the common into one part of a circuit and the "NO" side into the other, it doesn't matter which goes where.


As another poster pointed out, you should wire the relay so it switches the hot leg from the plug, not the neutral (Assuming you're in the US or another country with polarized plugs.) That is much safer, since it means when the relay is off, the lamp is only connected to the neutral line. If, instead, you wire the relay to switch the neutral leg then the lamp will ALWAYS be connected to hot, and if somebody touches the wires they could get a shock.


What does matter is how you power the relay. If you try to drive a simple relay directly from a logic pin, it will likely damage or destroy the Arduino.

If you're using a "digital" relay that takes a constant 5V source, and a logic level control, such relays have built in transistors and protection diodes that prevent the relay coil from destroying solid state electronics.

If you're using a simple relay, you'll need an appropriate transistor to boost the current to the coil, as well as a "flyback diode" to protect the transistor from back-EMF when the coil is disconnected.


Connect the bulb to the NO pin of the relay.

Image source from: https://ncd.io/relay-logic/

enter image description here

  • One point: In the US, polarized AC plugs are almost universal. The smaller blade is connected to the black, hot wire, and the wider blade is connected to the white, neutral wire. It's the convention to connect the outer threaded part of an Edison lightbulb socket to the neutral and the inner "tab" on the socket to the hot. – Duncan C Sep 11 '20 at 12:35
  • That's because users are more likely to accidentally touch the outer part of the socket while screwing in bulbs, and if your house is wired correctly you shouldn't get a shock from the neutral wire (where you will get a shock from the hot wire if you touch it, or touch metal that's in contact with it.) – Duncan C Sep 11 '20 at 13:28
  • @DuncanC - Regarding this part of your comment: "..you will get a shock from the hot wire if you touch it...". That is not always true. The only time you could get a shock is if another part of your body is touching the neutral or ground potential at the same time. I just did a simple experiment before posting this. While standing on a dry, hardwood floor with shoes on, I took a pair of stainless steel nail clippers and inserted the "nail file part of it" into the hot 120VAC side of the receptacle. Nothing happened. I didn't feel anything. Nothing happened in the neutral side either. – VE7JRO Sep 11 '20 at 21:39
  • Fair enough. I should have said "You CAN get a shock..." You have to be at least partially grounded. If you're isolated from ground you won't pass any current. Note that if you're standing on a damp concrete floor, or have your other hand on a grounded metal object, you could be killed. – Duncan C Sep 12 '20 at 0:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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