# Flashing Tasmota on Sonoff S31 Lite Smart Plug

## What is Tasmota?

> [Tasmota is an] alternative firmware for ESP8266/ESP32 based devices with easy configuration using webUI, OTA updates, automation using timers or rules, expandability and entirely local control over MQTT, HTTP, Serial or KNX. -https://github.com/tasmota/install

## Things You Will Need

- Sonoff S31 Smart Plug(s) https://amzn.to/38l6jes
- CP2102 Serial to USB adapter https://amzn.to/3uPgBeg
- Minigrabber Probe Test Leads (Optional, but removes the need to solder) https://amzn.to/3iWdcVC

## Preparation

1. Download Tasmotizer Download
2. Download CP2102 Windows drivers Download
3. Extract the downloaded CP2102 zip
4. Plug the CP2102 USB adapter into an available USB port
5. Right click the Start button > Device Manager
6. Expand Other devices and locate the CP2102 > Right click on it > Update driver
7. Select Browse my computer for drivers
8. Click the Browse... button > Browse to and select the extracted CP2102 driver files
9. Check the Include subfolders box > Click Next
10. Wait while the driver is installed
11. Take note of the COM port assigned to the CP2102 adapter
12. CRUCIAL STEP: Unplug the CP2102 USB adapter

## Disassembly and Wiring

1. Disassemble the Sonoff S31 plug by gently prying the gray end cap/power button with a spudger and sliding the two rounded plastic pieces off to reveal 3 screws
2. Remove the 3 screws and flip the S31's PCB over
3. Using the minigrabber probes (or by soldering wires from the S31's PCB to the CP2102 USB adapter, make the connections shown below
   The CP2102 adapter should NOT be plugged in at this point

   CP2102 USB | TXD |  | RX | S31 PCB
   RXD |  | TX
   GND |  | GND
   3V3 |  | VCC

4. After verifying the connections 3 times, hold down the button the S31 PCB and plug the CP2102 adapter into an available USB port on the PC
5. Continue holding the button on the S31 PCB for approximately 5 seconds to boot the plug into programming/flashing mode

## Flashing Tasmota

1. Launch the Tasmotizer .exe
2. Set the Select port field to the COM port of the CP2102 USB adapter
3. For the first S31 device, check the Save original firmware box and set the Flash size to 4MB
4. Select Release under image to have Tasmotizer download the latest release of Tasmota
5. Verify Erase before flashing is checked
6. Click the Tasmotize! button
7. Wait while Tasmotizer backs up the stock S31 firmware
8. When prompted, power cycle the plug by unplugging the CP2102 USB adapter from the PC, holding down the button on the S31 PCB and plugging the CP2102 USB adapter back into the PC
9. Continue holding the button on the S31 PCB for approximately 5 seconds to boot the plug into programming/flashing mode
10. Click OK on the Tasmotizer dialog to continue with the flashing process
11. Wait until Tasmotizer has completed the flash and prompts to restart the device
12. Unplug the CP2102 USB adapter from the PC and plug it back in, this time without holding the button the S31 PCB

## Connecting to Wifi and Configuration

1. From a wifi enabled device (ie laptop/smart phone), look at the available wifi networks and connect to the tasmota- SSID
2. Open a web browser and navigate to 192.168.4.1
3. Enter the Wireless network SSID and password > Click Save
4. The S31 will attempt to connect to the Wireless network and upon connection will redirect to the new IP address
5. Welcome to Tasmota on the Sonoff S31 smart plug
6. Select Configuration > Configure Module > Set the module to Sonoff S31 > Click Save
7. Back on the Configuration menu, click Configure Other > Set the device Name and Friendly Name > Save

Further reading: https://tasmota.github.io/docs/devices/Sonoff-S31/