Installation - Lehmancreations/Sonoff-With-MQTT GitHub Wiki

How to Install

First make sure that your sonoff is flashable! Meaning make sure that you have your headers soldered in and that you have an FTDI adapter (or have flashed it before and have the OTA on your current sketch)

Second set your settings to the following in the arduino IDE

IDE Settings (Please make sure to use the 2.4.0 esp boards (new ver not working yet))

Board: Generic ESP8266 (you have to have already added the ESP boards to the board manager. The url is http://arduino.esp8266.com/stable/package_esp8266com_index.json)

Flash: DOUT (I had to use this setting or it did not work for me)

Flash Size: 1M (64K SPIFFS)

Debug Port: Disabled

Debug Level: None

IwIP variant: v2 prebuilt

Reset Method: ck

Crystal Frequency: 26

Flash Frequency: 40

CPU Frequency: 80

Upload Speed: 115200

Port: What ever port you are using

Third Flash the device (you will need to hold the button down when giving power if using FTDI cable)

Fourth Boot device. Your device will first try and connect to any saved wifi it has if it fails it will go into AP mode and you should look on your laptop for a wifi network named the same name as your device. Join it and go to a website(since this is captive portal style it should take you to the correct page when you try to go to any other). Once on the page fill out your wifi and your MQTT information. The device will boot up and join the network.

NOTE When booting the LED will flash slow when trying to join a saved network and then if it cant it will blink faster to note to you that it is now in AP mode.

Pinout

If you need to flash with FTDI the pinout is as follows with the yellow strip and LED facing you (led will be on your right yellow thing on the left). To put the sonoff into program mode you need to hold the button down when there is not power supplied to vcc and then put power on vcc and then you can let up on the button. At this point the sonoff is ready to flash.

FARTHEST FROM YOU

GPIO 14

GND

TX

RX

VCC (3.3)

CLOSEST TO YOU