I am using this common relay module from Ebay (image below). It works very well 99.9% of time. It's controlled by ESP8266. It's in the plastic box with some AC wires (which are obviously plugged in these relays).

What happens is, that sometimes (approximately once in a few days) it switches itself on for a very short time. I know this, because when my garage doors opened few times in night, I stopped trusting this module and I have unplugged garage doors from it. Instead, I have plugged ESP8266 +5V and input in it, so I could see if relay really switched itself and by itself. Because I have also completely commented out code, which controlled this relay in ESP8266.

So now I know for certain, that the problem is inside this relay module. Because relay module is using optocoupler which is switched by connecting data pin to GND, I think it shouldn't be electricity induction problem from AC wires around.

So the last thing which comes to my mind, is that the electricity is inducted directly in relays coil, if this is even possible ? Or I have no idea :-)

Can someone shed some light on this and try to come up with reason why this is happening and mainly how to solve this problem ?

The only thing which I have ready to do right now is to use 2 relays in series and hope, that this "glitch" doesn't happen in both of them in the same time. It's more probable that I win lottery than this happening, however, I wouldn't feel very happy about this obscure solution.

Thanks everyone for your time reading my question.

enter image description here

  • 5
    \$\begingroup\$ If it is the relay module that is switching on by itself, then it will do it without the ESP8266 connected. It is more likely that it is the ESP8266 that is commanding the relay to switch on. Is the ESP8266 resetting periodically? Maybe in a reset state the GPIO goes low which drives the relay. \$\endgroup\$ – HandyHowie Nov 7 '17 at 9:27
  • \$\begingroup\$ @HandyHowie I don't believe this is the case. Mainly because when I plug/unpplug esp8266, nothing happens. Meaning that GPIO connected to relay module doesn't go low. But I will disconnect relay module from esp8266 completely, that's a good point, if it does again, then it's 100% relay's fault. \$\endgroup\$ – Frodik Nov 7 '17 at 10:40
  • \$\begingroup\$ OK, I tried to disconnect data cable and relay module switches on by itself again. So it must be problem in relay module itself. I suspect the electricity induction is happening on the line to optocoupler where it needs very little mA to lit up LED in optocoupler and switch on relay. \$\endgroup\$ – Frodik Nov 10 '17 at 19:05
  • \$\begingroup\$ Is it only one of the relays that is randomly turning on? If so, you may just have a faulty opto isolator. \$\endgroup\$ – HandyHowie Nov 11 '17 at 21:28
  • \$\begingroup\$ @HandyHowie Unfortunately, it's not only one relay. It's module board with 4 relays. I tried one thing - connecting the line, which I need to controll, to two relays. I thought I would minimalize the possibility when relay switches by itself to almost zero. Well, I was wrong. Even with this unprobable scenario, when two relays must randomly switch both at the same time, this happened. So I am still at the beginning and in need to solve this very soon. Please help with any idea. \$\endgroup\$ – Frodik Nov 13 '17 at 9:13

I don't have the values but the module schematic shows transistor base left floating while inactive which makes them sensitive to EM noises. Depending on the values a resistor between base and emitter or from optocoupler emitter to ground can help alot. This is the module schematic I found


Pull-down missing from the transistor base? The opto will have some leakage straight from vcc down to transistor base.

Would be interesting to see what happens if camera flash is ignited next to the relay module. Or ignition spark.


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.