Sonoff iFan02 - RTurala/Sonoff-Tasmota GitHub Wiki

The Sonoff iFan02 is supported in Tasmota from version 6.0.0b

Serial Connection

Please see the Hardware Preparation page for general instructions.

Flashing using only a USB to serial converter will not work as the unit draws too much current as can be observed by a flashing blue led on the PCA and a lot of serial gibberish. As AC is not connected to Gnd I used the available power supply of the unit and connecting the USB to serial converter to J3 pins Gnd, Tx and Rx.

The button is not connected to GPIO00 so flashing the unit requires some extra work. I managed to flash the iFan02 by soldering a wire to TP16 (GPIO00) on the bottom of the PCA. Keep this wire connected to Gnd during the power-on or reset process (pressing the button) and the unit will be in firmware upgrade mode. If you've soldered the gpio0 connection don't forget to unsolder before booting normally.

If you have an Arduino you may be able to flash without providing an additional power source. I have successfully flashed using an Arduino Duemilanove with the atmel chip pulled out (basically using it for FTDI and 3.3v power regulation). Rx on Arduino goes to Rx on iFan02, Tx to Tx (no crossover like with FTDI). I did not have to press the button, only to ground TP16 while initiating the flash in Arduino IDE. The Arduino provides enough power to flash, however it will not boot into Tasmota unless you plug in to external power (it boot loops after flashing is complete).

More information


An easy way that I used for flashing was using a CP2102 USB to TTL(can't confirm if other ttl to usb works as well or not). Connect RX -> TX | 3.3 -> 3.3 | TX -> RX | GND -> GND and connect TP16 to GND (as used in the TTL).

Press hold the button while connecting to the computer. I flashed the tasmota bin file using ESP Flash tool, flashed successfully at first attempt.

Images https://drive.google.com/open?id=1wTlpXhFoSty7vdHFppUUrNNYyMt2x-HV https://drive.google.com/open?id=1owDW6DCnJHxNdx1VN6ohmqGqdKE73CQm


  • See issue #2839 for user information
  • See issue #3412 light on after restore power

Pictures

Functioning iFan02 Web Interface


iFan02 PCA with TP16

Two users report the TP16 pad lifting after soldering a wire to ground as shown in picture. This renders it useless. It may be better to use a pogo pin contact, bare wire or solder and then epoxy/glue the wire in place, leaving it permanently.


Board Top Showing ESP8285

UNSHIELDED Board Top Showing ESP8285

Pinout ESP8285

esp8285 PINOUT


Alternate Power Supply Schematic

esp8285 PINOUT

HomeAssistant MQTT Fan config

Credit to finity

- platform: mqtt  
    name: "Master Bedroom Fan"
    command_topic: "cmnd/sonoff_MBR_fan/FanSpeed"
    speed_command_topic: "cmnd/sonoff_MBR_fan/FanSpeed"    
    state_topic: "stat/sonoff_MBR_fan/RESULT"
    speed_state_topic: "stat/sonoff_MBR_fan/RESULT"
    state_value_template: >
      {% if value_json.FanSpeed is defined %}
        {% if value_json.FanSpeed == 0 -%}0{%- elif value_json.FanSpeed > 0 -%}4{%- endif %}
      {% else %}
        {% if states.fan.master_bedroom_fan.state == 'off' -%}0{%- elif states.fan.master_bedroom_fan.state == 'on' -%}4{%- endif %}
      {% endif %}
    speed_value_template: "{{ value_json.FanSpeed }}"
    availability_topic: tele/sonoff_MBR_fan/LWT
    payload_off: "0"
    payload_on: "4"
    payload_low_speed: "1"
    payload_medium_speed: "2"
    payload_high_speed: "3"
    payload_available: Online
    payload_not_available: Offline
    speeds:
      - off
      - low
      - medium
      - high

Using hard wired push button switch attached to iFan02 GPIO to cycle speeds

If anyone wants to setup a single push button switch attached to the GPIO3 Serial + ground In that will cycle through the speeds and turn off - after setting it in the configuration (GPIO3 to 11 Switch3) the console code is:

rule1 on switch3#state do FanSpeed + endon