-1
\$\begingroup\$

enter image description here

I have 8 relays controlled by esp8266 through a shift register. 4 relays on the left are under 220v load and 4 on the right are under 12v.

220v on the input splits between the left relay board load and 12v power supply. 12v then splits between right relay board load and a buck converter. Buck converter outputs 5v for esp, relay boards and shift register.

When there is no load connected, corresponding relays turn on/off according to the code. But as soon as I connect one or more loads (220 or 12v, doesn't matter), relay boards go completely bananza and start randomly turning ports on and off whenever I change state on any output.

Twisting load wires has the same effect. Is it some kind of interference? But loads and inputs of a relay board are optocoupled, so how can it be? 🤔

Previous version of the device had all 8 relay pins connected directly to esp and worked fine both with and without load.

So the question is — what causes the problem and how can I solve it?

(Don't mind the mess, it is version 0.1 🌚)

\$\endgroup\$
11
  • 2
    \$\begingroup\$ You have some design issue or another; without a schematic no one can tell which \$\endgroup\$ – Chris Stratton Nov 15 '20 at 22:59
  • 1
    \$\begingroup\$ @ChrisStratton "When there is no load connected, corresponding relays turn on/off according to the code" and "Previous version of the device had all 8 relay pins connected directly to esp and worked fine both with and without load". Well, of course it is design issue. But provided info is sufficient for knowing person to make a guess. The problem started after adding shift register AND twisting wires creates interference => the possible problem is shift register picks up interference. But the solution is unclear for me \$\endgroup\$ – Eduard Nov 15 '20 at 23:16
  • 3
    \$\begingroup\$ The problem might be arcing relay contacts causing electromagnetic interference, if it works without load. Please link to schematics of the relay modules. "Optocoupled" means nothing, most Arduino relay boards that have an optocoupler do not use it for isolation so it gives false assumptions about being good. \$\endgroup\$ – Justme Nov 15 '20 at 23:20
  • 1
    \$\begingroup\$ @Justme Thanks for the answer. It is a cheap module from aliexpress marked HW-280. I think it is a rip off of this one wiki.sunfounder.cc/index.php?title=4_Channel_5V_Relay_Module \$\endgroup\$ – Eduard Nov 15 '20 at 23:28
  • 2
    \$\begingroup\$ @Eduard there we have our "knowing person's guess": low cost knockoff relay board without specs, there's your culprit right there. Done. Next! (for an opportunity of any of us giving you a more in-depth analysis, please do add schematics of your overall system) \$\endgroup\$ – Marcus Müller Nov 15 '20 at 23:32
1
\$\begingroup\$

It appears that EMI generated while switching inductive loads is the cause of your problem. RC snubbers, connected across the loads, may be the solution.

\$\endgroup\$
2
  • \$\begingroup\$ I didn't try it because I replaced the shift register with I2C I/O expander. But thanks for advice, will definitely read about RC snubbers. \$\endgroup\$ – Eduard Nov 17 '20 at 19:47
  • \$\begingroup\$ Antime, Eduard! \$\endgroup\$ – vu2nan Nov 18 '20 at 2:14

Not the answer you're looking for? Browse other questions tagged or ask your own question.