I'm experiencing many problems with my last project: I've made a simple relay that shortly connects for a while the cables of the electric lock of my gate, in order to make it open, acting like a pushbutton.
The circuit is really easy: I've recycled a mobile phone 5V charger so that it can power up the esp and also the relay (which is a solid state one from Omron, so without mechanical parts). The relay is connected to the GPIO pin 2 and to make it open the gate I send this kind of string: "http://static_ip_of_the_esp/gpio/0" it works, but only few times. I mean, after few minutes (like 2 or 5 sometimes) it stops working...
I've read this problem has been reported several times but no solutions have been found.
Talking about the code, I am using the stock version of the wifiwebserver sketch, which I have sent to the ESP using an FTDI adapter and Arduino IDE. The only differences in my code are the network and pass name (obviously) and the fact that I've added a line in order to make the relay switch on for a while and then switch off (so: switch on, wait 10ms and then switch off).
I'm using this system in order to let my Google Assistant (via Google Home and also my smartphone) control it by opening that url via an applet which is triggered by IFTTT everytime I ask Assistant to open the gate.
Right now the module is seating in the electrical derivation in which run all cables of my home. Could this be an interference problem? Also the module is closed in a 3D printed PLA housing...
I've also tried changing my WiFi network channel and also the router, but the problem occurs anyway.
I don't know what to think anymore