Table of Contents
Tasmota
Tasmota is firmware providing support for various devices attached to an ESP8266/ESP32.
It has a HTTP interface and MQTT support.
It was initially designed for SONOFF power switches but can be used with any device to give an MQTT enabled WIFI temperature monitor, for example.
Install
Example installation on a WEMOS D1 Mini Lite.
Visit the Tasmota releases page to determine the available firmware.
Fetch the sensors firmware for the ESP8285.
wget "https://ota.tasmota.com/tasmota/release/tasmota-sensors.bin.gz" gunzip tasmota-sensors.bin.gz
Plug the board in via USB and program with ESP-Tool
esptool.py --port /dev/ttyUSB0 write_flash -fs detect -fm dout 0x0 tasmota-sensors.bin esptool.py v4.6.2 Serial port /dev/ttyUSB0 Connecting.... Detecting chip type... Unsupported detection protocol, switching and trying again... Connecting.... Detecting chip type... ESP8266 Chip is ESP8285N08 Features: WiFi, Embedded Flash Crystal is 26MHz MAC: 60:01:94:b1:1b:ea Uploading stub... Running stub... Stub running... Configuring flash size... Auto-detected Flash size: 1MB Flash will be erased from 0x00000000 to 0x000affff... Compressed 717264 bytes to 506294... Wrote 717264 bytes (506294 compressed) at 0x00000000 in 45.7 seconds (effective 125.5 kbit/s)... Hash of data verified. Leaving... Hard resetting via RTS pin...
If the board was previously blank then it will create an access point to enter WiFI details, else it will re-use old settings.
Configuration
Boards without settings will require configuration and those with old settings have no further configuration to do.
Pre config
When the target boots connect to its open tasmota Wifi access point and visit the web interface here.
Enter your SSID and password and the target will reboot with the new WiFi credentials.
Post config
Connect to the device on your LAN and change the device type, Eg. Generic and then save settings. It will reboot.
Information
From the information page, see something like this
Generic Tasmota Program Version 13.1.0(sensors) Build Date & Time 2023-08-15T07:59:54 Core/SDK Version 2_7_4_9/2.2.2-dev(38a443e)
Sensor
To add an I2C sensor (Eg. BMP280) wire up the board and change GPIO4 to SDA, and GPIO5 to SCL. The device will reboot.
BMP280
Generic Tasmota BMP280 Temperature 21.3 °C BMP280 Pressure 1022.8 hPa
WEMOS NODEMCU V3
Two boards can be seen above in the photo, they differ only the Flash device used and both are 32Mbit in size.
Type | Manufacturer | Device |
---|---|---|
0x164068 | BOYA MICRO | BY25Q32CSIG |
0x164020 | XMC | XM25QH32C |
BY25Q32CSIG opcode 0x9F (see data-sheet page 17)
XM25QH32C opcode 0x9F (see data-sheet page 20)
Bits | Ident | Type |
---|---|---|
16:23 | ID15-ID8 | Ident low byte |
8:15 | ID7-ID0 | Ident high byte |
7:0 | M7-M0 | Manufacturer |
Tasmota versions newer than 12.2.0 for ESP8266 do not work correctly with the XMC SPI flash.
When setting up, neither were reliable with any firmware until version 8.5.0 was first installed and then upgraded. Reason unknown.
WEMOS D1 Mini Lite
Read MAC address
esptool.py -p /dev/ttyUSB0 read_mac esptool.py v2.6-beta1 Serial port /dev/ttyUSB0 Connecting.... Detecting chip type... ESP8266 Chip is ESP8285 Features: WiFi, Embedded Flash MAC: xx:xx:xx:xx:xx:xx Uploading stub... Running stub... Stub running... MAC: xx:xx:xx:xx:xx:xx Hard resetting via RTS pin...
Backup flash
esptool.py -p /dev/ttyUSB0 -b 115200 read_flash 0 0x100000 FIRMWARE.BIN esptool.py v2.6-beta1 Serial port /dev/ttyUSB0 Connecting.... Detecting chip type... ESP8266 Chip is ESP8285 Features: WiFi, Embedded Flash MAC: xx:xx:xx:xx:xx:xx Uploading stub... Running stub... Stub running... 1048576 (100 %) 1048576 (100 %) Read 1048576 bytes at 0x0 in 92.8 seconds (90.4 kbit/s)... Hard resetting via RTS pin...
Erase flash
esptool.py --port /dev/ttyUSB0 erase_flash esptool.py v2.6-beta1 Serial port /dev/ttyUSB0 Connecting.... Detecting chip type... ESP8266 Chip is ESP8285 Features: WiFi, Embedded Flash MAC: xx:xx:xx:xx:xx:xx Uploading stub... Running stub... Stub running... Erasing flash (this may take a while)... Chip erase completed successfully in 4.1s Hard resetting via RTS pin...
Write flash
esptool.py --port /dev/ttyUSB0 write_flash -fs detect -fm dout 0x0 sonoff.bin esptool.py v2.6-beta1 Serial port /dev/ttyUSB0 Connecting.... Detecting chip type... ESP8266 Chip is ESP8285 Features: WiFi, Embedded Flash MAC: 60:01:94:b1:1b:ea Uploading stub... Running stub... Stub running... Configuring flash size... Auto-detected Flash size: 1MB Compressed 501424 bytes to 343631... Wrote 501424 bytes (343631 compressed) at 0x00000000 in 30.3 seconds (effective 132.5 kbit/s)... Hash of data verified. Leaving... Hard resetting via RTS pin...
SONOFF BASIC
Backup flash
You may wish to save the factory firmware.
esptool.py --port /dev/ttyUSB0 read_flash 0x00000 0x100000 image1M.bin
Write flash
esptool.py --port /dev/ttyUSB0 write_flash -fs detect -fm dout 0x0 sonoff-basic.bin
ESP32 DEVKITV1
Read MAC address
esptool.py -p /dev/ttyUSB1 read_mac esptool.py v4.6.2 Serial port /dev/ttyUSB1 Connecting..... Detecting chip type... Unsupported detection protocol, switching and trying a Connecting.... Detecting chip type... ESP32 Chip is ESP32-D0WDQ6 (revision v1.0) Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Sche Crystal is 40MHz MAC: 24:6f:28:10:90:44 Uploading stub... Running stub... Stub running... MAC: 24:6f:28:10:90:44 Hard resetting via RTS pin...
Write flash
The factory flash version must be used for new devices.
After reboot refer to the top of this page for configuration via WiFi.
esptool.py --port /dev/ttyUSB1 write_flash 0 tasmota32.factory.bin esptool.py v4.6.2 Serial port /dev/ttyUSB1 Connecting.... Detecting chip type... Unsupported detection protocol, switching and trying again... Connecting.... Detecting chip type... ESP32 Chip is ESP32-D0WDQ6 (revision v1.0) Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None WARNING: Detected crystal freq 41.01MHz is quite different to normalized freq 40MHz. Unsupported crystal in use? Crystal is 40MHz MAC: 24:6f:28:10:90:44 Uploading stub... Running stub... Stub running... Configuring flash size... Flash will be erased from 0x00000000 to 0x002b4fff... Compressed 2834784 bytes to 1784506... Wrote 2834784 bytes (1784506 compressed) at 0x00000000 in 162.4 seconds (effective 139.7 kbit/s)... Hash of data verified. Leaving... Hard resetting via RTS pin...
NODEMCU ESP-32S
Read MAC address
esptool.py -p /dev/ttyUSB1 read_mac esptool.py v4.6.2 Serial port /dev/ttyUSB1 Connecting.... Detecting chip type... Unsupported detection protocol, switching and trying again... Connecting.... Detecting chip type... ESP32 Chip is ESP32-D0WDQ6 (revision v1.0) Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None Crystal is 40MHz MAC: 30:ae:a4:fe:03:80 Uploading stub... Running stub... Stub running... MAC: 30:ae:a4:fe:03:80 Hard resetting via RTS pin...
Write flash
esptool.py --port /dev/ttyUSB1 write_flash 0 tasmota32.factory.bin esptool.py v4.6.2 Serial port /dev/ttyUSB1 Connecting..... Detecting chip type... Unsupported detection protocol, switching and trying again... Connecting....... Detecting chip type... ESP32 Chip is ESP32-D0WDQ6 (revision v1.0) Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None Crystal is 40MHz MAC: 30:ae:a4:fe:03:80 Uploading stub... Running stub... Stub running... Configuring flash size... Flash will be erased from 0x00000000 to 0x002b4fff... Compressed 2834784 bytes to 1784506... Wrote 2834784 bytes (1784506 compressed) at 0x00000000 in 162.2 seconds (effective 139.8 kbit/s)... Hash of data verified. Leaving... Hard resetting via RTS pin...
Sensor
IO GPIO21 I2C_SDA IO GPIO22 I2C_SCL
BMP180
ESP32-DevKit Tasmota BMP180 Temperature 19.1 °C BMP180 Pressure 1026.3 hPa
SONOFF 4CH PRO R2
The built-in firmware for this device died after 6 months of use. The console shows the chip rebooting with watchdog reset errors continuously.
To upgrade attach a console to the ESP8285 by connecting a UART adapter in 3V mode to the Rx/Tx and GND pins on the board. Power up with the DC input.
To enable flash erase/write, power off and short IO0 on the pad. Power up with the DC input.
Write flash
Writing was unreliable and needed lots of attempts (do not give up).
esptool.py write_flash 0 tasmota.bin --no-compress esptool.py v4.6.2 Loaded custom configuration from /home/darron/Tasmota/ESP8266/13.1.0/esptool.cfg Found 1 serial ports Serial port /dev/ttyUSB0 Connecting... Detecting chip type... Unsupported detection protocol, switching and trying again... Connecting... Detecting chip type... ESP8266 Chip is ESP8285N08 Features: WiFi, Embedded Flash Crystal is 26MHz MAC: 84:0d:8e:48:e6:fd Stub is already running. No upload is necessary. Configuring flash size... Flash will be erased from 0x00000000 to 0x0009efff... Wrote 655360 bytes at 0x00000000 in 59.9 seconds (87.5 kbit/s)... Hash of data verified. Leaving... Hard resetting via RTS pin...
Boot
When writing succeeded, this was the boot message.
00:00:00.001 HDW: ESP8285N08 00:00:00.017-029 CFG: Use defaults 00:00:00.757 QPC: Reset 00:00:00.779 Project tasmota - Tasmota Version 13.1.0(tasmota)-2_7_4_9(2023-08-15T07:58:36) 00:00:00.040 WIF: WifiManager active for 3 minutes 00:00:00.687 HTP: Web server active on tasmota-48E6FD-1789 with IP address 192.168.4.1
Resources
BY25Q32CS SPI flash data-sheet
XM25QH32C SPI flash data-sheet
SONOFF 4CH Pro alternative STM32 firmware