Flashing - FengtianGu/Sonoff-Tasmota GitHub Wiki

If you have followed Hardware preparation your device is in Flash Mode and ready to be flashed with Tasmota and for that you need a flashing tool.

Jump here if you want to compile your own version of Tasmota.

NodeMCU PyFlasher

NodeMCU PyFlasher is an easy to use GUI flasher based on esptool.py and is our recommended tool for a quick and easy flash.

Download the latest release for your platform (Windows or Mac). Double click the downloaded file and it'll start, no installation required.

NodeMCU PyFlasher Screenshot

  1. Select Serial port (COM# port) where your serial-to-USB or NodeMCU/D1 mini is connected. Leave on auto-select if not sure.
  2. Browse to the binary you downloaded from Tasmota GitHub releases.
  3. Set Baud rade to 115200 and Flash mode to DOUT. Erase flash to yes if it is the first time flashing Tasmota on the device or you're experiencing issues with existing flash. If you're upgrading Tasmota set to no.
  4. Click Flash NodeMCU (Slightly misleading, I know!) and watch the progress in console.

If the flash was successful the console will display:

Flash succeeded

Unplug your adapter or device and plug it back in or connect to another power source. Your device is now ready for Initial configuration.

Common mistakes

Message COM# failed to connect: Failed to connect to Espressif device: Timed out waiting for packet header means your device is not connected (recheck COM port number and USB cable) or not in flash mode (retry flash mode procedure for your device).

Esptool.py

Esptool is the official tool for flashing ESP8266 chips and is the most reliable.

It requires Python, if you do not have an installed copy of Python 2.x or 3.x download and install it from https://www.python.org.

Download Esptool Source code from https://github.com/espressif/esptool/releases to a folder of your choice. Go to the folder and install Esptool with command

python setup.py install

Esptool for Debian and Ubuntu is installed with

sudo apt install esptool

Upload Tasmota

Make sure you followed the steps to put your device in flash mode. Download the latest Tasmota binary (sonoff.bin) in the same folder as Esptool.py.

Esptool uses the serial interface to communicate with your device. On Windows these interfaces are named COM1, COM2, etc. and on Linux they are named /dev/ttyUSB0, /dev/ttyUSB1, etc. Before using Esptool make sure you know which serial interface your device is connected to.

In the following commands I use COM5 as an example. Change COM5 with your port designation.

Ensure the device is in flash mode before each step.

Optional: Backup firmware

Backup the current firmware with the following command:

esptool.py --port COM5 read_flash 0x00000 0x100000 fwbackup.bin

When the command completes the device is not in flash mode anymore.

Erase firmware

Erase the complete flash memory holding the firmware with the following command:

esptool.py --port COM5 erase_flash

It only takes a few seconds to erase 1M of flash.

When the command completes the device is not in flash mode anymore.

Upload firmware

Load the downloaded Tasmota firmware file sonoff.bin with the following command:

esptool.py --port COM5 write_flash -fs 1MB -fm dout 0x0 sonoff.bin

When the command completes the device is not in flash mode anymore.

For proper device initialization after the firmware upload power down and power up the device.

Esptool executable

The executable version of esptool is maintained by Ivan Grokhotkov and releases are kept at https://github.com/igrr/esptool-ck/releases. Supports Linux, Linux ARM, Windows 32bit and Mac

Download and install

For the purpose of simplicity only the Windows version will be explained here, but the commands and parameters are the same for Windows, Linux and Mac.

Download the latest release of Esptool-CK and extract the compressed file to a folder of your choice.

Upload Tasmota

Download the Tasmota firmware file sonoff.bin to the same folder as Esptool-CK to simplify the process.

In the following commands I use COM5 as an example. Change COM5 with your port designation.

Ensure the device is in flash mode before each step.

Erase the existing flash

esptool -cp COM5 -cb 115200 -ce -v

Once the erase is complete, put device back into flash mode and upload the firmware

esptool -cp COM5 -cb 115200 -bm dout -cf sonoff.bin -v

Flashing and compiling from source

Tutorials for setting up development environments if you want to modify the code or default settings and compile your own binaries.

  • PlatformIO - setup and configure PlatformIO for Tasmota compilation and upload
  • PlatformIO CLI - how to flash Tasmota using the PlatformIO command line interface on Linux
  • PlatformIO-Core - automate firmware builds using PlatformIO-Core and flash with esptool
  • Arduino IDE - setup and configure Arduino IDE for Tasmota compilation and upload
  • Visual Studio Code - setup and configure Visual Studio Code with PlatformIO for Tasmota
  • Gitpod - compile your own binary in the cloud using Gitpod.
    Can only create a firmware binary. Use one of the tools listed to flash it to your device.
  • TasmotaCompiler - simple web GUI to compile Tasmota with your own settings

OTA Flashing Tools

Tasmota is NOT a developer of these tools. For help and troubleshooting you will need to get support from those projects.

Need more help?

If you have encountered problems during flash see Troubleshooting. Ask for help in Discord or Community Forum

Tasmota is flashed and your device and ready for Initial Configuration.