Saw spark with my vent hood project!

i got the courage to make my vent hood smart as seen here https://www.youtube.com/watch?v=-DufaJWvEpA

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

and here’s the yaml code which i copied verbatim yml for vent hood - JustPaste.it

any idea how sparks coulda came about???

It is actually possible if the AC voltage you are switching with the relays was to track across the relay board and into the 5V dc side.

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.

1 Like

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 :frowning:

i got the logger as you had recommended:


what exactly does “delayed_on_off filter” do? yes, i read the manual but it does not make sense to me. i am sorry for being densed.

@sparkydave how to prevent this? i thought Optocoupler built within the relay is the solution.

@tom_l to power up the esp d1 mini chip, i am using a samsung phone charger. i suppose it could be fake. let me try another phone charger.

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.

1 Like

Make sure there is no tracking occurring here:

1 Like

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.

i believe this is what you mean, correct?
do i need to change the yml to commodate this new wiring?

also, the delayed_on_off applies to both switch and binary_sensor section of the yaml?

thanks so much for your time and patience!

ok…but how good is the electrical insulating properties of that plastic? It could in fact be causing the problem.

Have a look at the bottom of the relay board to see if there is evidence of arcing / tracking.

1 Like

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.