In an earlier post, I discussed 2 popular 1 channel ESP8266-01 relay boards that are widely available on ebay and chinese webstores. One of these boards -the simplest- seems to cause a lot of problems with the unsuspecting buyer, as it doesn’t work.
So, it might be good to address the problems around this board again, in a more practical session.
Be aware that this circuit is intended for the ESP8266-01S, but it can be made to work with the regular ESP8266-01.
The main reason why this board does not work, is because the designer of the PCB was drunk, or high on drugs when he designed it, or maybe he just didn’t understand the workings of the ESP8266-01.
His failure becomes immediately clear when we look at the circuit:
The designer used GPIO0 to trigger the relay pin.
There is nothing wrong with that, but as GPIO0 needs to be pulled high to let the ESP8266 start in UART mode (i.e. a normal start). The consequence is that the relay is activated on start-up. “No problem” must the designer have thought, “I just add a 2k resistor to pull it down”. Sure, that works, but the ESP8266 then just will not boot anymore.
So, we need to remove that 2k resistor that is indicated in the circuit above. On your PCB it is indicated as R2 and labelled with ‘202’.
A simple nudge with a hot soldering iron suffices, but make sure you remove the right one.
The next issue is that there is no connection between the Chipselect (EN or CH_PD) and the Vcc. So that needs to be fixed. Ideally that can be done with a 10k resistor, but it is most practical to just make the wire bridge as indicated in the circuit above, like this:
If you have an ESP8266-01S, then you are set, the board should work.
If you have a classic 512kRAM ESP8266-01, then you need to do one more thing: you need to add 10k pullup resistors between GPIO0 and 3V3 and between GPIO2 and 3V3.
When you have done this, the module will also work with an ESP8266-01.
Now you have your 01 or 01S working but, the relay will be activated on startup. That can be handled in several ways:
Add a “digitalWrite(0,HIGH);” instruction to the beginning of your program….or….
Use the NC contact to make your connection….or….
reroute the track to pin 0, to another pin (GPIO 1 or GPIO3) and give that pin a pulldown resistor (which could be an unaltered R2): Leave R2 in place, give R1 a little nudge and connect it to another pin of the ESP8266.
Just one more thing about removing the 2k resistor. You may have come across people that do not mention removing the 2k resistor. They solder a 3k3 resistor between 3V3 and GPIO0. Well, yes that works. Why? Well effectively they make the pull up resistor on GPIO0 about 2k5 (the 10k in combo with the 3k3). So that gives a voltage divider of 2k5 over 2k, which makes 1.46 Volt out of 3.3V, which is high enough to be seen as HIGH by gpio0. That is indeed a less elegant method, but it works.
Now if you happen to have the below relay board, the one with the STC15F104-SOP8 micro controller in addition to the ESP8266, and you don’t get that working, begin with checking if the CH_PD/ EN pin is indeed pulled up to 3V3.