Controlling light fixtures using Arduino

Hi there, this may not be new but I wasn't successful to find a safe and holistic solution yet.

I'm planning to automat all light fixtures, Shutters and exhaust fans. Ready made Shelly's, Sonoff 's and the like are mind blowing expensive.

Since it's a new home, I got a qualified electrician to wire all loads to a central control box, also all 68 wall switches are routed back to the same box.

All wires are rated for 220VAC. Passes to load fixtures are physically separate from passes to wall switches to prevent interference.

I think that I should power the 68 switches with 5VDC SMPS, and read them back with an Arduino solution, then Arduino should control 68 icecube 5V relays to finally control the 220VAC loads. I will use cheap Chinese relay modules as industrial relays price's tripled the past 8 months.

As far as I understand:

1- There might be a problem switching 5VDC using standard 220VAC rated wall switches, that may lead to premature failure of the switch contacts.

2- The 5v signal may get lost due to resistance, the average wire length per switch is about 20 meters back and forth.

3- An RC snubber circuit is needed between the relay and the load to deal with the bacK EMF.

Also how should I read the 68 inputs and control the relay modules in an appropriate way.

Any advice should help.

The bottom terminal block hosts 220vac coming from the distribution box (top) and 220vac going to wall switches (down).

The top terminal block hosts 220vac outputs of wall switches (down) and inputs going to 220vac loads (top).

This setup allow the system to run on 220vac without automation.

The inputs and outputs of the wall switches will be hooked to an Arduino solution using 5v logic.

Do you understand the development cost and the potential liability costs make the price high?

And your insurance company won't cover it when your house burns down.

1 Like

If your going to use relays that will likely be placed where they cannot easily be monitored and checked, you would want them to be known reliable types ............

Yes, I do understand the costs involved. I hope to achieve a balance between cost/functionality without compromising on safety.

That's why I'm seeking help.

There could be a fail safe approach for doing that.

What an insurance company would like to see, is safety approved devices, installed by a certified person.

If you mean, help avoiding the occurrence of an accident in the first place, you're in a shaky place. This is essentially a hobby forum.

Thanks for honesty, at least the Arduino part regarding reading the 68 inputs and controlling the corresponding relays should be solved here in this forum.

I felt telling the whole story is better than just asking the Arduino thing.

As far as the I/O, I suppose multiple I2C I/O expander boards might work...

By the way, how do you implement, "dual control", i.e. a method where the lights can be controlled both locally and remotely? If they are conventional switches, they can be turned on/off locally, but if they are turned off locally, they can't be turned on remotely.

Can you show a schematic of how one switch would be controlled?

The switches should be running on 5vdc from a power supply.

The Arduino should read the switches, Wifi, sensors, ..etc. and control the state of the relay. i.e The loads can be switched by active high or active low programmatically.

If Arduino goes down the switches will be useless.

Are you contemplating custom switch circuits in the switch box at each room location? No non type approved electronics is permitted to be installed in a mains electric box.

What is the overall topography of your system? It is hard to visualize what goes where. That is why I asked you for a diagram. But a good explanation would be acceptable.

This seems like a problem, no?

Did your electrician include appropriate circuit breakers for each circuit? Remember, a breaker or fuse will NOT protect your electronic stuff from fire.

The picture in my first post is the central control box, with a description under.

All 220vac loads are there at the very top row of the upper terminal block , i.e Lamp

The 220vac power supply feeding from the distribution box is there at the top row of the lower terminal block, i.e Electricity.

To complete the 220vac circuit, switches receive 220vac from the bottom row of the lower terminal block and deliver it to the lower row at the upper terminal block.

This system is a star topology running on 220vac without automation.

To utilize automation,
1- I intend to connect the 220vac power source (electricity) to the relay's comm. the Lamp to relay's NO.

2- Feed 5vdc to the switches from an independent power supply, and scan them by Arduino, and control the relay's coil correspondingly.

Yes all loads are protected by appropriate MCBs.

However, I don't understand how to prevent electronics from catching fire.

There's a breaker for the 5vdc power supply. Is that what you mean?

The 5vdc power supply is responsible for
1- Wall switches
2- Arduino and i/o expansion boards
3- Relay modules.

You can't. The best you can do is prevent wiring shorts that can melt insulation and possibly create a fire. Any solid state electronic device will die many milliseconds before any fuse/breaker can do anything. Have enough ventilation and air movement to remove heat from your electronic devices. Keep devices apart so heat from one does not damage the adjacent boards.

That will not be a problem. You are correct that switching DC can be a problem for contacts designed for AC, but at 5V and a milliamp or 2 you are a long way from any problems. As a rule of thumb I suggest any voltage below 25VDC is unlikely to be a problem, unless stated otherwise by the switch manufacturer.

Don't use cheap relays, you are asking for problems. It seems contradictory to worry about premature failure of the light switches then not worry about premature failure of cheap relays that are likely to fail prematurely. I suggest proper industrial relays mounted on a DIN rail, ideally with sockets so they can easily be changed. Having said that why relays? Triacs would make more sense. What about dimming the lights?

For fire protection put everything in a metal box capable of containing any fire resulting from failed electronic components.

Finally don't take advice on safety critical electronics from people you don't know on a hobby forum, find someone local to you with the right skills to help you do your project safely.

1 Like

How would the signals from the switches (I assume located in different rooms?) be conveyed to the Arduino?

Believe it or not, light switches cost 40x the equivalent relay modules.

Until researching the Triacs as you suggested, is there a way to stress test an 8 channel relay module easily found on Amazon.