Chat freely about anything...

User avatar
By vazquezjm
#45852 Hi there.

I'm working with an ESP01 and a relay module like the one shown below:

https://tkkrlab.nl/wiki/Arduino_KY-019_5V_relay_module

Everything works perfectly. I can open and close contacts without any problem using MQTT messages.

The point is that when I power the module (5v) it makes a kind of quick switch between NC and NO. This is not a problem as it has no load connected right now, but in a real life application, if this happens (after a power outage for example), it can damage the device that I want to control.

Is there is a simple solution to this?

TY!
User avatar
By martinayotte
#45861 The way you driving your relay is not matching the idle state of GPIO2 or GPIO0 that requires to be HIGH using pullups at boot time. You should drive your relay in a way that this HIGH level, the relay should be OFF, and when firmware is outputting a LOW on GPIOs, the relay become ON. Therefore, in your code, the digitalWrite() should be inverted.

Other details can be found here :

viewtopic.php?f=6&t=9454#p45277
User avatar
By martinayotte
#49193 According to your drawing, you are placing the battery directly to GPIO2.
Also the relay board has only 1 wire hooked up thru resistor, but where are the other wires ?
And since I don't know any thing about this relay board, how it is working ? Active HIGH or Active LOW ?
Maybe you will still need an additional transistor to invert the logic ...