{"id":7199,"date":"2020-08-09T23:13:50","date_gmt":"2020-08-09T21:13:50","guid":{"rendered":"https:\/\/michlstechblog.info\/blog\/?p=7199"},"modified":"2021-02-01T13:18:19","modified_gmt":"2021-02-01T12:18:19","slug":"sonoff-th10-16-flashing-tasmota-and-setup-temperature-measurement","status":"publish","type":"post","link":"https:\/\/michlstechblog.info\/blog\/sonoff-th10-16-flashing-tasmota-and-setup-temperature-measurement\/","title":{"rendered":"Sonoff TH10\/16: Flashing Tasmota and setup temperature measurement"},"content":{"rendered":"<div class=\"twoclick_social_bookmarks_post_7199 social_share_privacy clearfix 1.6.4 locale-en_US sprite-en_US\"><\/div><div class=\"twoclick-js\"><script type=\"text\/javascript\">\/* <![CDATA[ *\/\njQuery(document).ready(function($){if($('.twoclick_social_bookmarks_post_7199')){$('.twoclick_social_bookmarks_post_7199').socialSharePrivacy({\"services\":{\"flattr\":{\"uid\":\"Michl\",\"status\":\"on\",\"the_title\":\"Sonoff%20TH10%2F16%3A%20Flashing%20Tasmota%20and%20setup%20temperature%20measurement\",\"the_excerpt\":\"these%20steps%20describes%20how%20to%20install%20Tasmota%20on%20Sonoff%20Smart%20Home%20WIFI%2FWLAN%20relay.%20%0D%0A%0D%0AFirst%20you%20need%20a%20the%20flash%20tool%20esptool.%20Simplest%20way%20is%20to%20install%20the%20python%20module.%20This%20is%20the%20same%20way%20on%20linux%20and%20windows%0D%0A%20%28more%26hellip%3B%29\",\"txt_info\":\"2 clicks for more data protection:\\r\\n\\r\\nOnly when you click here, the button will be come active and you can send your recommendation to Flattr. When activating, data are transmitted to third parties. \",\"perma_option\":\"off\"}},\"txt_help\":\"When you activate these fields by clicking, information to Flattr may be transferred abroad, and probably may also stored there.\",\"settings_perma\":\"Enable permanently and accept data transmission. \",\"info_link\":\"http:\\\/\\\/www.heise.de\\\/ct\\\/artikel\\\/2-Klicks-fuer-mehr-Datenschutz-1333879.html\",\"uri\":\"https:\\\/\\\/michlstechblog.info\\\/blog\\\/sonoff-th10-16-flashing-tasmota-and-setup-temperature-measurement\\\/\",\"post_id\":7199,\"post_title_referrer_track\":\"Sonoff+TH10%2F16%3A+Flashing+Tasmota+and+setup+temperature+measurement\",\"display_infobox\":\"on\"});}});\n\/* ]]> *\/<\/script><\/div><p>these steps describes how to install Tasmota on Sonoff Smart Home WIFI\/WLAN relay. <\/p>\n<p>First you need a the flash tool <strong>esptool<\/strong>. Simplest way is to install the python module. This is the same way on linux and windows<br \/>\n<!--more--><\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nmichael@debdev ~ # python3 -m pip install esptool\r\n<\/pre>\n<p>I use it in an virtual python environment so it is independend from the pythons host installation. There are two more steps. You have to install python venv one time.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nmichael@debdev ~ # sudo apt install python3-pip python3-venv\r\n<\/pre>\n<p>Then create a virtual environment and switch to it <\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nmichael@debdev ~ # python3 -m venv \/home\/michael\/esptool-env\r\nmichael@debdev ~ # source \/home\/michael\/esptool-env\/bin\/activate\r\n<\/pre>\n<p>Now, install esptool in your virtual env, the esptool is only useable when you are in this environment.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n(esptool-env) michael@debdev ~ # python3 -m pip install setuptools wheel\r\n(esptool-env) michael@debdev ~ # python3 -m pip install esptool\r\n<\/pre>\n<p>You can leave the virtual env by the <strong>deactivate<\/strong> command and go back with the <strong>source \/home\/michael\/esptool-env\/bin\/activate<\/strong>.<\/p>\n<p>For the flashing process you need a serial RS232 interface. If your computer does not have one, use a USB to RS232 TTL device like <a href=\"https:\/\/www.conrad.de\/de\/p\/usb-auf-rs232-ttl-uart-pl-2303hx-chip-rev-a-konverter-kabel-802243972.html\" rel=\"noopener noreferrer\" target=\"_blank\">this<\/a>. Note you need TTL level at the RS232 site and not a SUB-D connector.<br \/>\n<strong><br \/>\nNote: !!!!! It is not necessary to connect the sonoff ot the 230V main voltage\/supply during flushing: There is an isolation between the main voltage and the esp but keep the risk as low as possinble<\/strong> The 3.3V Supply from the USB RS232 Converter is sufficent for flashing. <\/p>\n<p>Wire the converter like this:<\/p>\n<pre>\r\n<code>\r\nSonoff TH10\/16                        USB\/RS232 Converter\r\n----------                           ---------------------\r\n     GND  | ----------------------- | GND\r\n     RxD  | ----------------------- | TxD\r\n     TxD  | ----------------------- | RxD\r\n    3.3V  | ----------------------- | 3.3V\r\n----------                           ---------------------\r\n<\/code>\r\n<\/pre>\n<p><figure id=\"attachment_7205\" aria-describedby=\"caption-attachment-7205\" style=\"width: 300px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2020\/08\/Sonoff_USB-RS232.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2020\/08\/Sonoff_USB-RS232-300x240.jpg\" alt=\"\" width=\"300\" height=\"240\" class=\"size-medium wp-image-7205\" srcset=\"https:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2020\/08\/Sonoff_USB-RS232-300x240.jpg 300w, https:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2020\/08\/Sonoff_USB-RS232-768x614.jpg 768w, https:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2020\/08\/Sonoff_USB-RS232.jpg 972w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-7205\" class=\"wp-caption-text\">Sonoff USB-RS232 connection<\/figcaption><\/figure><br \/>\nEnter flash mode: Hold the push button switch while plugin the USB\/RS232 adapter. This shorten the ESP GPIO 0 to GND. <\/p>\n<p>Test Connection. Read MAC and determine flash size:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n(esptool-env) michael@debdev ~ # esptool.py -p \/dev\/ttyUSB0 read_mac\r\nesptool.py v2.8\r\nSerial port \/dev\/ttyUSB0\r\nConnecting....\r\nDetecting chip type... ESP8266\r\nChip is ESP8266EX\r\nFeatures: WiFi\r\n...\r\n(esptool-env) michael@debdev ~ # esptool.py -p \/dev\/ttyUSB0 flash_id\r\n...\r\nManufacturer: 5e\r\nDevice: 6014\r\nDetected flash size: 1MB\r\nStaying in bootloader.\r\n<\/pre>\n<p>Note if a command is not working pull the USB RS232 and plug again.<\/p>\n<p>If you are on Windows use the COM Port instead of \/dev\/ttyUSB0.<\/p>\n<p><strong>Backup the original firmware<\/strong><br \/>\n<!-- https:\/\/www.shelly-support.eu\/lexikon\/index.php?entry\/83-firmware-backup-recovery-original-fw\/ --><br \/>\nSwitch to flash mode as descripted above (shortened GND and GPIO0)<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n(esptool-env) michael@debdev ~ # esptool.py -p \/dev\/ttyUSB0 --baud 115200 read_flash 0x00000 0x100000 Backup_sonoff_org_2MB.bin \r\n<\/pre>\n<p><!-- (esptool-env) michael@debdev ~ # esptool.py -p \/dev\/ttyUSB0 read_flash 0x00000 ~\/Backup.bin --><br \/>\nIf you want to restore the original firmware use <\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n(esptool-env) michael@debdev ~ # esptool.py erase_flash\r\n(esptool-env) michael@debdev ~ # esptool.py -p \/dev\/ttyUSB0 --baud 115200 write_flash 0x00000 0x100000 Backup_sonoff_org_2MB.bin\r\n<\/pre>\n<p>To flash Tasmota get the latest version from the <a href=\"https:\/\/github.com\/arendst\/Tasmota\/releases\/\" rel=\"noopener noreferrer\" target=\"_blank\">Tasmota release page<\/a>. Usually <strong>tasmota.bin<\/strong>. There are also localized version. For example the german version tasmota-DE.bin. Also special versions for example with knx support: tasmota-knx.bin. When I wrote this post 8.4 was the latest release.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n(esptool-env) michael@debdev ~ # wget https:\/\/github.com\/arendst\/Tasmota\/releases\/download\/v8.4.0\/tasmota.bin\r\n<\/pre>\n<p>Erase the flash memory and flash the firmware<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n(esptool-env) michael@debdev ~ # esptool.py erase_flash\r\n(esptool-env) michael@debdev ~ # esptool.py  --baud 115200 write_flash -fs 1MB -fm dout 0x0 tasmota.bin\r\n<\/pre>\n<p>When tasmota is installed it provides an WiFi WLAN with name tasmota_deviceid_xxxx. You can connect without a password\/key. When connected, open a Browser and navigate to <a href=\"http:\/\/192.168.4.1\" rel=\"noopener noreferrer\" target=\"_blank\">http:\/\/192.168.4.1<\/a>. You can use the Scan for WiFi Networks at the top of the page.<\/p>\n<p>Enter your WiFi Parameters and restart tasmota. After the reboot it should connect to your WiFi. Then you have to determine the new IP Address by taking a look to your WiFi Router.<br \/>\n<figure id=\"attachment_7188\" aria-describedby=\"caption-attachment-7188\" style=\"width: 161px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2020\/08\/Tasmota_Shelly.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2020\/08\/Tasmota_Shelly-161x300.png\" alt=\"\" width=\"161\" height=\"300\" class=\"size-medium wp-image-7188\" srcset=\"https:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2020\/08\/Tasmota_Shelly-161x300.png 161w, https:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2020\/08\/Tasmota_Shelly.png 450w\" sizes=\"auto, (max-width: 161px) 100vw, 161px\" \/><\/a><figcaption id=\"caption-attachment-7188\" class=\"wp-caption-text\">Tasmota Shelly WiFI Settings<\/figcaption><\/figure><br \/>\nConnect again by openeing the browser and enter the new IP Address<\/p>\n<p>Tasmota wrote some status information to the serial terminal at 115200 Baud. To take a look at these messages use screen or minicom. Note: This is difficult with USB\/RS232 devices for boot messages, because \/dev\/ttyUSB0 is just available until the adapter is plugged in and tasmota boots really fast. But further message will give hints for some issues.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n(esptool-env) michael@debdev ~ # screen \/dev\/ttyUSB0 115200\r\n00:06:16 WIF: Connect failed with AP timeout\r\n00:06:16 RSL: stat\/tasmota_D7DCFE\/RESULT = {&quot;POWER&quot;:&quot;ON&quot;}\r\n00:06:16 RSL: stat\/tasmota_D7DCFE\/POWER = ON\r\n00:06:17 WIF: Connecting to AP1 MyWiFi in mode 11N as sonoff-garage...\r\n00:06:31 WIF: Connect failed with AP timeout\r\n<\/pre>\n<p>Then you have to configure the sonoff specific function in Tasmota. Go to configuration -> Configure Module<br \/>\n<figure id=\"attachment_7216\" aria-describedby=\"caption-attachment-7216\" style=\"width: 300px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2020\/08\/Tasmota_Sonoff_config.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2020\/08\/Tasmota_Sonoff_config-300x194.png\" alt=\"\" width=\"300\" height=\"194\" class=\"size-medium wp-image-7216\" srcset=\"https:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2020\/08\/Tasmota_Sonoff_config-300x194.png 300w, https:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2020\/08\/Tasmota_Sonoff_config.png 492w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-7216\" class=\"wp-caption-text\">Tasmota Configuration<\/figcaption><\/figure><br \/>\nand set Sonoff TH (4)<br \/>\n<figure id=\"attachment_7217\" aria-describedby=\"caption-attachment-7217\" style=\"width: 300px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2020\/08\/Tasmota_Sonoff_Configure.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2020\/08\/Tasmota_Sonoff_Configure-300x185.png\" alt=\"\" width=\"300\" height=\"185\" class=\"size-medium wp-image-7217\" srcset=\"https:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2020\/08\/Tasmota_Sonoff_Configure-300x185.png 300w, https:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2020\/08\/Tasmota_Sonoff_Configure.png 518w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-7217\" class=\"wp-caption-text\">Tasmota configure Sonoff (4)<\/figcaption><\/figure><\/p>\n<p>Tasmota supports Sonoff TH with all three Sonoff sensors. And configure <a href=\"https:\/\/tasmota.github.io\/docs\/devices\/Sonoff-TH\/\" rel=\"noopener noreferrer\" target=\"_blank\">GPIO14 <\/a>to the sensor you want to connect. <\/p>\n<p><figure id=\"attachment_7221\" aria-describedby=\"caption-attachment-7221\" style=\"width: 300px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2020\/08\/Tasmota_Sonoff_config-1.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2020\/08\/Tasmota_Sonoff_config-1-300x194.png\" alt=\"Tasmota Configure\" width=\"300\" height=\"194\" class=\"size-medium wp-image-7221\" srcset=\"https:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2020\/08\/Tasmota_Sonoff_config-1-300x194.png 300w, https:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2020\/08\/Tasmota_Sonoff_config-1.png 492w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-7221\" class=\"wp-caption-text\">Tasmota Configure<\/figcaption><\/figure><br \/>\n<figure id=\"attachment_7222\" aria-describedby=\"caption-attachment-7222\" style=\"width: 300px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2020\/08\/Tasmota_Sonoff_Configure_Template.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2020\/08\/Tasmota_Sonoff_Configure_Template-300x168.png\" alt=\"Tasmota Configure Template\" width=\"300\" height=\"168\" class=\"size-medium wp-image-7222\" srcset=\"https:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2020\/08\/Tasmota_Sonoff_Configure_Template-300x168.png 300w, https:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2020\/08\/Tasmota_Sonoff_Configure_Template.png 528w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-7222\" class=\"wp-caption-text\">Tasmota Configure Template<\/figcaption><\/figure><\/p>\n<p><figure id=\"attachment_7223\" aria-describedby=\"caption-attachment-7223\" style=\"width: 300px\" class=\"wp-caption alignnone\"><a href=\"https:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2020\/08\/Tasmota_Sonoff_Configure_Tempsensor.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2020\/08\/Tasmota_Sonoff_Configure_Tempsensor-300x34.png\" alt=\"Tasmota Configure GPIO14\" width=\"300\" height=\"34\" class=\"size-medium wp-image-7223\" srcset=\"https:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2020\/08\/Tasmota_Sonoff_Configure_Tempsensor-300x34.png 300w, https:\/\/michlstechblog.info\/blog\/wp-content\/uploads\/2020\/08\/Tasmota_Sonoff_Configure_Tempsensor.png 432w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><figcaption id=\"caption-attachment-7223\" class=\"wp-caption-text\">Tasmota Configure GPIO14<\/figcaption><\/figure><br \/>\nDepending on your temperature sensor it could be that you must configure the GPIO14 Pin to SI7021 instead of AM2301. This is due to the fact that the AM2301 Sensor has an has an additional protocol converter integrated, named SI7021.<\/p>\n<p>Michael<\/p>\n","protected":false},"excerpt":{"rendered":"<p>these steps describes how to install Tasmota on Sonoff Smart Home WIFI\/WLAN relay. First you need a the flash tool esptool. Simplest way is to install the python module. This is the same way on linux and windows<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1316,1151,1471,1475,1476],"tags":[1479,1481,947,946,1480,1474,1156,1478,1472],"class_list":["post-7199","post","type-post","status-publish","format-standard","hentry","category-devices","category-homeautomation","category-iot","category-sonoff","category-sonoff-homeautomation","tag-backup-firmware","tag-esptool","tag-firmware","tag-flash","tag-flash-tasmota","tag-mosquitto_pub","tag-mqtt","tag-sonoff","tag-tasmota"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts\/7199","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/comments?post=7199"}],"version-history":[{"count":29,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts\/7199\/revisions"}],"predecessor-version":[{"id":7416,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/posts\/7199\/revisions\/7416"}],"wp:attachment":[{"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/media?parent=7199"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/categories?post=7199"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/michlstechblog.info\/blog\/wp-json\/wp\/v2\/tags?post=7199"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}