I am trying to reproduce the schematics of the ESP8266 WiFi relay switch (Arduino IDE) example here:
The only difference is that I have esp-201 instead of esp-01.
When I power up the board the logic is reversed: '1' means OFF and '0' means ON.
The other thing that bothers me is that on initial power up there is a fast ON/OFF/ON cycle with the relay.
Any idea how to avoid ths ?
By the way, I assume that there is no direct connection between BASE of the transmitter and GND (that's not clear on the schematics).
Edit: A simple push-up resistor of 10K on GPIO2 fixed the issue (due to the special functions of GPIO2 - same goes with GPIO0 if used).
You can try using different GPIO(RX-GPIO1 or TX-GPIO3). Probably using pnp transistor or MOSFET can help.
I was trying to recreate this schematics, changing resistor values and so on with no luck.
Using GPIO0 and GPIO2 is troublesome due to boot up process of ESP8266. Finally I've used GPIO1 connected via resistor to 2n2222 and then to relay and 1N400x diode in parallel. So no relay module. Then it worked without problems during booting.
There is no connection between base and GND.
Hello, I am glad someone replied to my post at last. Would you care to send the schematics of what you have tested because I can't figure it out how to introduce the 1N400x diode in the diagram I'm using ?
Also by using GPIO1 you mean to change the code from
(I am using Arduino IDE for ESP-201 programming) ?
What about GPIO5, I beleive it's feasable as well ?
For connection just type '2N2222 relay' in google. First result is from
and it explains everything.
GPIO5 should be ok(but I haven't worked with esp-12). Have you tired using other GPIOs(12,13,14,16)?
How about a MCP23017 (I2C bus) Then you have a lot of outputs, and run it at 3v3 then you can use 5v as input to the MCP23017
MCP23017 hase 3 add pins so you can make a lot of in / out with only 2 pins.
MCP23017 has to port's A and B, eatch has a IRQ pin out, so is you use then to read from outsite, you can connect the IRQ pins to otheer pins of the ESP modul and see if there is any inputs waiting