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

The modification is easy enough - I tied GPIO0 high to 3.3V,via a 10K resistor. CH_PD I tied directly to 5V, not ideal, so you are encouraged to use a resistor there 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.

9 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
    2. Efectivamente después de revisar e invertir las R1 y R2, funcionó correctamente, claro aun usando el modo del blog.

      Delete
  5. I got one of these boards from eBay real cheap. Same R1 and R2 swap issue.
    It's ridiculous they would design a circuit that would be active (relay ON) when GPIO0 is high, but GPIO0 needs to be high to boot. The would have been better off using a PNP transistor, put a 10K pull-up resistor on GPIO0, and then driving GPIO0 low to activate the relay.

    ReplyDelete