0
\$\begingroup\$

tl;dr: I'm having a problem with 8-relay module boards that control sprinkler solenoid valves. When 24VAC is present, sometimes turning a relay off causes other relays to randomly turn on.

Long version:

My configuration is as follows:

  • I'm using an ESP32 Pico kit microcontroller.
  • Three of the 3.3V ESP32 pins are connected are connected to a 3.3V to 5V bi-directional logic level shifter (one level shifter per pin, three total).
  • The 5V logic level shifter outputs are connected to the RCLK, SRCLK, and SER pins of a SN74HC595 8-bit shift register.
  • Three shift registers are daisy-chained together, providing 24 outputs total.
  • Each of the 24 shift register outputs are connected to an input of one of three 8-module relay boards.
  • The 8-module relay boards are powered by a standalone 5V supply (in other words, not the 5V linear regulator on the Pico board). The 5V supply is a 1.5A supply, large enough to turn on several relays at once.

When there are no connections to the relay outputs (NC, COM, NO) on the 8-module boards, the relays can be turned on and off in any order or combination, so I believe the shift registers, connections to the relay boards, and software are correct.

I then connect 24VAC sprinkler solenoid valves to the relays like so:

Notice in particular that one leg of the 24VAC transformer is connected to the COM port of multiple relays in the 8-module relay boards.

When I enable just one relay it looks like this:

enter image description here

If 24VAC power is not enabled, I can turn on and off the relay just fine. When I plug in the 24VAC transformer and then enable the relay, again, everything works ok. The sprinkler solenoid energizes and all is well.

Most of the time, say 4 out of 5 times, when I turn off the relay the solenoid shuts off and everything is good. However, 1 out of 5 times, when I turn off the relay, numerous other relays just randomly turn on. When that happens it looks like this:

enter image description here

I'm wondering if anyone can help me diagnose what might be happening and/or give me some troubleshooting tips. I've disconnected things down to just one solenoid in the system and it still happens.

Random notes on my setup:

The leftmost relay of the bottom, horizontally oriented 8-module board is where the COM cable comes in from the 24VAC transformer. It then connects to the COM of the relay to its right, then that COM connects to the COM of the bottom-most relay of the left 8-module relay board, runs up through each COM of the left board, then runs across the top to the COM of the upper right 8-module board, down through each of its 8 relays, and terminates there.

The rightmost 6 relays of the bottom horizontal board do not share the COM channel. I am using those as dry contactors to operate different (non-sprinkler solenoid) devices.

\$\endgroup\$
  • 1
    \$\begingroup\$ I think the disturbances are caused by switching off one of the solenoids at peak current. One could try to connect a bidirectional TVS diode to each solenoid. Not here in the box, but directly to the solenoid terminals. The part number of the diodes is P6KE36CA. \$\endgroup\$ – csabahu Aug 30 at 22:52
  • \$\begingroup\$ @csabahu Thank you that seems to have fixed the problem. \$\endgroup\$ – par Sep 4 at 1:12
1
\$\begingroup\$

I think you have an EMI (electromagnetic interference) problem.

Take a 24VAC supply, a fairly long cable with an inductor (i.e. solenoid) on the far end, and a relay contact being opened, and you have: a fine Spark Gap Transmitter from the early days of wireless! Bring an AM transistor radio nearby and see if you hear a crash of static when you deactivate a relay.

Looking at the disturbance, which turns on several circuits that should be off, I'm guessing the EMI is getting into the inputs to the shift register. However, it's also possible it's causing the ESP32 to reboot or something else strange.

Your 8-relay modules have opto-isolated inputs, so try moving your ESP32/shift register boards farther away from the 24VAC solenoid wiring, or shield them. The grounds for your ESP32 and shift registers should be tied together, and NOT tied to the relay board ground. The relay board ground should connect to nothing except the 5V supply for the relay coils.

Of course, if you can get an oscilloscope, you could verify this possibility. Otherwise, keep experimenting and observing as you've been doing. Good luck!

| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

The optoisolators on the relay boards are intended to help with this kind of issue. Relays, especially inexpensive ones as those boards have, do not provide very good isolation against EMI.

If you separate completely the supply to the relays from the supply to the other bits it may help (though your layout is not great- the relay contact wires should be kept well away from the control wires).

That means not even a common ground between the relay power and the control input signal and return.

| improve this answer | |
\$\endgroup\$
  • 1
    \$\begingroup\$ Thank you, I'll try it. \$\endgroup\$ – par Aug 31 at 7:04
1
\$\begingroup\$

Do your sprinkler solenoid valve have a freewheel diode attached?

like here: https://en.wikipedia.org/wiki/Flyback_diode


In case of AC supply of the solenoid, use a varistor (an Element which has high resistance below a certain voltage and a low resistance above)

[![solenoid protection by varistor][1]][1] public domain from https://de.wikipedia.org/wiki/Schutzbeschaltung


If your circuit lacks a protection which consumes the solenoids stored energy when turned off, please attach one appropriate solution and report if the problem still persists.


In case you do not provide a controlled path to annihilate the stored energy it will certainly damage your circuits over the time. [1]: https://i.stack.imgur.com/HKyCY.png [2]: https://de.wikipedia.org/wiki/Schutzbeschaltung

| improve this answer | |
\$\endgroup\$
  • 3
    \$\begingroup\$ The solenoids are 24 V AC. No can do freewheel diode! \$\endgroup\$ – Transistor Aug 30 at 22:00
  • \$\begingroup\$ in that case, you can use a Varistor, which has a high resistance below a certain voltage and a low resitance above... \$\endgroup\$ – schnedan Aug 31 at 17:10
  • \$\begingroup\$ Correct, but update to answer is required. \$\endgroup\$ – Transistor Aug 31 at 17:16

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.