First, watch the step by step video tutorial below
The code mentioned in the video can be found here: “Reprogram Sonoff Smart Switch with Web Server“.
Safety warning
Make sure you disconnect your Sonoff from mains voltage. Then, open the box enclosure.
Sonoff pinout
The Sonoff is meant to be hacked, and you can see clearly that these connections were left out, so that you can solder some pins and upload a custom firmware.
That’s the pinout.
I’ve soldered 4 header pins, so that I can easily connect and disconnect wire cables to my Sonoff device.
Preparing your 3.3V FTDI module
You need an FTDI module to upload a new firmware to your Sonoff. Use the schematics provided as a reference.
Warning: uploading a custom firmware is irreversible and you’ll no longer be able to use the app eWeLink.
I’ve added a toggle switch in the power line, so that I can easily turn the Sonoff on and off to flash a new firmware without having to unplug the FTDI module.
I used hot glue to glue the ends of the wires together. This prevents you to make wrong connections between the FTDI and the Sonoff in the future.
Boot your Sonoff in Flashing Mode
To flash a new firmware to your Sonoff, you have to boot your Sonoff in flashing mode. Follow this 4 step process:
1) Connect your 3.3V FTDI programmer to your computer
2) Hold down the Sonoff button
3) Toggle the switch to apply power to the Sonoff circuit
4) Then, you can release the Sonoff button
Now, your Sonoff should be in flashing mode and you can upload a new firmware.