Simple WiFi relay board: an overview (1)

His frustration is understandable as that particular module is needlessly complicated. It seems the ESP8266-01 is mainly there to make the WiFi connection, while the relay is triggered by yet another microprocessor, the STC15F104. Communication between the two is via the serial port of the ESP8266, as if the designers thought, how can we make this in the dumbest way possible.
If you want to use this relay, this is how to do it:

An even simpler board

The ‘simple’ relay board

In his follow up video # 110 Ralph describes another, simpler relay board (pictured), that also frustrated him as the manufacturer apparently had not included the necessary pull-up resistors on the Chip Enable and on GPIO0 and GPIO2. (Edit: this turned out not to be entirely true as the board comes with an ESP8266-01S that has the necessary pullups on board)

Both videos came in my focus again, when i discussed the ‘simpler’ board with a diy mate and frequent commenter. It is very cheap to buy and once you add the resistors (to make it start up correctly) factually you have a Sonoff SV.
Ofcourse the Sonoff SV is less than 5 Euro (plus shipping), as opposed to the ‘brandless’ relay board only costing some 2.60 euro, so you might as well get the real thing, but it opens some interesting perspectives, especially as I had most of the stuff laying around namely an ESP8266-01 a relay module and a 3.3Volt power module, all fairly cheap. Just a couple of DuPont cables to connect the three, and it should be fine. I know it is all nickles & dimes stuff but lets do a quick calculation.

Total 2.08 euro as opposed to 2.62 euro (in a nicer package), so not really cost effective to ‘DIY’ but if you have the stuff laying around, better to use it than for it gather dust. It also allows you to choose another pin than GPIO2 to drive the relay.
Ralph also offers a program to replace the existing firmware in the ESP8266, as well as a phone app (all found in the description of his video). Ofcourse it is also possible to replace the firmware with MQTT responsive firmware. For that you could e.g. use my Sonoff Touch program, albeit that in line 17, you have to change “TouchLED=12;” to “TouchLED=2;”

But why stop there? the ESP8266-01 has 4 I/O pins, if we ad a small 220->5V power module and a 4 channel relay board, we could make a sonoff 4ch. These cost about 22 Euro. So that would be more rewarding to build.That however will be for part 2.

Related

6 thoughts on “Simple WiFi relay board: an overview (1)”

After playing with the second type of relay board (the one without the STM controller), I can confidently say it is a great idea, with slightly lousy execution. Lack of pull-ups is actually not a problem as the board is shipped with the ESP-01S indeed, which has it’s own pull-ups.

The problems, in sequence of mild to severe are:
– relay driver pin is GPIO0 different than on the Sonoff SV
– button is wired to RST. A GPIO would be nicer
– GPIO is pulled down by the relay driver. The ESP won’t even boot!

To tackle all, I made the following modifications on the relay PCB:
– remove the 2K pull down resistor
– cut the PCB tracks going to the button and the relay driver
– re-wired the button to GPIO0 and the relay driver to GPIO2 using thin coil winding wire.

The only downside is that the relay is ON during boot. A side effect of the new Tasmota configuration is that the LED on the ESP01S shows the inverse of the on-off state.

All in all, way too much work to save 2-3 euro. In my defense, I only needed a spare ESP01 but was intrigued by the relay board. It was less than a euro more expensive than the bare ESP01.

Thanks for your concise review. I haven’t received the board yet but I would guess that it might be possible to reroute the relay fet to the Rx or Tx pin (and ofcourse remove the 2k resistor). That way you could pull that pin down and and avoid the problem.

Indeed, not a straight forward board for the novice. but the ESP8266-01S is surely an interesting development. I am tempted to get a few for ‘small jobs’
I would guess though that if you want a ready, no fuss relay board, the SonOff SV is a better choice at around 2-3 euro higher price
No need to ‘defend’ yourself: I for instance dont need the board at all, just was intrigued by it 🙂

I never worked with that module. Do I understand correctly that you had a working ESP8266-01 but that you reflashed it? Hmm that is slightly unwise as one never knows of the same pins are used.
In this case it is even worse because as far as I know, that relayboard has a seperate chip (possibly the STC15F104) that operates the relays am I correct? and it is connected to the ESP8266 via its serial port I seem to remember.
My program is made to directly control the relays, not to control that seperate chip.
So it is going to be quite a job to find out how you must control the ESP8266 in order to control the STC15f04 chip.

However, try to put the following test program in your ESP8266
// Turn ON Command
byte ReON[]={0xA0,0x01,0x01,0xA2};

// Turn Off Command
byte ReOFF[]={0xA0,0x01,0x00,0xA1};

void setup() {
Serial.begin(9600);
delay(500);
}

void loop() {

// Turn ON the relay for 1 Second
Serial.write(ReON, sizeof(ReON));
delay(1000);