Tasmota Sonoff and HA

Flashing a SONOFF (Espurna Firmware)

Tools needed to flash a Sonoff with the aspurna firmware.

ESPTool

Clone the Esptool repository. In a terminal window on the MAC do the following:

$ cd ~/Documents
$ git clone https://github.com/espressif/esptool.git

Setup ESPTool

To setup the ESPTool so that you can use it for programming, it is best to change the permission and install it as follows:

$ cd ~/Documents/esptool
$ sudo chmod +x *.py
$ sudo python setup.py install

Entering Programming Mode

Hold down the button on the Sonoff while you apply power, then release the button.

Connecting the Programmer

The pinouts on the Sonoff basic are shown here: SONOFF BASIC

The pinout of the herader (U4) in the middle of the board is (NOTE Pin 1 is closest to the push button):

  1. 3.3 v
  2. Rx
  3. Tx
  4. Ground
  5. GPIO14

Connection to the programmer header:

SonoffProgrammer
1 – Vcc4 – (Red)
2 – Rx3 – (Orange)
3 – Tx2 – (Yellow)
4 – GND
6 – (Black)

Backup the Existing Firmware

Put the Sonoff into programming mode then run the following command:

# esptool.py --port /dev/tty.usbserial-AH03B45L read_flash 0x00000 0x100000 sonoff-backup.bin

Erase the SONOFF Flash

# esptool.py --port /dev/tty.usbserial-AH03B45L erase_flash

Programming a New Firmware

Download the new firmware for our device to your local computer. Put the Sonoff into programming mode and enter the following (NOTE, the firmware file I downloaded is called espurna-1.14.1-itead-sonoff-basic.bin):

# esptool.py --port /dev/tty.usbserial-AH03B45L write_flash --flash_size 1M --flash_mode dout 0x00000 espurna-1.14.1-itead-sonoff-basic.bin

Leave a Comment

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