Sonoff - Flashing Tasmota firmware

Prepare Arduino IDE

Download, install and launch PlatformIO IDE for Atom
https://platformio.org/install/ide?install=atom

Click on File / Settings

In the Settings window click on +Install and in the search field search for platformio. Install platformio-ide

If you see a popup about missing Clang package, click on Disable Code Completion

Prepare Tasmota Firmware

Clone or download the tasmota git (I've taken a copy here) and extract the zip file.

https://github.com/arendst/Sonoff-Tasmota

Open Atom and wait a few seconds for the PlatformIO tab to appear. Select Open Project.

Change to extracted zip folder and click on Open
On the left side select user_config.h file
For visibility close all the other tabs.

Insert your WiFi credentials under STA_SSID1 and STA_PASS1

If you haven't setup your MQTT broker yet I recommend to disable MQTT (MQTT_USE = 0) because the constant try to establish a connection might slow down your Sonoff switch from operating (I've experience this with Sonoff touch). Otherwise make your changes for MQTT_HOST, MQTT_PORT, MQTT_USER and MQTT_PASS

Search for PROJECT, change the "device name" (as this will be used as MQTT topic) and SAVE the file.

Flash

Set your FTDI programmer to 3.3V (very important!)

Plugin your FTDI Programmer and check the COM Port in Windows device manager (here COM3)

Then unplug it again.

In Atom open platformio.ini and change upload_port accordingly.

While USB is UNPLUGGED, connect the cables as shown in the picture.
It's expected that RX is connected to TX and vice versa!

Enable flash mode by holding down the pairing button while you plug-in your USB cable.
For Sonoff Touch you will need to connect two points on the board (see previous picture).

In Atom open PlatformIO and click on Upload

Final configuration

Connect to your Tasmota web interface (lucky you if your router is able to list devices and their ip addresses).
Browse to Configuration / Configure Module and choose your correct model.
Then click on SAVE.