Sonoff Modification

There’s a company called ITEAD that manufactures a few devices in a line they call Sonoff. There’s a really inexpensive switch that’s ready to be modified to do whatever you want it to. It’s powered by an ESP8266 so it’s got WIFI and some left-over GPIO and thanks to a heavy duty relay it can switch mains power as well.

An awesome person on the internet developed some alternate firmware that can be flashed using the Arduino IDE and a FTDI adapter. The catch? You have to open up the device and do some light soldering.

Before doing anything if the Sonoff is connected to mains power, disconnect it. Then open up the Sonoff. It will look similar to this minus the 4-pin header.

There are 5 pins available on a break-out header but there’s nothing attached to them. In order from closest to the pushbutton to furthest you have

  1. 3.3V
  2. RX – Recieve
  3. TX – Transmit
  4. Ground
  5. GPIO14 – I don’t use this pin to do anything currently but may at some point in the future

Connect these pins to your FTDI adapter and make sure it’s configured to send 3.3V if it’s switchable. You’re ready to flash new firmware! Hold the button down on the Sonoff while plugging in your FTDI adapter.

You’ll need to configure Arduino IDE to allow flashing firmware to the ESP8266. All you’ll need to do download the firmware, update the sketch so that the device knows about your MQTT server and your Wi-Fi network, and flash it to the device.