Hello. I made a simple project using this relay baord v4.0. It has a big issue, if I have a large (.7A) load on the relay, when the relay shuts off it creates a spark (I am guessing) and the gpio 2 (button) detects it as a button press and the relay never switches off.
It's hard to explain, but here goes. My gpio2 is an input with pullup resistor enabled. If I connect it to ground, the program should turn the relay on for 2 seconds, after that shut off. Without anything connected to the high side of the relay, it works perfectly. With a 12v light bulb, the same, it works as intended, the light turns on for 2 seconds. When I connect a maglock (12v) (0.7A measured), it turns on, but never turns off. After the 2 seconds, you can hear the relay click, but the "relay on indicator led" never shuts off, my program stays in "on" mode, and never shuts off.
After two hours of diagnosing, swapping pins, and modifing code, I have finally found it. The spark being created when the relay clicks makes te esp think I am pressing the gpio2 button (something I don't understand as it should only activate when being pulled to ground). How am I sure? If I desolder the wire I soldered to gpio2 and short it to ground with tweezers, it no longer does it. So the wire connected to gpio2 is acting as an antenna.
I can also recreate the behaviour by shorting NO and COM with a pair of tweezers, whenever there is a spark the program detects it as a button press, Of course I can't see this in the serial output, since that same spark interferes with my serial to usb adaptor, ameking it disconnect from the PC at the same time this error occurs.
What can I do? I really don't want to seperate the esp from the relay board, as they were bought together to occupy a small space. I tried adding a 100uf capacitor between gpio2 (button) and gnd, and it helped, now sometimes it doesn't do it, but still does sometimes.
Hello. I made a simple project using this relay baord v4.0. It has a big issue, if I have a large (.7A) load on the relay, when the relay shuts off it creates a spark (I am guessing) and the gpio 2 (button) detects it as a button press and the relay never switches off.
It's hard to explain, but here goes. My gpio2 is an input with pullup resistor enabled. If I connect it to ground, the program should turn the relay on for 2 seconds, after that shut off. Without anything connected to the high side of the relay, it works perfectly. With a 12v light bulb, the same, it works as intended, the light turns on for 2 seconds. When I connect a maglock (12v) (0.7A measured), it turns on, but never turns off. After the 2 seconds, you can hear the relay click, but the "relay on indicator led" never shuts off, my program stays in "on" mode, and never shuts off.
After two hours of diagnosing, swapping pins, and modifing code, I have finally found it. The spark being created when the relay clicks makes te esp think I am pressing the gpio2 button (something I don't understand as it should only activate when being pulled to ground). How am I sure? If I desolder the wire I soldered to gpio2 and short it to ground with tweezers, it no longer does it. So the wire connected to gpio2 is acting as an antenna.
I can also recreate the behaviour by shorting NO and COM with a pair of tweezers, whenever there is a spark the program detects it as a button press, Of course I can't see this in the serial output, since that same spark interferes with my serial to usb adaptor, ameking it disconnect from the PC at the same time this error occurs.
What can I do? I really don't want to seperate the esp from the relay board, as they were bought together to occupy a small space. I tried adding a 100uf capacitor between gpio2 (button) and gnd, and it helped, now sometimes it doesn't do it, but still does sometimes.