1 month ago, wife noticed spark flew out of the real physical buttons. i ignored cause i thought it cant be. today i saw the spark myself!
any idea how that is even possible?
here’s the diagram Cirkit Designer IDE
as you can see the D1 mini sits in the middle. it’s impossible for high voltage to jump into the buttons. and yet i saw lol
The other possibility is that the 5V power supply you are using to power the ESP is not well isolated from the mains. Cheap Chinese phone chargers are notorious for this.
Not necessarily related to your problem, but I see your setup very “fragile”.
Your circuit image presents spartan 5V relay module without opto. You code tells that it’s active low relay. So when you switch off (3.3V on IN-pin), the transistor driving relay coil doesn’t turn completely off.
I would replace it with relay module designed to be triggered with 3.3V and the optocoupler on those modules might give you other benefits here as well…
Also your button input on TX pin can be improved.
Set the logger baud_rate: 0 to make sure it doesn’t spam the TX pin.
And add some small delayed_on_off filter to improve further.
can you please share the link to relay i should buy?
i found this 3.3v relay but not sure if it has all the specs you prefer.
the circuit image is just for layout, not the real relay i have.
this is the actual board that i am using. it does have optocoupler but i guess still not good enough to isolate the AC
Remove jumper, connect 5V power supply to JD-VCC pin and GND to GND. Leave VCC in the middle empty.
On the other header connect Esp 3.3V pin to VCC and IN pins to GPIOs. leaving GND pin unoccupied.
Filters out small glitches and bounces that are not button presses.
yes, the relays are on a bread board.
to be extra sure the relay’s bottom metal contacts are not touching the bread board’s pins, i placed a piece of plastic in between the bread board and the relays.
Your wiring to power relay is correct, missing IN though. No need to modify yaml.
But since you power the coil (5V/GND) from Esp, obviously you don’t have true optical isolation.
Delayed_on_off is for binary sensor and 30ms should be sufficient.