The use of the ESP8266 in the world of IoT

User avatar
By aventrax
#25703
rubensm wrote:Of course, there is no difference between pins on Arduino Yun and ESP8266.

I don't know Yun's voltage supply, but if it is 5V instead of 3.3V, you will only need a buffer to convert ESP 3.3V output into 5V to turn on the relay.

This buffer can be build in several ways:
1.- Buying a buffer.
2.- Using a transistor in saturation:
Image

Where it says Arduino input, it should appear relay input.

I think option 2 is better and cheaper than first one.

Hope it is helpful!

R


Hi rubensm,

I need to control a 5v relay with the esp-01 GPIO, I do not know anything about electronic :)
Can I use this schema? I'm not sure because I found different circuit with different resistences. Can I use both 1K as shown here? Can also use a BC337 as transistor?

GPIO0->1k Res -> base of BC337
BC337 emitter to ground
BC337 collector to relay IN to 1K res -> 5v

The circuit http://vinceelizaga.com/mobile-relay/ uses different resistances value.... why?

Thanks
M
User avatar
By lalo_uy
#25896 This is the best way to hook up a 5 or 12V relay

Image

The diode prevents voltage spikes when the relay goes off.
The R value depend on the current you want in the transistor base => current needed by the relay.
With 1k you get 2,5mA in the base and should be good for up to 100mA relay coil.
User avatar
By carl
#26114 I hope this one helps. I was able to control my Lights and Appliance remotely using internet for sometime now. I used a Stand Alone ESP8266 and a relay module to power up home appliance. Here is the link below.
Tutorial : http://thinkingparts.blogspot.com/2015/ ... et_13.html
Video : https://www.youtube.com/watch?v=eE3kkxk8zOo
Although in the video and tutorial only uses LED as a load so what I did is I placed a relay module instead of the LED and it actually works great.