Flashing ESPEasy to the Sonoff 4CH

So far flashing the ESP8266 has been pretty easy, but with the new Smart Home devices from itead,it has become a bit more complicated. The reason for this, is because they have changed from the ESP8266, to the physically smaller ESP8285. The function of the 8285 is the same as the 8266, but it got the memory build in, instead of having it on an external chip.

Before we can flash ESPEasy to the ESP8285, we need a .bin file compiled for it. You can do that with the Arduino IDE, and in that load the ESPEasy source code, set the ESP8285 under Tools > Board, and then go to Sketch > Export compiled Binary, and you will then find a .bin file in the same directory as your Arduino sketch. Or you can go here and download the .bin file I compiled and put on mine https://github.com/blddk/esp8285/tree/sonoff_4ch. Here you can also find the NodeMCU flasher tool, which I used to flash my Sonoff 4CH.

Before being able to flash the ESP8285, there are a few settings which needs to be changed  (config file is also included on my github), here is how I set mine up to be able to flash it.

So now we got the software part ready, but this isn’t enough this time. With the Sonoff switch, we have been able to just power it by giving it 3v3 from the TTL adapter, but the Sonoff 4CH draw too much current, so the CH340G chip on my TTL adapter can’t supply enough current to make it boot up properly. So to get enough current available, I modified my TTL adapter a bit.

From the top side, it still looks pretty normal, except you can see the extra jumper I added to easy be able to switch between 3v3 and 5v while having a connector attached to it.

On the bottom side, I put an LM1117 voltage regulator on between the VCC and 3v3 pin, and also connected it to GND to complete the circuit. This isn’t perfect, as it is just in parallel with the voltage regulator inside the CH340G chip, but it works. With this extra voltage regulator, you no longer have to worry about having enough current on 3v3, because it can supply a lot more than the TTL adapters normally can do.

I also made a cable just for connecting easily to the Sonoff 4CH.

And then I got to something very confusing, because it just would not work.

Normally TX on your TTL adapter, needs to go to RX on the thing you are connecting to, and RX to TX. This is because the transmitted signal must go to the pin where it is expected to be received. But the silkscreen on my Sonoff 4CH was actually opposite. RX from the TTL adapter needs to go to RX on the Sonoff board. I first found this after having been struggling with getting it to work for some hours, where I just go absolutely nowhere. I then found the datasheet for the ESP8285 based module they used, and probed for a bad connection, but instead I found the TX and RX pins swapped, so it was opposite than the silk screen.

After swapping the wires around in the connector, I could flash ESPEasy onto the Sonoff 4CH, and finally it accepted the new code.

All I needed now was to figure out what pin was connected to what function, and then it was ready to use. And to save a bit of your time, here is my findings for pin connections.

GPIO13 Status LED (blue)
GPIO12 Relay 1
GPIO05 Relay 2
GPIO04 Relay 3
GPIO15 Relay 4
GPIO00 Button 1 / Flash
GPIO09 Button 2
GPIO10 Button 3
GPIO14 Button 4
GPIO07 2.5mm jack
GPIO08 2.5mm jack

Add a Comment

Your email address will not be published. Required fields are marked *