Friday, 23 March 2018

Debugging the ESP8266 ESP-01S Relay Module

ESP8266 ESP-01S Relay Module Relay WIFI Smart Socket with ESP-01S

In a previous post I wrote about switching a 5V relay module using the ESP-12E over WiFi. Well just two days ago I spotted this delicious module for just RM26.90. It arrived today- hurrah for Internet commerce!

I powered on - and nothing happened. The red power light on the ESP-01S came on as usual, but there is none of the familiar blue flash on startup.



A little check with a multi-meter revealed that GPIO0 and CH_PD were not at the high (ie 3.3V) voltage level required for startup. A quick search on the Internet unearthed a schematic which confirmed this:

The relay module schematic has no provision for GIO0 and CH_PD tied high
Now it does not mean the module is faulty. It is possible to write a custom firmware for a working module without having to tie GPIO0 and CH_PD high. It is just a NodeMCU thing. Trouble is, the firmware in the attached ESP-01S came with NodeMCU firmware.

The modification is easy enough - I tied GPIO0 high (ie to 3.3V) using a 10K resistor as the schematic showed it was also used to control the relay. CH_PD I tied directly to 3.3V, but you are encouraged to use a 10K resistor as well.



Modifications to GPIO0 and CH_PD

And that was all it took- it powered on quite happily (I used a modified version of the Arduino IDE Blink sketch.

Working ESP-01S relay module
Here is a Youtube video of it clicking away ... Happy Trails.

7 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Hello, I made the changes, the led turns on but no wifi signal appears on esp-01

    ReplyDelete
    Replies
    1. Perhaps you can dismount the ESP-01S from the relay board and run it from its programmer (hopefully the CH340 USB dongle) and see what the Serial Monitor output is?

      Delete
  3. Hello,

    I made the modifications, but the red led on the ESP01s relay never lights up. Any idea why it doesn't?

    ReplyDelete
    Replies
    1. See if you can veriry the program operation by looking at the debug messages from the programmer's Serial Monitor. The relay PCB (at least the ones I bought) seems very sensitive to 5V supply overvoltage. Try to ensure it is not more than 5.25V. I've had ESP-01S fail (3.3V to GND short-circuit) permanently because of this. Also sometimes (once so far) the relay PCB is just plain faulty. Hope this helps.

      Delete
  4. Tried this mod but it would not work for me. After 2 days of trying I found that R1 and R2 on the schematic above were reversed. That is R1 was 10K and R2 was 2K. So if your relay modules shows R2 marked "202" that is likely your problem. I did not have to make any other modifications.

    ReplyDelete
    Replies
    1. Thank you. I'll check this out. I have this one PCB that won't work no matter what I did ...

      Delete