Riproset an ITEAD Sonoff TH-16 / TH-10 using firmware Tasmota

9 minutes of reading
  • riprofirmware grammation
Software components used:
Physical devices used:

All environments

Notes and disclaimer
  • qualsiasi eventuale modifica agli impianti domestici dev'essere progettata ed realizzata SOLO da personale qualificato;
  • any changes implemented in probefore is a propersonal responsibility as well as a profirst risk and danger (the contents of the present page are purely educational);
  • any changes implemented in proprior to a device it voids the guarantee, quality approvals and certifications.
Driving review: 1.1

ATTENTION: this guide it is more than enough for the purpose of reprocalculate the component; in the event of proproblems, refer to the broader and more structured MasterGuide dedicated to the reprogrammation of devices based on ESP8266, in which many more concepts and techniques are explained.


Each electronic device contains broad lines a small piece of softwareCalled firmware, which determines its functions and behavior. Our car is equipped with firmware; it has one, the washing machine, our remote control, even a modern clock radio. The Sonoff TH-16 (or TH-10, in the version that supports less electrical load) it makes no difference; the point is that the original firmware has some inherent limitations: allows this intelligent sensor / switch to work only via the internet connection to the site proproducer, cannot be natively integrated on the most common HUB personal, does not support prothird parties. They help us the two proOpen Source jets, respectively called Tasmota e Espurna, which provide us with alternative firmware which, once installed on the device, allow it to expand its functionality. On this page we will focus on the installation of Tasmota. To do this you need a computer, a connection device between the computer and the computer Sonoff (Called USB / TTL adapter) and a computer software (called ATOM) to perform the proprocedure.

Riproset an ITEAD Sonoff it is generally a great idea: the fact that the same proves it propublisher publish on profirst blog articles about it. The riproming disconnects the devices from the constraint of being usable in the presence of the internet connection (to the cloud of theapp eWeLink), in addition to extending compatibility and functionality to extraordinary tools such as HUB personal.

That said, i Sonoff generally used devices are also valid as they arrive profactory settings. Simply, they don't do some things and, above all, they can't be integrated with our loved ones HUB personal.

This guide is dedicated to the reprogrammation of Sonoff TH-16 / 10-TH, but it is applicabile in the exact same way to all the other devices in his family ITEAD Sonoff Smart Home: the only difference lies in finding, in each device, the four contacts on which to interface for firmware upload.

Sonoff TH-16 e Sonoff TH-10 are two smart switches with additional function (via external probe) of thermometers and hygrometers; these are basically two devices identical, the only difference is that the TH016 is able to support up to 3,5kw of loading while the TH-10 "only" 2,2kw.

We have dedicated un FOCUS on the subject of control post-riproming.

ITEAD Sonoff BasicATTENZIONE: remember that there is on our FORUM community an ad hoc section dedicated to Sonoff (and more generally to devices ESP8266), for any doubt, question, information on the specific merit of these components.
There is a lot of talk about it chatting.


  1. Description prosubsidence
  2. Installation and configuration ATOM & PlatformIO
  3. Checking the COM port assigned by the computer
  4. Firmware download and configuration on PlatformIO Tasmota
  5. Connection of Sonoff in flash mode
  6. Upload the firmware to the device Sonoff
  7. How to update OTA (over the air) a Sonoff
  8. Conclusions

1. Description prosubsidence

To reprogrammare a Sonoff it is necessary, first of all, to install and configure ATOM, after which:

  • download the firmware Tasmota;
  • connect (not in flash mode) the Sonoff toUSB / TTL adapter and, opening the "Serial Monitor" find out which COM port is automatically assigned, then disconnect the Sonoff;
  • configuration the two configuration files, "platformio.ini" and "user_config.h";
  • carry out compiling or performing the "Build" (in case of errors, correct and re-compile themprovare);
  • connect il Sonoff to the USB / TTL adapter in flash mode;
  • carry out the Update Searchnamento, or "Upload".

Let us now go into detail.

2. ATOM installation and configuration

Download and install the software ATOM at this link: This software is available free of charge for all major platforms (Apple, Windows and Linux). Once installed, it must be configured by installing the additional package called "platformhyoid"
To do this, go to:

  • Mac OS X, Menu : To Tom > Preferences > install
  • Windows, Menu : File > Settings > install
  • Linux, Menu : Edit > Preferences > install

and in the search hole search, appanointed, "platformhyoid". Once you have found the package, click on Install.

scroll to thank
Nb The installation of Atom + platform-io may include the installation of additional add-on packages, such as Python. Should the installer ask for these additions, prov to meet your request (under penalty of failure to functionnamenext part of the tool).

After installation, close and reopen ATOM, which at this point will start the PlatformIO package by default, necessary for riprogrammare the Sonoff. The software prowill be able to install a series of additional packages completely automatically.

At the end, PlatformIO will ask to restart for one last time ATOM.
(Ed. From here on we will refer directly to PlatformIO, meaning it as ATOM + PlatformIO.)

3. Checking the COM port assigned by the computer

An adapter USB / TTL (FTDI) it is a simple device that allows us to put in communication our computer and the heart of the device Sonoff. To do this, it is first necessary to "undress" the Sonoff removing the white plastic shell that it protegge. This done, the device appare as follows:

naked Sonoff TH-16 TH-10

The adapter, which can vary in shape and colors, has a USB port and four contacts as standard which go contacted with those present on the board of Sonoff using gods Dupont connection cables.

The contacts VCC and Ground dell 'USB / TTL (FTDI) they must be connected to the same contact points of the board, while TX e RX they must be cross-connected (TX with RX and RX with TX).

CAUTION: if the adapter has a choice between the 5v and 3.3v voltages, choose always 3.3v. An adapter that only delivers 5v, is not suitable.

an example.



It is usually used to weld on the board of Sonoff of the pins so to make the connection to the FTDI easy, but it is enough place simple contact pins to get the same result - see image above.

A further, last alternative without welding is that of "fresh laundry", available here.
Other connection techniques can be read here.

Connect therefore the module Sonoff to the USB / TTL adapter and it, in turn, to a USB port on the computer via the cable.
Then select the menu item "PlatformIO> Serial Monitor". A fi will opennestlike the following:

After a moment, in the entry "Port (The Harbour District)”Will indicate which COM port the computer has assigned to the USB / TTL module.
Take note of it.
Now disconnect the module from the USB port.

NOTE for users Apple: Atom, su macOS, could identify a different port from the classic COMx. To understand how to configure the door in this series, refer to to this thread. Beyond what is expressed in the link, always remember to install the correct driver for Mac of profirst USB / TLL adapter.

After installing the correct driver, in the system report of the Mac, under USB, you will need to (by connecting the USB / TTL adapter) a voice as follows:

FT232R on Mac

4. Firmware download and configuration on PlatformIO Tasmota

At this point it should be downloaded the latest firmware version Tasmota.
Once downloaded, unzip the .zip file where you prefer.

Now, in the PlatformIO menu, select "Fillet > add Project Folder"And then select the folder where the zip file mentioned above has previously been unzipped.

By doing so, PlatformIO will open the projet Tasmota.

At this point it is necessary to "configure" the software package. In fact it is provided "basic", without customizations, which are necessary so that, at the end of the programmation, the Sonoff can operate correctly.

Specifically, the proprocess is the following:

  • choose which firmware component Tasmota fill in;
  • indicate the name and password of the Wifi in which the Sonoff will have to "enter" automatically once againproprogrammed;
  • indicate the COM port to be used for data transmission;
  • compile the firmware;
  • write it on the device.

To choose which part of the firmware to compile, open the file on PlatformIOplatformio.ini"And make sure it is configured only"default_envs = tasmota”As in the image:

To Tom -

The items commented below identify the alternatives, namely the compilation or a minimal part of the firmware (“default_envs = tasmota-minimal") Or full language versions ("default_envs = tasmota-E"Is the Italian one), or the standard one (appanointed, as suggested above, "default_envs = tasmota“).

Search for the item "upload_port =") And enter the previously identified COM as a value to the previous step.

Once completed, save and close the file.

Now you need to configure name and password of our Wifi.

Open the file "tasmota/my_user_config.h"And find the variables:"#define STA_SSID1" is "#define STA_PASS1"

Atom - user_config.h

Enter the name there was originally the proman Wi-fi and the related password. Save and close the file.

Now we are proto "compile" our firmware package. Click on the menu "PlatformIO> Build"
If the procedura will be successful, you should get a screen similar to this:

scroll to zoom

The package is completed e proto be sent to the device.

Nb. the action of compiling ("Build") the firmware Tasmota translates into the creation of a file ("firmware.bin") At the route"% directorycontenentetasmota/.pioenvs/tasmota". This information is useful when you want to do the next onenamento OTA (Over-The-Air), which asks to indicate the file "firmware.bin" of the new version of the signature that has been previously compiled.

A dedicated guide is available here all'aggiornameof the massive Sonoff-Tasmota with a single centralized operation, via TasmoAdmin.

5. Connection of Sonoff in flash mode

To activate the Sonoff in flash mode (or proto receive the new firmware) procedura is the following:

  • connect the Sonoff to the USB / TTL module (as explained before);
  • press and hold the gpio0 button (“Program button ”) as in the scheme above;
  • connect the cable to the computer's USB port;
  • release the gpio0 button.

At this point (e alone at this point, if you have done everything right), the Sonoff Sara proto receive our firmware package Tasmota previously configured and compiled.

If the upload (prossimo paragraph) failed, riprovate this procedura again.

6. Firmware upload on Sonoff TH-16 / TH-10

At this point it will be sufficient to select on the menu “PlatformIO> Upload”To start the phase programmation e proere. If at the end of procedura read "SUCCESS" (similarly to the firmware compilation screen), then good, you will have done correctly the first custom configuration of yours Sonoff. In the case instead the procedura fail, repeat the steps above, taking care to carefully check the configuration of the COM, of the connections and all operational sequences.

Now that the procedura has been successful, it is necessary to verify that everything works properly. Disconnect the USB cable and then reconnect it immediately, this time WITHOUT hold the gpio0 button: this will cause the Sonoff is powered up and starts functioning normally without going into the mode proprogramming.

At this point the Sonoff it will be on and will have entered into the Wifi, as already informed of the access coordinates (see point 2 of the guide). To cling to it, however, it is necessary to find out which IP our router has assigned to it, something we cannot know in advance.

To do this, click on "PlatformIO> Serial Monitor”And, in the following screen:

select "Baudrate" to set "115200", while the "Port" field should automatically configure.
By clicking on "Start" dovrebbe appenter a screen as follows:

scroll to zoom

which should indicate the IP obtained from Sonoff when it entered the Wifi network, in this case "". Now, opening up any browser on the proyour computer, enter the address the IP just obtained and press enter.

If all went well, dovrebbe appenter a screen as follows:Compliments!
Il Sonoff is correctly reprogrammato with the firmware Sonoff-Tasmota.
As can be seen from the image, the model is shown aboveSonoff Basic”, As the firmware Tasmota it is still configured in default mode. You will then need to enter the menu "Configuration" > "Module Configuration" and choose the most suitable model based on the device in use (in this case, Sonoff TH).

It will be enough now disconnect the device from the FTDI adapter and then from the computer, restore the 220v electrical connections and start using it.

7. How to update OTA (Over The Air) a Sonoff

To update un Sonoff previously proprogrammed Tasmota (actually the procedura is the same for all the ITEAD models Sonoff updated Tasmota) it's enough fill in the updated version of the firmware Sonoff-Tasmota (or this passage of this guide) and recover the file "firmware.bin"(See the item" take note "at the end of the indicated passage).

Indeed you must first compile the "minimal" firmware ("default_envs = tasmota-minimal" In the file plaformio.ini), set the file aside "firmware.bin”Resulting, recompile the“ complete ”firmware (“default_envs = tasmota”- or distribution language - In the file plaformio.ini) and set the second file aside "firmware.bin"

Next, connect via web browser to Sonoff e select "Sign Upgrade".

Under the heading "Upgrade by file upload", Select the file"firmware.bin"Above concerning the" minimal "version, then click the" Start "button upgrade"And simply wait for the transaction to finish. At the end, reconnect to the web interface and redo the procedura, this time passing it the file "firmware.bin”Of the“ complete ”firmware.

A dedicated guide is available here all'aggiornameof the massive Sonoff-Tasmota with one centralized operation, via TasmoAdmin.

8. Conclusions

Il Sonoff it is a powerful tool, especially when it is repeatedprogramma using Tastmota or ESPurna. After being able to update it, is Useful learn to add it to Homebridge or Home Assistant.

Actually i Sonoff do not act as only switches or sensors (as in the case of TH-16 / TH10), the functions are in fact the most disparate, as shown by many of our guides dedicated to proMQTT tocollo. Tale protocollo is ideal for home automation use and, for theappgreased, it is introduced on your devices Sonoff through the highernamento to firmware Sonoff-Tasmota, object of this guide.

How to check a Sonoff after having reprogrammate the firmware

ITEAD Sonoff BasicATTENZIONE: remember that there is on our FORUM community an ad hoc section dedicated to Sonoff (and more generally to devices ESP8266), for any doubt, question, information on the specific merit of these components.