Controlling multiple AC relays with dimming

I am in the design stages for an Arduino Mega that takes inputs from a MQTT server and then turns relays on/off and applies dimming as appropriate. The relays are 230V DPST, 2 coil (24 V) PCB mounted relays. Attached to the relays is a dimmer circuit.
The dimmer circuit is based on It utilises zero crossing detection and a triac.

The overall design is as follows:

With the ZC detection circuit:

There will be ~20 separate light circuits, therefore I have designed a 595 circuit - designed to be daisy chained together (the second single ethernet port):

Each of these 595 PCBs will connect to four relay and dimming modules - each having two inputs for the coils - one to set, one to reset, GND, +24V and separate ground to power the coils. This will be connected via ethernet cable to the 595 boards.
There will also be one input to control the dimming (questions to follow).

This is the relay & dimming board:

Questions I have:

  1. I am making the assumption that I can use one zero crossing point detection and as the whole house is on the same phase, this will be okay. Is this valid?

  2. Edit: my misunderstanding. The arduino mega has more than enough digital pins for my purposes

  3. Controlling the dimming will be done by holding the required brightness as a percentage in an array for each dimmer. Clearly timing is key when dimming AC circuits to prevent flickering etc, will the Arduino be able to handle outputting ~20 dimming circuits at the same time, using the interrupts from one ZC point detection.

  4. As this will be for my house, I have tried to make sure everything is designed in the most optimum way, please correct me if I have overlooked anything. Likewise the 230V AC will be protected by a 3A MCB prior to the relay/dimming board. Everything else should be able to handle in excess of 5As. The 230V AC should be isolated with optocouplers from all of the 5/24 V DC lines. I am making sure all of the PCB tracks that handle the live voltage are thick enough.

You seem to have overlooked the possibility that you will, sometime, sell the house or someone will inherit the house. Since NONE of what you are doing is certified safe, will your insurance cover any loss traced to your system?
Do you have a mortgage on the property? If so, are you breaking the contract which may cause the mortgage to be canceled or demand payoff?
Where I live, all mains electrical systems must be inspected and approved by a government inspector. Is that the case where you live?

Nope, that has been considered and I have a sparky who will ensure reg compliance and issue the appropriate certificate.
The selling/inheritance issue is one I am happy with. And if the worse came to i can revert it back with only a little effort.

Guess you have most things covered, with the exception that "dimming" is a human visual thing and is logarithmic, not a percentage.

[quote="tkr7lz8nxeyfug, post:1, topic:862541"]

  • I am making the assumption that I can use one zero crossing point detection and as the whole house is on the same phase, this will be okay. Is this valid?[/quote]

That's correct.

I don't understand the PWM. Zero-crossing dimming doesn't use regular PWM.

Normally you don't use a relay with a dimming circuit. The isolated TRIAC circuit is essentially a solid state relay.

There are existing home automation systems where you can simply replace your light switches and outlets with remote controlled switches/dimmers that can be operated manually or remotely. If you already have a home automation system and you want to add a remote switch, you just order it and install it. When you move you can re-install regular light switches and take the remote switches with you,

I had an X-10 system for many years that I recently converted to Z-Wave. There are several standards although Z-Wave seems to currently be the most popular.

I didn't build any of it myself but I did build a "sunrise dimmer" that's plugged into it. The sunrise dimmer is very old and it's not built with an Arduino. (It fades-up a light and then beeps gently to wake me up.),

I have a fairly simple setup with a programmable "hub" that turns on & off or dims switches and lights at certain times or sunrise/sunset. (The sunrise/sunset times adjust automatically throughout the year.) The hub has it's own program/memory so it normally runs stand-alone, or I can control it with the computer over Wi-Fi. I can't control it over the Internet, but that could be added.

Edit: I misunderstood, i dont need analogue or PWM, you are right. I just need an output turned on and the TRIAC holds it until the next ZC point. Therefore one arudino board should be able to do all the circuits I could ever need for one house!
I know you don't need the relay, but I wanted a way to physically isolate both the live and neutral from the circuit. So both is over kill, but can guarantee electrical isolation.
I dont want an off the shelf system, I use a zigbee automation system already, and would like to go for a wired approach

You will find it an absolute nightmare trying to control dimmer timing by way of bits coming out of a shift register.

Have you prototyped the concept?

The shift register is only for the relays. The dimming will be straight off of the arudino. Nope, this it at the sketch and design phase. A prototype will be done once this thread has run its course. Hopefully picking up anything glaring I may have missed.

By posting the drawings of bits and pieces of this systems, we have no idea of what you actually intend to do.

For example, all these RJ-45 connectors, is the intention to interconnect the boards with cat-5 cable? If so, how far do you expect to drive what look to be to TTL level signals?

Apologies, I tried to be clear and I guess it's case of what is clear in my head isn't necessarily clear to everyone else. Here is a crude drawing of the system - hopefully this answers your question:

The red cables are CAT5 cable,

The brown will carry 230V

The blue are single cables back to the Mega. The blue lines to the relay/dimmer PCB are for the dimming (removing the timing issues from the 595s)

In answer to the how far question: not far, there will be a rack mount next to the fuse board.

Hope this helps

“Not far” does not a number make. 1meter? 2? 3? It does matter. Quite a bit actually, given the design.

I believe the main issue you’re overlooking is noise immunity.

Running TTL levels off board and into mains voltage areas is just asking for trouble. Further, Arduino and 74HC logic outputs are not designed to drive cables. Sure, you can do it, up to a point but that does not make it a proper approach to the problem.

A Mega has approximately 70 digital I/O. Given there appears to be enough I/O on the base board to do what you propose, what do you gain with the shift register approach? Now, rather than just a high or low state, you’re shoveling bits at a relatively high rate down a cable (unless you bit bang at a low rate). That significantly increases the likelyhood that what goes in one end of the cable does not come out on the other.

If all you’re doing with the shift register is turning the relay off when the dimmer output is zero, you could just add a missing pulse detector and turn off the relay when indicated by the dimmer signal. A simple 555 timer would suffice for that. Implement that and the need for the 595 goes away. One channel, one cable.

Thank you for you detailed response.

I would say <1m.

Okay that is valid point, although I don't know how to avoid bringing in TTL levels into the main voltage areas to achieve what I want to achieve?

The 595s were probably because I have recently done a project using them, each circuit will need (with the current design) 3 IO pins. I reckon there will be ~20 circuits, which already puts it at 60 pins.
I have had a look at a missing pulse detector, I like the concept. My concerns are, I would like the dimming/relay board to be as small as possible, as that will be inside the fuse box. The 555 will output high the entire time the relay is meant to be off? Whilst that won't be much power draw, multiplied across all the circuits all of the time could begin to add up?

The 595s will be on the same rack as the Mega - therefore the cables will be very short, and dropped bit should be less of an issue? However I will have a read up on bit banging.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.