How to flash Tasmota on Sonoff RF (H/W #R2 Ver 1.0)

Gopikrishnan Naranathu Sivaprasad
3 min readJun 10, 2022

I wanted a Tasker (https://tasker.joaoapps.com/) controlled automatic charger for my unattended android device. I want the device to charge itself when the battery level goes below a per cent. (Also, turn off the charger when it returns to a particular power level.)

I already have the Android device setup — A rooted Oneplus 5T running lineage OS with tasker as Superuser (not needed, But since it is going to be an unattended device, I needed complete device control.) The last part is the charging setup for this unattended device.

I had a SONOFF WiFi switch with an RF chip. I purchased it on Aliexpress a few years ago. The device was almost perfect. However, there is no useable API I could find for this device’s in-built firmware, which is essential for my project. That is where Tasmota is going to help me!

Below are the steps I followed for flashing Tasmota to the particular hardware revision I had — R2, Ver 1.0. However, it might just work fine for other circuit board designs in this series, but I haven’t tried it since I have no such hardware lying around.

To do the flashing, we will need a USB to TTL programmer. I got this CH340 programmer: https://robu.in/product/usb-rs232-pl2303-ttl-converter-adapter-aurdino-nano-raspberry-pi/. CAUTION (Make sure it has a 3V output. Many I found on Amazon had a 5V output, which will destroy the circuit.)

I followed this reference:https://tasmota.github.io/docs/devices/Sonoff-RF/#serial-flashing. I will capture the core of it below.:

Preparation

  1. First off, we need to short the R1 and GND pins (On the RF Hat attachment mounted on top of the ESP 82XX chip.) To get the ESP in programming mode. The vestiges of this jumper wire job is visible here (2 black wires protruding out. It was a single piece, I had cut them after the flashing):
  1. Make sure you connected the TX pin of TTL programmer to the RX pin of ESP device. And likewise the RX → TX.
  2. Double-check using a multimeter that the VCC (Red wire which is the power wire) is indeed at 3V and not 5V!

3. Get the ESP connector pins neatly soldered, if possible with colour-coded male-female pin connectors. I cut the wire off, after the flashing to get it fixed into the enclosure. However, I left a smaller portion there, just in case to re-solder the connectors later.

Red: +3V, Black: GND, White: RX, Green: TX; Remember TX-RX is inverted at the other end (USB programmer)

4. Connect all wires to the TTL programmer.

Source : https://robu.in/product/usb-rs232-pl2303-ttl-converter-adapter-aurdino-nano-raspberry-pi/

5. Go to the Tasmota web installer: https://tasmota.github.io/install/

Note: I tried the Python versions, but for some reason I can’t get the dependencies downloaded with PIP. (Both the wheels and cloning the repo and later installing dependencies using requirements.txt.) So if that works for you I would recommend trying that preferably. It seems to have a neet PyQT-based GUI too!

6. Click connect.

7. Select 8226 Chip, Click Install!

8. IMPORTANT — Remove/Cut off the jumper connections set up in Step 1.

HTTP API for Toggling the switch:

GET/POST → http://<switch-IP>/cm?cmnd=POWER+TOGGLE

Note 1: I configured a static IP for the switch.

Note 2: I faced some issue with the MQTT broker connection, so I ditched it for the HTTP API. Anyway, the HTTP API looks much simpler.

My setup:

--

--