Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By metalphreak
#43205 Image

(the schematic was drawn upside down to normal convention... 5V at the bottom and GND at the top)

This is what I used in my 8ch relay project: https://hackaday.io/project/6456-esp8266-din-8-channel-wifi-relay-controller

5V connected to one side of the coil. Other side of coil is connected through an N-channel mosfet to ground. There is a reverse-biased diode across the coil for the back-emf generated when the coil switches off (google freewheeling diode for an explanation). The gate of the mosfet is connected to an I/O pin and also pulled to ground with a 10k resistor.

The LED is an optional indicator which you can leave out.
User avatar
By dev67
#45147 Hey all, I know this was from a while ago, but if anyone wants to know how it turned out and what I used it for check out this post. https://www.reddit.com/r/esp8266/comments/4a7g4a/what_am_i_doing_wrong_with_this_relay/

I would've transcribed it into this forums formatting but I just spent forever posting it to reddit.

Also I'm sure my circuit isn't as good as it could be, so critique away if you feel inclined.

I learned a lot from everything you guys posted earlier, and even if I didn't use all your advice in my circuit, I'll definitely be referencing your posts next time I go to make another wifi relay so that it works better. To be honest I'm still drawing my circuits with pictures from google, so that should give you an idea of where I'm at skill-wise lol. I'll get there eventually!

Thanks again for all your help! :D :D :D