In a previous post, I had a look at the Sonoff in the “Replacing the ITEAD Sonoff firmware” post, and not long after they released a new and even more handy smart socket, again with a relay inside to switch mains voltage, and a little power supply to power the ESP8266 driving it all.
At first glance they look pretty good. Not too ugly, not too bulky, but they should not get any bigger, they are just on the edge of being a bit too big. But I have seen worse, and what I am even more interested in, is how it is made inside…
So jumping straight from the outside to the inside, and to get in, we need to take out one screw, which is hidden under the bottom label.
After taking the screw out, firmly grab the front and back section of the housing, and pull them apart while twisting a bit. This will make the clips release their grip.
The inside is pretty clean, and this time they were good to hackers, and actually labeled the VCC, RX, TX and GND connection, so it is easy to solder a header to it and replace the firmware.
However, one thing I noticed right away, is that those four pins are the only one broken out to us for easy access. There is still plenty of room left on the PCB to break out a lot more, and give us even more options for hacking this module and paring it with some sensors.
A bit closer look, and a look on safety. With the previous Sonoff switch, the high and low side of the circuit was questionably close to each other, because there was a very limited amount of room to actually get some good isolation between the traces. With this module, they have improved that a lot.
No ground pour on the mains side, isolation slots throughout, and generally a much nicer design.
Replacing the firmware
This is even easier than last time, because this time we actually got labels for the pins to go after. So this time I am not even going to bother making a nice table for it, just connect 5V to VCC, set the programmer to 3v3, then attach TX from the programmer to RX on the PCB, and RX from the programmer to TX on the PCB.
Then hold the button down on the PCB, and attach the programmer to your computer. Holding the button down while applying power to the ESP8266 will bring it into flash mode, which will allow you to put new firmware onto it.
After publishing the post about replacing the firmware on the other Sonoff module, I had some mails from people telling me about ESPEasy, and how easy it is to use. And indeed, it is very easy to use. And also very easy to flash onto a ESP8266.
If you want to try it out, you can get it from here: http://www.esp8266.nu/index.php/ESPEasy
To flash ESPEasy to the module, you still use the steps from above for attaching the programmer to the PCB, hold down the button and attach the programmer.
To flash ESPEasy, you simply unpack the file with the firmware in, and run the flash.cmd (windows) file. It will then ask you for which com port the programmer is attached to, which size to use (I tried the 512 version, and it worked right away, bigger ones might work too). Last it will ask you about which version to flash, and here you put in the version number of the firmware in your folder. In mine there is a “ESPEasy_R78_512.bin” where R78 is the version, so put in 78.
After that it will start to flash the firmware to the ESP8266 module.
After having put another firmware onto the ESP8266, we would probably want to be able to control the relay again, and for that we need the pin number.