Arduino wall light bulb switch

Hello,
I need to be able to control switching on and off a light bulb with arduino, so i was thinking about opening the box in the wall, cutting the wire of the switch and connecting to it in series a 5v single channel 220 relay controlled by arduino.
Would it work?
thanks

You should never cut those wires. If they become too short, it is not feasible to safely connect them to a switch or receptacle insert. The electrical safety code in most countries prohibits any non-approved device from being inside any electrical box. Also, it's impractical and/or dangerous to run low voltage wires into a wall box.

aarg:
You should never cut those wires. If they become too short, it is not feasible to safely connect them to a switch or receptacle insert. The electrical safety code in most countries prohibits any non-approved device from being inside any electrical box. Also, it's impractical and/or dangerous to run low voltage wires into a wall box.

I see.
How about this? https://www.youtube.com/watch?v=F-yk4Tyc44g

Your reference to "cutting" the wire of the switch concerns me greatly. There are many safety and legal concerns about working on your domestic (or commercial) power wiring and it most certainly sounds as if you are not qualified to do so. :astonished:

Somewhat more dangerous even than an electric bike. :grinning:

Home automation or "domotics" is most certainly a popular topic here. You certainly can use a relay module to control a light but constructing a sufficiently compact unit to fit into a wall utility box including the relay module, control electronics and power supply is a challenge and then you have to figure out how or from where you propose to control it?

Something like this arguably could fit the bill, paired with a power supply module:

But a readily available X-10 device may be more appropriate.


amadeok:
I see.
How about this? https://www.youtube.com/watch?v=F-yk4Tyc44g

And there's the point.

How are you going to fit all that into a wall utility box? And what is it going to do that is of any use? :roll_eyes:

there is a huge difference of what you 'CAN' do.
you can wire your house to allow it to burn down.

and what you "MAY" do, as allowed by your insurance company and building code.
if you modify your house wiring and it is not 'per code' your insurance company may deny the claim.

and what you 'SHOULD' do.

you can buy a light bulb that has WiFi and never touch the house wiring.
you can hire a licensed electrician to open the drywall and remove the existing wall box and replace it with one that allows for low voltage devices to be placed, next to, but separate from, mains wiring.

The link shows what can be done on a bench not installed in your house.

but think about the circuit. if the relay is open, then the switch cannot work.
if the switch is open, then the relay cannot work.
look up series wiring and parallel wiring and 3-way circuit to get an idea of how to wire a circuit on a bench.

there are WiFi light switches you can by that are properly designed and meet some sort of codes. you need to verify they meet your local codes.

I suggest you buy a "home automation" switch. There are lots of engineering and construction challenges making something that works without re-wiring your house, something that fits into a switch box, works locally or remotely, and looks good. And, you probably can't build it for the price you can buy it. [u]Here is an X-10 dimmer switch[/u]. (That's the American 120V version but there are similar 220V products.)

If you want, you can build the controller/hub yourself, but IMO it's best to buy the switches and outlets.

There are several existing "home automation" systems/protocols. I've had an X-10 (now combination X-10/insteon*) home automation for many years. I've got about 10 controlled switches/outlets, a master timer/controller, one motion detector, and a few wired & wireless manual remote controllers scattered around. I didn't build any of it myself.** My system isn't connected to the Internet or cell phone network, but a hub could be added.

As far as I can tell there is currently no dominate standard. X-10 is the oldest and cheapest. There is a [u]consortium[/u] working on a new standard, but I don't think it's off the ground yet.

  • The newer Insteon products are no longer X-10 compatible.

** I did build a "sunrise dimmer" and "wake-up system" that's plugged-into a controlled outlet. So the part I build doesn't have a time-of-day and day-of-week timer. That's handled by the master timer/controller. At the time, the home automation system couldn't slowly bring-up the brightness over several minutes, but maybe that exists now.

Agree with all that, and IMO the contact connections on the those relays are rather close to the low voltage coil connections for my liking

Paul__B:
How are you going to fit all that into a wall utility box? And what is it going to do that is of any use? :roll_eyes:

No in that case it would go outside, maybe hanging or on top of a table.
Thanks for the suggestions but i think ill just use a SG90 servo to mechanically turn on and off the switch that is already there. It has plenty of strenght to do that.

Why does it have to be Arduino? Sonoff makes several wall-switch products that operate over WiFi.

If you're replacing an existing fixture, switch, or receptacle, there's usually no need to contact the building department. But when you run new electrical cable for new service, whether wiring several circuits or adding just one receptacle, be sure to work with a building inspector and comply with all local codes.

You could build the parts into the lamp body?