-->
Page 1 of 3

Another newbie question: how to connect a relay?

PostPosted: Wed May 20, 2015 11:27 am
by Jabberwock
It seems I have got the ESP8266-01 module working and responding to web commands (switching the GPIO2 high or low), but then I encountered another problem: I naively thought that it would be sufficient to connect GPIO2 to the IN pin of the relay... But then the ESP stops working. I assume something should go between the two, but what?

Re: Another newbie question: how to connect a relay?

PostPosted: Wed May 20, 2015 11:40 am
by martinayotte
Of course, you can drive a relay coil directly with a GPIO, you need to drive it with something like a MOSFET or a transistor.

Re: Another newbie question: how to connect a relay?

PostPosted: Wed May 20, 2015 11:46 am
by Jabberwock
Sorry, I was not precise enough... I meant a typical relay module like this:

Image

which, it seems, can be driven by a GPIO of an Arduino, etc.

Re: Another newbie question: how to connect a relay?

PostPosted: Wed May 20, 2015 12:01 pm
by martinayotte
Difficult to see from the picture : if there is a MOSFET, fine.
Next thing to figure out if the input is active high or active low.
Also, beware to ESP-01 has limited number of GPIOs, and some needs to be pulled-up at startup.