Arduino with wall switch wiring to control a bulb

Hello,
I want to control a bulb by using a combination normal wall switch and an arduino+relay+GSM(SMS control for on/off state). The system should work in such a way that if the bulb is on, I should be able to switch it off with arduino. So basically the arduino is going to be like an override for the wall switch. I need help with the wiring and necessary steps to get this done. My understanding when dealing with electrical elements is pretty shallow. So any help will be appreciated. Thanks

I don't know what gsm is.

For operating a relay, assuming you have a proper optoisolated 5v relay that controls 110v, interrupt the power or ground wire to the light, putting 1 wire into the center receptacle of the relay and the other wire to the "NC" normally closed receptacle. This will allow the light to perform normally.

Connect one of the data pins from the Arduino to the +5v connector to the relay board and ground to ground.

When the Arduino is off, there will be no effect on the light.

Write a sketch that will take your datapin high when you want to shut off the light and low when you want to allow the light to be controlled by the wall switch.

John

I don’t think you got what I was asking. I know how to work with the arduino. It’s the 2 way wiring between the light switch and the relay am asking about.

Sounds like you want to do what is commonly called "3-way switching", but substituting a relay for one of the wall switches.
(See Multiway switching - Wikipedia)

You will need a SPDT relay and replace the wall switch with a "3-way" (SPDT) switch. You also need to check on local and/or national electrical code standards. IANAL, but I suspect you may be legally responsible for any damage resulting from non-code-compliant wiring.

pantaz:
Sounds like you want to do what is commonly called “3-way switching”, but substituting a relay for one of the wall switches.
(See http://en.wikipedia.org/wiki/Multiway_switching#Two_locations)

You will need a SPDT relay and replace the wall switch with a “3-way” (SPDT) switch. You also need to check on local and/or national electrical code standards. IANAL, but I suspect you may be legally responsible for any damage resulting from non-code-compliant wiring.

I am familiar with the 3 way switching concept. What I need to know is the exact wiring between the relay and the SPDT switch.

Just replace one switch with SPDT relay.

I think we have warned you of this before, but the biggest biggest biggest concern with doing this is safety. Make sure you find out and follow appropriate electrical codes since otherwise you could easily 1) Burn down your house or 2) Electrocute someone. It isn’t hard, but make sure you don’t take any shortcuts and mains voltage is dangerous.

mirith:
I think we have warned you of this before, but the biggest biggest biggest concern with doing this is safety. Make sure you find out and follow appropriate electrical codes since otherwise you could easily 1) Burn down your house or 2) Electrocute someone. It isn't hard, but make sure you don't take any shortcuts and mains voltage is dangerous.

Don't worry am a cautious person. I always collect enough info before I get on with the actual implementation

OldSalt1945:
Connect one of the data pins from the Arduino to the +5v connector to the relay board and ground to ground.

Do that and you may fry one of the data pins. Relays consume way more than the 20mA the data pin can source. You have to use a transistor or an optocoupler to switch the relay with an Arduino.

mart256:

OldSalt1945:
Connect one of the data pins from the Arduino to the +5v connector to the relay board and ground to ground.

Do that and you may fry one of the data pins. Relays consume way more than the 20mA the data pin can source. You have to use a transistor or an optocoupler to switch the relay with an Arduino.

Exactly!
Anything similar to the "Sparkfun Beefcake Relay Control Kit" will be a safe choice.

pantaz:
Sounds like you want to do what is commonly called "3-way switching", but substituting a relay for one of the wall switches.

That's not my interpretation of the original post. It seems to me that Mohdizzy is asking how to connect two switches in series such that they both need to be 'on' in order for the lamp to get power. Then the Arduino can turn the lamp off regardless of the state of the manual switch. How to do that will depend how many switches are currently controlling the lamp, but if there's only one existing switch then it just needs the live supply to the lamp to be connected via the NC terminals of the Arduino-controlled relay.

PeterH:

pantaz:
Sounds like you want to do what is commonly called "3-way switching", but substituting a relay for one of the wall switches.

That's not my interpretation of the original post. It seems to me that Mohdizzy is asking how to connect two switches in series such that they both need to be 'on' in order for the lamp to get power. Then the Arduino can turn the lamp off regardless of the state of the manual switch. How to do that will depend how many switches are currently controlling the lamp, but if there's only one existing switch then it just needs the live supply to the lamp to be connected via the NC terminals of the Arduino-controlled relay.

Yes!!! That's exactly what my question is. Can you clear up the connection part again with the relay? Why use NC? Live supply would go to the C terminal of the relay right?

relay in the same box as the switch.

dave-in-nj:
relay in the same box as the switch.

That diagram assumes the intention is to have the manual switch and the relay both able to turn the lamp on and off i.e. you could turn it off with the switch and then on with the relay, or vice versa. I don't think that is what is wanted here.

I'm not going to draw a picture of my suggest solution, but I'll describe it. The manual switch will be a single pole single throw switch with two terminals which are connected together when the switch is in the 'on' position. The incoming live will connect to one terminal. The other terminal will go to the 'normally closed' terminal on the relay. The 'common' terminal on the relay will be connected to the lamp live. This way the lamp will only get power if the manual switch and relay are both 'on'. The relay will default to 'on' i.e. of the Arduino is switched off or fails for any reason, but the Arduino can switch it off.

PeterH:

dave-in-nj:
relay in the same box as the switch.

That diagram assumes the intention is to have the manual switch and the relay both able to turn the lamp on and off i.e. you could turn it off with the switch and then on with the relay, or vice versa. I don't think that is what is wanted here.

I'm not going to draw a picture of my suggest solution, but I'll describe it. The manual switch will be a single pole single throw switch with two terminals which are connected together when the switch is in the 'on' position. The incoming live will connect to one terminal. The other terminal will go to the 'normally closed' terminal on the relay. The 'common' terminal on the relay will be connected to the lamp live. This way the lamp will only get power if the manual switch and relay are both 'on'. The relay will default to 'on' i.e. of the Arduino is switched off or fails for any reason, but the Arduino can switch it off.

Yep that's crystal clear. Thanx mate, Cheers. Appreciate all your help people. :slight_smile:

relay is NC, so with no signal from the Arduino, the switch works as any other switch.

when the Arduino wants to make sure the light is off, then the signal can open the relay.