Recipes Smarthome

Smarthome | Apr 22, 2020

How to flash Sonoff devices using Arduino UNO

Arduino UNO can be used to install a custom firmware on a Sonoff device when a FTDI converter is not available.

Warning: Sonoff devices are not toys. They do operate in AC high voltage. Do not connect Sonoff devices to AC current during the flashing.

What is Arduino UNO?

Arduino UNO is one of the most commonly available Arduino type of a programming board which is cheap and very easy to find in anywhere in the world. In this case, for flashing Sonoff devices with a custom firmware, an Arduino board can be configured to work as a FTDI converter in case a real 3.3V FTDI converter is not available.

What are Sonoff devices?

Sonoff is brand name of a Chinese IOT device manufacturer ITEAD. Sonoff devices are small ligh-weight, cheap and durable IOT devices mostly using ESP8266 chip with in-built Wi-Fi. They can be connected to AC (110V – 240V) out of the box and very reliable. Sonoff devices come with a pre-installed firmware by ITEAD which helps to connect to eWeLink (free cloud service maintained by ITEAD for Sonoff devices to control remotely). In most cases Sonoff users flash this firmware with a custom firmware (Ex: Tasmota) to gain more features, control and security.

What Sonoff devices can be flashed with Arduno UNO?

Remember that Arduino UNO have both 3.3V and 5V GPIOs. But the outputs are 5V. Therefore, during the flashing the RX and TX will operate in 5V. Therefore do not try to flash any kind of 3.3V ESP8266 device using Arduino UNO. It will blow up the ESP8266 due to high voltage. This method can be used only with certain type of Sonoff devices with very specific configurations. Below type of Sonoff devices have been tested successfully with Arduino UNO for flashing the custom firmware without any issue.

  • Sonoff Basic R2
  • Sonoff RF R2
  • Sonoff Dual
  • Sonoff TH10
  • Sonoff POW R2
  • Sonoff 4CH
  • Sonoff RF Bridge
  • Sonoff T1

Do not try to flash new rage of Sonoff DIY devices using this method (for example Sonoff Mini should not be flashed using this method. It will blowup the chip on Sonoff). Other R3 devices are not yet tested with this method.

Connecting Sonoff to Arduino UNO

Wiring diagram for connecting Arduino UNO board to Sonoff
Wire diagram for connecting Sonoff to Arduino UNO

Do not connect the Sonoff to AC current during the flashing! This will blow up your computer, Arduino and also will kill you.

First connect RESET pin to GND on Arduino Board.
Connect 3.3V on Arduino to 3V3 on Sonoff.
Connect GND to GND on Arduino and Sonoff.
Connect TX to TX and RX to RX of the two boards

Before connecting the Arduino board to PC, make sure GPIO0 of Sonoff is connected to GND. This is required to put the Sonoff to flashing mode. In most cases, this can be archived by press and holding the button on Sonoff board when connecting to PC. Therefore, simply press and hold the button on Sonoff board and then connect the Arduino board to PC to get the Sonoff to flashing mode.

Connecting RESET pin to GND on Arduino board deactivates the Atmel chip. Therefore, there is no need to upload any sketch to Arduino to perform this task. In this case it is only the circuit on Arduino board is used and Atmel chip is not used at all.

Once the Arduino UNO board is connected to PC the flashing can be started. RX and TX indicators on Arduino board will start to blink during the successful flashing process.

Flashing Sonoff with Custom Firmware

Most popular custom firmware for Sonoff or ESP8266 based board are Tasmota, ESPurna and ESPEasy. Please download the firmware file from the respective website. In this guide Tasmota will be used. Tasmota is a widely used MQTT compatible firmware with many additional features than eWeLink.

Flashing Sonoff with Tasmtoa


  1. Tasmota binary file – download tasmota.bin from Github
  2. ESP Easy Mega – download from Github and unzip to a folder in PC
  3. Termite – download and install from compuphase.com

Install Tasmota

Press and hold the button (or connect GPIO0 to GND in a different way on Sonoff board), then connect the Arduino board to PC via USB. Release the button after few seconds of connecting to PC.

In ESPEasy-mega find FlashESP8266.exe in dist folder. Open the application. Now copy the tasmota.bin file to the same folder as FlashESP8266.exe

ESPEasy Flasher

Select the COM Port and the tasmota.bin file and click Flash. After successful flashing, remove and reconnect the USB cable to PC to restart the Sonoff.

Now open Termite.


First setup the Wi-Fi configuration. Enter your Wi-Fi SSID as below to termite command line and press enter.

ssid1 <your Wi-Fi SSID>

Then set the password for your Wi-Fi SSID

password1 <Wi-Fi password>

Sonoff will restart and connect to your Wi-Fi network and the IP address will be displayed on Termite console screen.

Enter the IP Address on your browser to connect to your new Sonoff with Tasmota firmware.

Sonoff Tasmota home screen
Tasmota Home screen

Now select Configuration, Configure Module and select the correct Module Type.

Then remove the USB and the Sonoff is now ready to be connected to AC current!

2 responses to “How to flash Sonoff devices using Arduino UNO”

  1. Mayank kushwaha says:

    i want to upload my code so is there is any way to upload code in sonoff with arduino uno

  2. Fun Maker says:

    Yes you can. First, you need to compile it. Can use Arduino IDE for that. Sonoff is ESP8266.

Leave a Reply

Your email address will not be published. Required fields are marked *