This website uses 'cookies' to give you the best, most relevant experience. Using this website means you're happy with this. read more Accept & Close
Start Games
Do It Yourself
DIY & Home Improvement

SONOFF - ESP8266 update firmware with Arduino IDE

SONOFF - ESP8266 update firmware with Arduino IDE
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.
Note this operation will overwrite the original software, this guide is for people who want to use their own software.

Step 1: Components

Components for this project
Components for this project

Step 2: 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.
Select preferences
Select preferences
Enter <b>http://arduino.esp8266.com/stable/package_esp8266com_index.json</b> into <i>Additional Board Manager URLs</i> field. You can add multiple URLs, separating them with commas.
Enter http://arduino.esp8266.com/stable/package_esp8266com_index.json into Additional Board Manager URLs field. You can add multiple URLs, separating them with commas.
Open Boards Manager from Tools > Board menu
Open Boards Manager from Tools > Board menu
Install ESP8266 platform
Install ESP8266 platform
Select <i>generic ESP8266 module</i> board from Tools > Board menu
Select generic ESP8266 module board from Tools > Board menu
Change Flash Size: 1M (64K SPIFFS)
Change Flash Size: 1M (64K SPIFFS)
Our option settings in In the Arduino IDE should look like this:

Step 3: Connection of USB converter to ESP8266

PL2303 pin ESP8266 pin
GND GND
3.3v 3.3v
RX TX
TX RX

Step 4: 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: After 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() { Serial.begin(115200); Serial.println("START"); pinMode(LED_PIN, OUTPUT); } void loop() { digitalWrite(LED_PIN, HIGH); delay(1000); digitalWrite(LED_PIN, LOW); delay(1000); Serial.println("LED"); }
This is a common problem, if you happen to do it then try it once.
This is a common problem, if you happen to do it then try it once.
If everything goes well, the message will be as above and LED will be blinking.
If everything goes well, the message will be as above and LED will be blinking.