Voltage spike when relay turns off causing ESP 01s to stop working

Hi. I'm relatively new to electronics. I just made a Arduino Uno with a ESP 01s and a relay board to control a 12V solenoid valve. Everything is working fine when the relay is turned on. However, once the relay turned off, the ESP 01 immediately stop working. I read that this is due to the back EMF from the energized coil. May I know how could I add a diode to the circuit? Thanks in advance!

You have two sources of the back emf - your relay coil and the solenoid itself :
There is a sticky on the subject and ..
Guide here :


Welcome to the forum.

Please read the post at the start of any forum , entitled "How to use this Forum".

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks.. Tom.. :slight_smile:

"May I know how could I add a diode to the circuit?"
Yes, Quickly.
Across the relay coil, cathode to the more positive end of the circuit (it seems 'backwards', but that's how it works).
Websearch "relay diode".

There is a brief tutorial on this forum explaining exactly what you want to know:


This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.