Introduction: SONOFF - ESP8266 Update Firmware With Arduino IDE

Picture of SONOFF - ESP8266 Update Firmware With Arduino IDE

This is a guide how to upload new firmware using Arduino IDE. Sonoff is a ESP8266 based WiFi wireless switch that can connect to appliance of different types and brands. This is a smart switch to control any device on 110v and 230v.

See this project here: SONOFF - ESP8266 update firmware with Arduino IDE

Step 1: Components

Picture of Components
  • SONOFF - WiFi Wireless Smart Switch
  • PL2303 - USB to UART Converter
  • USB cable
  • Several wires
  • Switch

Step 2: Arduino IDE Setup

Picture of Arduino IDE Setup

At the beginning we need the Arduino IDE, If you do not have it then you can download from this site Arduino IDE download To be able to program ESP8266 in the Arduino environment, we need to install the additional platform ESP8266 to the Arduino environment.

Our option settings in In the Arduino IDE should look like this:

  • Flash Mode: DIO
  • Flash Frequency: 40MHz
  • Upload Using: Serial
  • CPU Frequency: 80MHz
  • Flash Size: 1M (64K SPIFFS)
  • Debug Port: Disabled
  • Debug Level: None
  • Reset Method: ck
  • Upload Speed: 115200
  • Port: Your COM port connected to sonoff

Step 3: Connection of USB Converter to ESP8266

Picture of Connection of USB Converter to ESP8266

PL2303 pinESP8266 pin

Step 4: Flashing a Custom Firmware to SONOFF

Picture of Flashing a Custom Firmware to SONOFF

Do not connect AC power during the flash cable connection.
To flash the new software to our SONOFF, we have to start Sonoff in flash mode. Follow this steps process:Connection of USB converter to SONOFFHold down the SONOFF buttonToggle the switch to apply power to the Sonoff circuitThen, we can release the SONOFF buttonAfter SONOFF is in flash mode, we can upload new software.This program is very simple, so it is great for first flashing.

#define LED_PIN 13

void setup() {




void loop() {

digitalWrite(LED_PIN, HIGH);


digitalWrite(LED_PIN, LOW);




ESP8266 and multiple temperature sensors DS18b20 with HTTP server


roboskalicky (author)2017-10-16


My Sonoff I can programing when I select ESP8285 too, but MC on board is ESP8266.

Bandenabos (author)2017-09-02


I got 'new' version of sonoff basic and got the same flashing problem. I try to use this method but it doesn't work for me, I think I forgot something.

Juste a question, how do you put the sonoff flashing mode (power on +3.3 while pushing button ?) ?

thank you

PS : just a difference with you, I havn't got a 2303 usb (I got but driver problem on Win 10) and I try flashing with arduino nano ... Perhaps it's the problem.

Roggbo (author)Bandenabos2017-10-10

on the elecrrodragon v1.5 I had to power + 5v!

spz101 (author)2017-10-09

Thank you very much. Selecting ESP8285 worked perfect.

AlessandroG2 (author)2017-07-19


followed this instruction, Arduino IDE says [100% ] uploaded, so I have disconnected my board from FTDI and PC and connected it to AC...but nothing happens, no led blinking; same thing with 2 different board; what i'm missing? can you help?

EmanueleF (author)AlessandroG22017-08-16

me too....with the last 2 board receved on 2017.08.17, previously board receved at may works fine...

AlessandroG2 (author)EmanueleF2017-08-16

right today I was finally able to flash and have it works using as board esp8285 instead of esp8266 or the Arduino IDE. Try if it works also for you

TonyK70 (author)AlessandroG22017-08-31

Hello, How did you manage to add the ESP8285 board to the IDE's board manager ? Thanks for your help !

AlessandroG2 made it! (author)TonyK702017-08-31

File - Preferences and ad the link as in the picture

TonyK70 (author)AlessandroG22017-09-01

Needed to also manually delete an Arduino esp8266/hardware folder first since there were 2different versions installed . Upgraded the Arduino IDE to the latest version, upgraded the libraries and now I indeed have the option Generic ESP8285 ! Thanks a lot Allessandro !!!

AlessandroG2 (author)TonyK702017-09-01

you're welcome

EmanueleF (author)AlessandroG22017-08-16

me too arrived to the same solution 5 minutes ago...

EmanueleF (author)EmanueleF2017-08-31

with the latest sonoff you have to set flash mode to "DOUT".

About This Instructable




Bio: Software, electronics, do-it-yourself
More by adachsoft:DIY USB Charger for Your Phone - LM2596DIY WIFI RC Car With ESP8266 and Arduino IDEControl Any Devices Using Raspberry PI and PCF8574, Relay Module
Add instructable to: