Shares

How to Flash a Custom Firmware to Sonoff

Shares

In this post, you’re going to learn how to flash custom firmware to the Sonoff device. I recommend that you read my previous post to get familiar with the Sonoff.

If you don’t have a Sonoff yet, you can get one for $5 on eBay: http://ebay.to/2eNzHf2.

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.

warning-m

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.

sonoff_gpio-r

I’ve soldered 4 header pins, so that I can easily connect and disconnect wire cables to my Sonoff device.

pins-soldered

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.

schematics-copy

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.

hot-glue-ftdi

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

hold-down-sonoff-button

3) Toggle the switch to apply power to the Sonoff circuit

apply-power-to-sonoff

4) Then, you can release the Sonoff button

Now, your Sonoff should be in flashing mode and you can upload a new firmware.

Sonoff tutorials list:

Wrapping up

That’s it for now, I hope you had fun learning about the Sonoff device. Make sure you subscribe to my blog, because I’ll be posting more tutorials about the Sonoff.

Do you have any questions? Leave a comment down below!

Thanks for reading,

Rui

Leave a Comment:

Add Your Reply