So you're a Noob? Post your questions here until you graduate! Don't be shy.
User avatar
By Drpepper
#60844 Basic Electronics Question (Training Day)
Thou I have decades of programing, I have about 3 days of Electronics. Lol
I watched 20 hours of YouTube vid’s on the basics, but it is now time for me to make my first project.
I am starting simple. So I want to control a srd-05vdc-sl-c relay from an esp8266 gpio.
I don’t want to use a relay board, I want to build out the circuit, including the math. Woot…
So if I understand the problem correctly.
The gpio is 3.3 at 24ma and the relay requires 120ma to activate.

The first of many questions is how is driving this relay best accomplished without drawing to much current from the chip?
1) Transistor?
2) Optical coupler?
3) Reed switch?
What I wouldn’t do to have a day with a hardware guy…
Who is up to spoon feeding a noob 
User avatar
By Drpepper
#60864 Thank you, thank you, thank you.
This is what I was looking for. I had seen this design, and for the life
of me, could not figure out why they used the diode.

What math goes into the diode? Do I just need to handle Current Load.
Could I use a 1n5400 (3 amp)? or even a 6 amp?
User avatar
By GregryCM
#60866 You are welcome. The fly-back current will not be any higher than the ON current. The relay datasheet will likely not give the inductance of the coil, so it is difficult to calculate what the voltage might do when the transistor is turned off, without the diode. Those diodes will likely be OK, but are certainly overkill for the 5V relay coil. A rectifier diode is typically used in this application, older designs would have used a 1N4004 or similar. Diodes Inc recommends S1A series as a replacement.