How to flash Tasmota on a Sonoff R2 device

Albert De La Fuente Vigliotti

How to flash Tasmota on a Sonoff R2 Device #

Upgrade firmware to the latest version #

  • Install the Ewelink app
  • Update the firmware to the latest version

Cable pin connections (male) on the Sonoff device #

On the back connect the cables as:

black - gnd white - tx gray - rx purple - vcc

Cable pin connections (female) on the FTDI-USB device #

On the FTDI device connect the cables as

black - gnd white - RX (inverted) gray - TX (inverted) purple - vcc

Step 1: Ensure the connection is working properly #

  pipenv --three
  pipenv install esptool
  pipenv shell
  sudo dmesg | ag -Ui tty

Press the button while connecting the USB cable

  sudo esptool.py --port /dev/ttyUSB0 flash_id

Step 2: Backup the current firmware image #

Press the button while connecting the USB cable

  sudo esptool.py --port /dev/ttyUSB0 read_flash 0x00000 0x100000 version-3.5.0.bin

Step 3: Erase the flash memory #

Press the button while connecting the USB cable

  sudo esptool.py --port /dev/ttyUSB0 erase_flash

Step 4: Upload the Tasmota firmware #

Press the button while connecting the USB cable

  sudo esptool.py --port /dev/ttyUSB0 write_flash -fs 1MB -fm dout 0x0 tasmota.bin

Step 5: Configure the wireless access #

  • Restart the device
  • Connect to the “tasmota-X” network AP
  • Browse to 192.168.4.1
  • Scan networks and type password

Resources #

Flashing Tasmota on Sonoff Basic R2 using Linux - One Guy, One Blog #

Getting MicroPython on a Sonoff Smart Switch | by Cloud4RPi Team | Cloud4RPi | Medium #