Please post questions about using and setting up Home Assistant integrations on the appropriate resources!
This repository contains custom firmware for several Bluetooth Thermometer & Hygrometer devices.The download of the appropriate firmware for your device will be presented automatically in TelinkMiFlasher.html. Downloading files from this repository is not required.Alternative firmware and configurator from ATC1441 (variant ATC_Thermometer.bin) can be found here: atc1441/ATC_MiThermometer.Custom firmware is not supported in MiHome. But it is possible to work LYWSD03MMC with ‘Xiaomi Gateway 3’ by first registering in MiHome on the official firmware, flashing to custom firmware with restoring the binding key from MiHome, replacing the device name with “LYWSD03MMC” and setting the advertising type to “MIJIA (MiHome)” marked “encrypted”.
Support for ZigbeeTLc and ZBdevice firmware is in the ZigbeeTLc (ZigbeeTLc) repository.
Support for BLE-Zigbee firmware is in the BZdevice repository.
The custom firmware can be flashed via a modern browser and over-the-air (OTA) without opening the device and unlocks several customization options. You can go back to the original firmware at any time. OTA and configuration main page - TelinkMiFlasher.html.
Due to unclear sanctions from English-speaking countries, this and related projects will most likely be closed to English-speaking users. Or provided on a paid basis.
Access to github is already slowing down. Most Internet information resources have long been blocking on their side.
Key features
Extended battery life (over a year)
Improved measurement accuracy and extended format in 0.01 units
Supports Bluetooth v5.0+ LE Long Range (LE 1M/2M/Coded 500K/125K), CSA1/CSA2 (Channel Selection Algorithm), Advertising Extensions: primary and secondary Coded PHY S=8, Connectable. LE Long Range - distance of 1 km in a straight line at TX +0 dB.
3 LCD Display Screens (Looping): Temperature & Humidity & Comfort, Temperature & Battery Level, Clock
Support for 4 beacon formats: Xiaomi, ATC, Custom, BTHome v2 and encrypted options. Legacy and Extended Advertisements.
Adjustable RF TX Power (-20..+10dB) & Bluetooth advertising interval. +3..+10 dB require a more powerful power supply.
DIY improvements - relay control by temperature or humidity, transmission of the reed switch status - open / closed or pulse counter. And more DIY projects
Support BLETHR (Receiving and displaying data from an external thermometer operating in the BTHome v2 format on the display of another BLE thermometer):
Supported models:
(!) It is not recommended to buy Tuya thermometers with CHT8305 sensors and/or BL55028 LCD driver chips. They have increased consumption and are not compatible with battery operation. This is a dummy thermometer from Tuya.
With a couple dozen BLE devices, a 256GB SSD is only enough for 2 years.
If you have many BLE devices, the adapter must be able to receive BLE advertisements every 3 ms.
UART speeds of 921600 baud and even USB1.1 are not enough to transfer information in binary form in the HCI format.
Requires BT adapter with USB2.0 HS. Otherwise, there will be many gaps in the reception. Do not use ESP32xxx - it cannot work with BLE at normal speed and drains the batteries of all BLE devices when connected! ESPHome does not work with Bluetooth 5.0 and misses a lot of advertising packets from BLE devices.
On thermometers with a button, if the button function is set to Connect, then a short application on the button for 80 seconds enables connection in BT4.0 mode.
If you accidentally set the ‘LE Long Range’ on the thermometer, and your device does not support BT5.0, remove and insert the battery - the thermometer will switch to BT4.2 support mode.
If you have a smartphone with BT5.0+ and the nRFConnect program, then you can reset all settings to default by connecting to a thermometer and sending the 0x56 command, as shown in the screenshot:
To disable only the ‘Long Range’ option, use the code 0xDD.
The Web Bluetooth API in Chrome does not yet allow scanning for Bluetooh 5.0+ devices.
On Linux, when installing large advertising intervals, change the file ‘/etc/bluetooth/main.conf’, variables: LEScanIntervalAutoConnect=LEScanWindowAutoConnect=. Value in ms.
If using Android, Windows, Linux: Ensure you enabled “experimental web platform features”. Therefore copy the according link (i.e. chrome://flags/#enable-experimental-web-platform-features for Chrome), open a new browser tab, paste the copied URL. Now sten the Experimental Web Platform features flag to Enabled. Then restart the browser.
For all sensors with a button, before activation, it is necessary to reset the past bindings by holding the button for a long time.
In the Telink Flasher Page: Press Connect: The browser should open a popup with visible Bluetooth devices. Choose the according target device (i.e. LYWSD03MMC) to pair.
After connection is established a Do Acivation button appears. Press this button to start the decryption key process.
Now you can press the Custom Firmware ver x.x button to directly flash the custom firmware. Alternatively you can choose a specific firmware binary (i.e. the original firmware) via the file chooser
Press Start Flashing.
Use TelinkOTA to flash old or alternative versions (ATC1441). This is a program for OTA projects with Telink SDK, no third-party (mijia) protections.
Addition for CGG1-M: Press and hold the button on the back of CGG1-M for 2 seconds until the Bluetooth icon starts blinking on the e-ink display, and then click the ‘Connect’ and ‘Do Activation’ buttons on the TelinkMiFlasherl.
Addition for MJWSD05MMC: Press and hold both buttons for a few seconds until the screen blink (device resets). Next, briefly press the top side button, then briefly press the bottom button. The Bluetooth icon will start flashing. Next ‘Connect’ and ‘Do Activation’ in TelinkMiFlasher.
Configuration
After you have flashed the firmware, the device has changed it’s bluetooth name to something like ATC_F02AED. Using the TelinkMiFlasher.html you have various configuration options.
General process:
Press Connect
Select the according device to connect/pair (i.e. ATC_F02AED)
Several configuration options appear
Choose Send Config to send changed value to the device. Or press Set default and then Send config to revert to the Defaults
Option
Description
Temperature and Humidity offset
Enter a value to correct the offset of the Temperature or Humidity displayed: For example -1.4 will decrease the Temperature by 1.4°
Smiley or Comfort
Choose a static smiley or check the “Comfort” Radio box to change the smiley depending on current Temperature and Humidity.
Comfort Parameters
Defines the Lower (Lo) and Upper (Hi) Range for Temperature and Humidity interpreted as comfort zone. In the default configuration a smiley will appear.
Ticking the according boxes you can enable interval rotation between different LCD screens. See the example video below.
Example of LCD display modes
You can configure different LCD Display modes using Comfort, Show batt and Clock configuration checkboxes. The enabled LCD Display Modes will appear one-by-one in a loop.
Battery and clock display are enabled in the settings. The rest of the settings is kept default. The video contains 2 cycles.
Temperature and humidity
Temperature and % of battery
Temperature and humidity
Hours and minutes
Firmware
Firmware Binaries
You can directly update/flash the firmware without downloading the binaries below.
Custom Firmware Versions:
The download of the appropriate firmware for your device will be presented automatically in TelinkMiFlasher.html. Downloading files from this repository is not required.
Additional parameters: Support BT5.0 PHY, Channel Selection Algorithm 2, Correct RF-TX Power in suspend
3.7
Added format ‘HA BLE’, reed switch operation mode: Switch and Count. Full support for “HA BLE” encryption. Speed correction I2C for LCD controller LYWSD03MMC HW:1.9. Support for CGG1-M hardware version 2022.
Changed the calculation of battery readings in %, optimization of consumption for the solar battery when the voltage drops below 2V (deep-sleep), added option to invert event for reed switch, small optimizations.
4.0
Improved stability in connected mode. I2C bus CLK and PullUp correction.
Option Increasing Communication Distance: Bluetooth 5.0 LE Long Range (Advertising Extensions: primary and secondary Coded PHY S=8, Connectable). Added support MHO-C401 (2022.11) and MJWSD05MMC. Added function key: Connect
4.3
Increasing the degree of averaging (x64) of the sent values over the battery. Added “Screen Off” option. Check LYWSD03MMC HW: B1.5. Added MHO-C122 (2AWMOMHOC122) test support. LCD display stabilization LYWSD03MMC HW:B1.9
Replacing BTHome ver1 (HA_BLE) with BTHome ver2. Moving firmware after recovery to BLE from Zigbee OTA. Fixed a bug where the date was not displayed correctly for MJWSD05MMC.
4.6
All thermometers support EXT OTA. Flashing third party Zigbee OTA files (*.zigbee).
4.7
Changing sensor settings: Added slope factor, zero offset in 0.01 units.
4.8
Reorganization of program code. Combining code with “BLE_THSensor”. Option added: One MY18B20 on PD2 TS0201S1, ZTH01S1; Two MY18B20 on PD2 and PD4 TS0201S2, ZTH01S2. Temperature from MY18B20 is transmitted in BTHome format.
Added settings: “pseudo-random value in the range from 0 to X ms is added to the fixed advInterval so that ad events change over time”, “number of transmitted beacons per event”. Changed calculation of average battery voltage. Added MJWSD06MMC.
5.2
Beta ver: Fix symbol “1” MHO-C401N, fix command “Delete all records”. Added PLM1
To record the measurement results, a cyclic buffer in the flash memory for 20000 measurements is used.
The recording step interval is set in the interface.
With the default settings, the recording step is 10 minutes, which gives a recording depth of 4 and a half months.
During the step period, the sensor data and battery voltage are averaged, time stamped, and written to flash memory.
Setting the value to 0 disable logging to internal storage.
Bluetooth Connection: 15..30 uA 3.3V (depends on the amount of temperature or humidity changes over time to display)
Xiaomi Miaomiaoce (MHO-C401N)
Using the default settings for advertising interval of 2.5 seconds and measurement interval of 20 seconds:
Bluetooth Advertisement: 10..14 uA 3.3V (depends on the amount of temperature or humidity changes over time to display)
Bluetooth Connection: 13..17 uA 3.3V (depends on the amount of temperature or humidity changes over time to display)
Qingping (CGDK2)
Using the default settings for advertising interval of 2.5 seconds and measurement interval of 20 seconds:
Bluetooth Advertisement: 18..21 uA 3.3V
Bluetooth Connection: 23..30 uA 3.3V
Qingping (CGG1)
Using the default settings for advertising interval of 2.5 seconds and measurement interval of 20 seconds:
Bluetooth Advertisement: 12..16 uA 3.3V
Bluetooth Connection: 23..30 uA 3.3V
Qingping (CGG1N)
Using the default settings for advertising interval of 2.5 seconds and measurement interval of 10 seconds:
Bluetooth Advertisement: 12..16 uA 3.3V
Bluetooth Connection: 23..30 uA 3.3V
Tuya TH03
Using the default settings for advertising interval of 5 seconds and measurement interval of 20 seconds:
Bluetooth Advertisement: 19..21 uA 3.3V (LCD off: 16.5 uA)
Bluetooth Connection: 27..33 uA 3.3V
All sleep, LCD off: 11..12 uA 3.3V !
(!) TH03 power consumption is twice as much as LYWSD03MMC. The reason is the LCD driver chip and T/H sensor. Not recommended for purchase. The developers of this device under the Tuya brand used all components that are not suitable for power supply from CR2032… The goal was one - to sell.
Tuya ZL02-ZX (LKTMZL02)
Using the default settings for advertising interval of 5 seconds and measurement interval of 20 seconds:
Bluetooth Advertisement: 13..14 uA 3.3V (LCD off: 6.8..7.2 uA)
Sleep: 8.5 uA 3.3V (LCD off: 2.1 uA)
Bluetooth Advertising Formats
The Firmware can be configured to support one of four different Bluetooth advertisements data formats:
Xiaomi, ATC, Custom, BTHome and encrypted options.
UUID 0xFE95 - 0x0A: Xiaomi - battery charge level 0..100%, battery voltage in mV
Xiaomi Temperature & Humidity
UUID 0xFE95 - 0x0D: Xiaomi - temperature x0.1C, humidity x0.1%
Xiaomi Encrypted (bindkey enable)
UUID 0xFE95 - 0x0A, 0x04, 0x06 Xiaomi - battery charge level 0..100%, temperature x0.1C, humidity x0.1% (All data are averaged over a period of 16 measurements)
Bluetooth Connection Mode
Primary Service - Environmental Sensing Service (0x181A):
Characteristic UUID 0x2A1F - Notify temperature x0.1C
Characteristic UUID 0x2A6E - Notify temperature x0.01C
Characteristic UUID 0x2A6F - Notify about humidity x0.01%
Primary Service - Battery Service (0x180F):
Characteristic UUID 0x2A19 - Notify the battery charge level 0..99%
Primary Service (0x1F10):
Characteristic UUID 0x1F1F - Notify, frame id 0x33 (configuring or making a request): temperature x0.01C, humidity x0.01%, battery charge level 0..100%, battery voltage in mV, GPIO-pin flags and triggers.
Temperature or humidity trigger (GPIO PC4 LYWSD03MMC label on the “P9” pin)
Xiaomi LYWSD03MMC has a PCB soldering test point. Available without disassembling the case and marked “P9”.
Use as a trigger output with adjustable temperature and / or humidity hysteresis.
Hysteresis and thresholds are set in TelinkMiFlasher.html. The output status is displayed in the advertising package.
Hysteresis:
=0 off,
if less than zero - activation on decrease,
if more than zero - activation on excess
Setting the pin to “1” or “0” works if both hysteresis are set to zero (TRG off).
Interface for receiving and displaying data on the LCD.
LCD shows:
Big number: -99.5..1999.5
Small number: -9..99
Smiley, battery, degrees
Setting the display time limit in sec
The USB-COM adapter writes the firmware in explorer. Web version.
USBCOMFlashTx.html - Uses a partial imitation of the Telink 1-Wire protocol on a USB-UART adapter, but only for transmission to the chip.
For programming and debugging, the chip uses a special hardware protocol Telink 1-Wire (not even close to UART!).
To match the frequencies of the Telink 1-Wite bus, no change in Baud-rate is required.
While the chip is sleeping and when the SWS pin is reassigned, there is no access to programming.
You can restore communication via “Telink 1-Wire” by rebooting the chip and sending a command to stop the CPU. This is called “Activation”.
The USBCOMFlashTx.html program does not have feedback - it does not receive data from the chip. This is a simplified version and only works if all connections are made correctly.
In difficult cases, when the chip contains an unknown FW, it is necessary to use a chip reset or power supply during “activation”.
At the same time, take into account that the chip can be powered from the TX output. This is solved by connecting TX and +Vbat during “activation”.
For LYWSD03MMC, the HW version is determined by the display and sensor addresses on I2C:
HW
LCD I2C addr
SHTxxx I2C addr
Note
B1.4
0x3C
0x70 (SHTC3)
B1.5
UART
0x70 (SHTC3)
B1.6
UART
0x44 (SHT4x)
B1.7
0x3C
0x44 (SHT4x)
Test original string HW
B1.9
0x3E
0x44 (SHT4x)
B2.0
0x3C
0x44 (SHT4x)
Test original string HW
Version 1.7 or 2.0 is determined at first run by reading the HW line written in Flash.
Display matrices or controllers are different for all versions, except B1.7 = B2.0.
Custom firmware for BLE thermometers on the Telink chipset.
Warning: Firmware LYWSD03MMC version 2.1.1_0159 requires registration in MI-Home and obtaining IDs.
Please post questions about using and setting up Home Assistant integrations on the appropriate resources!
This repository contains custom firmware for several Bluetooth Thermometer & Hygrometer devices. The download of the appropriate firmware for your device will be presented automatically in TelinkMiFlasher.html. Downloading files from this repository is not required. Alternative firmware and configurator from ATC1441 (variant ATC_Thermometer.bin) can be found here: atc1441/ATC_MiThermometer. Custom firmware is not supported in MiHome. But it is possible to work LYWSD03MMC with ‘Xiaomi Gateway 3’ by first registering in MiHome on the official firmware, flashing to custom firmware with restoring the binding key from MiHome, replacing the device name with “LYWSD03MMC” and setting the advertising type to “MIJIA (MiHome)” marked “encrypted”.
Support for ZigbeeTLc and ZBdevice firmware is in the ZigbeeTLc (ZigbeeTLc) repository.
Support for BLE-Zigbee firmware is in the BZdevice repository.
There is an alternative firmware from Ivan Belokobylskij for LYWSD03MMC to work in Zigbee 3.0 mode.
The custom firmware can be flashed via a modern browser and over-the-air (OTA) without opening the device and unlocks several customization options. You can go back to the original firmware at any time. OTA and configuration main page - TelinkMiFlasher.html.
Due to unclear sanctions from English-speaking countries, this and related projects will most likely be closed to English-speaking users. Or provided on a paid basis. Access to github is already slowing down. Most Internet information resources have long been blocking on their side.
Key features
Supported models:
(!) It is not recommended to buy Tuya thermometers with CHT8305 sensors and/or BL55028 LCD driver chips. They have increased consumption and are not compatible with battery operation. This is a dummy thermometer from Tuya.
6 HW versions
2 HW versions!
2 HW versions!
2 HW versions - (ch) and (en)!
BZdevice
ZY-ZTH02Pro
TS0201 TZ3000
TH03Z
ZTH01
ZTH02
ZY-ZTH02
Zigbee OTA, OTA
Zigbee OTA, OTA
Zigbee OTA, OTA
Zigbee OTA, OTA
ZG_227Z
More than a dozen types
Warnings
With a couple dozen BLE devices, a 256GB SSD is only enough for 2 years.
UART speeds of 921600 baud and even USB1.1 are not enough to transfer information in binary form in the HCI format.
Requires BT adapter with USB2.0 HS. Otherwise, there will be many gaps in the reception. Do not use ESP32xxx - it cannot work with BLE at normal speed and drains the batteries of all BLE devices when connected! ESPHome does not work with Bluetooth 5.0 and misses a lot of advertising packets from BLE devices.
On devices with missing power capacities, do not set ‘Connect latency’ to more than 1000 ms!
How to switch the USB-BT5.0+ adapter to work in LE Long Range in Home Assistant under Linux:
On thermometers with a button, if the button function is set to Connect, then a short application on the button for 80 seconds enables connection in BT4.0 mode.
If you accidentally set the ‘LE Long Range’ on the thermometer, and your device does not support BT5.0, remove and insert the battery - the thermometer will switch to BT4.2 support mode.
If you have a smartphone with BT5.0+ and the nRFConnect program, then you can reset all settings to default by connecting to a thermometer and sending the 0x56 command, as shown in the screenshot:
To disable only the ‘Long Range’ option, use the code 0xDD.
The Web Bluetooth API in Chrome does not yet allow scanning for Bluetooh 5.0+ devices.
LEScanIntervalAutoConnect=
LEScanWindowAutoConnect=
. Value in ms.Table of content
Getting Started
You can conveniently flash, update and configure the bluetooth thermometers remotely using a bluetooth connection and a modern web browser.
Flashing or Updating the Firmware (OTA)
To flash or update the firmware, use a Google Chrome, Microsoft Edge or Opera Browser.
TelinkMiFlasher.html
*chrome://flags/#enable-experimental-web-platform-features
for Chrome), open a new browser tab, paste the copied URL. Now sten the Experimental Web Platform features flag to Enabled. Then restart the browser.Connect
: The browser should open a popup with visible Bluetooth devices. Choose the according target device (i.e.LYWSD03MMC
) to pair.Use TelinkOTA to flash old or alternative versions (ATC1441). This is a program for OTA projects with Telink SDK, no third-party (mijia) protections.
Addition for CGG1-M: Press and hold the button on the back of CGG1-M for 2 seconds until the Bluetooth icon starts blinking on the e-ink display, and then click the ‘Connect’ and ‘Do Activation’ buttons on the TelinkMiFlasherl.
Addition for MJWSD05MMC: Press and hold both buttons for a few seconds until the screen blink (device resets). Next, briefly press the top side button, then briefly press the bottom button. The Bluetooth icon will start flashing. Next ‘Connect’ and ‘Do Activation’ in TelinkMiFlasher.
Configuration
After you have flashed the firmware, the device has changed it’s bluetooth name to something like
ATC_F02AED
. Using theTelinkMiFlasher.html
you have various configuration options.General process:
ATC_F02AED
)-1.4
will decrease the Temperature by 1.4°Example of LCD display modes
You can configure different LCD Display modes using Comfort, Show batt and Clock configuration checkboxes. The enabled LCD Display Modes will appear one-by-one in a loop.
Battery and clock display are enabled in the settings. The rest of the settings is kept default. The video contains 2 cycles.
Firmware
Firmware Binaries
You can directly update/flash the firmware without downloading the binaries below.
Custom Firmware Versions:
The download of the appropriate firmware for your device will be presented automatically in TelinkMiFlasher.html. Downloading files from this repository is not required.
Original Manufacturer Firmware Version
In case you want to go back to the original firmware, you can download them here:
Firmware version history
‘Erase mi-keys’ option to return to original firmware
Applications
Reading Measurements from Flash
GraphMemo.html
To record the measurement results, a cyclic buffer in the flash memory for 20000 measurements is used. The recording step interval is set in the interface. With the default settings, the recording step is 10 minutes, which gives a recording depth of 4 and a half months. During the step period, the sensor data and battery voltage are averaged, time stamped, and written to flash memory.
Setting the value to 0 disable logging to internal storage.
Reading Measurements in Connected Mode
GraphAtc.html GraphAtc1.html GraphAtc2.html DevPoint.html
Reading Measurements in Advertising Mode
This requires the Experimental Web Platform Features flag enabled in your browser. See Flashing or Updating the Firmware (OTA).
Advertising.html
Technical specifications
Average power consumption
Xiaomi Mijia (LYWSD03MMC B1.4)
Using the default settings for advertising interval of 2.5 seconds and measurement interval of 10 seconds:
Xiaomi Mijia (MJWSD05MMC)
Using the default settings for advertising interval of 5 seconds and measurement interval of 20 seconds:
Xiaomi Miaomiaoce (MHO-C401)
Using the default settings for advertising interval of 2.5 seconds and measurement interval of 20 seconds:
Xiaomi Miaomiaoce (MHO-C401N)
Using the default settings for advertising interval of 2.5 seconds and measurement interval of 20 seconds:
Qingping (CGDK2)
Using the default settings for advertising interval of 2.5 seconds and measurement interval of 20 seconds:
Qingping (CGG1)
Using the default settings for advertising interval of 2.5 seconds and measurement interval of 20 seconds:
Qingping (CGG1N)
Using the default settings for advertising interval of 2.5 seconds and measurement interval of 10 seconds:
Tuya TH03
Using the default settings for advertising interval of 5 seconds and measurement interval of 20 seconds:
(!) TH03 power consumption is twice as much as LYWSD03MMC. The reason is the LCD driver chip and T/H sensor. Not recommended for purchase. The developers of this device under the Tuya brand used all components that are not suitable for power supply from CR2032… The goal was one - to sell.
Tuya ZL02-ZX (LKTMZL02)
Using the default settings for advertising interval of 5 seconds and measurement interval of 20 seconds:
Bluetooth Advertising Formats
The Firmware can be configured to support one of four different Bluetooth advertisements data formats:
Xiaomi, ATC, Custom, BTHome and encrypted options.
Supports bindkey beacon encryption.
Advertising formats.
Test program of used Bluetooth Advertising formats provided by Ircama.
Only the BTHome and Xiaomi support the native HA Xiaomi Integration, for the others use the Custom Component Passive BLE.
atc1441 format:
UUID 0x181A - size 16 (temperature in 0.1 °C, humidity in 1 %): atc1441 format
Custom format (all data little-endian):
UUID 0x181A - size 19: Custom extended format in 0.01 units (all data little-endian):
‘BTHome’ format
The ‘BTHome’ format
Encrypted beacon formats (uses bindkey):
Xiaomi Battery Charge
Xiaomi Temperature & Humidity
Xiaomi Encrypted (bindkey enable)
Bluetooth Connection Mode
Temperature or humidity trigger (GPIO PC4 LYWSD03MMC label on the “P9” pin)
Xiaomi LYWSD03MMC has a PCB soldering test point. Available without disassembling the case and marked “P9”. Use as a trigger output with adjustable temperature and / or humidity hysteresis. Hysteresis and thresholds are set in TelinkMiFlasher.html. The output status is displayed in the advertising package.
Hysteresis:
Setting the pin to “1” or “0” works if both hysteresis are set to zero (TRG off).
Trigger and reed switch status receiver on JDY-10 module ($1).
Reed switch or button functions
For CGG1, MHO_C401, CGDK2, MJWSD05MMC, a button on the case is used.
It is possible to solder a reed switch on the LYWSD03MMC board to the pins marked “P8” (GPIO PA6) and GND.
Reed switch: additional information
The button on the body can turn the light on and off when creating a scenario in an external program…
The state of the reed switch or button is transferred to the advertising packet and events are sent in the “Switch” and “Counter” modes.
Setting the “Connect” option has several functions:
Interface for receiving and displaying data on the LCD.
The USB-COM adapter writes the firmware in explorer. Web version.
USBCOMFlashTx.html - Uses a partial imitation of the
Telink 1-Wire
protocol on a USB-UART adapter, but only for transmission to the chip.For programming and debugging, the chip uses a special hardware protocol
Telink 1-Wire
(not even close to UART!).To match the frequencies of the Telink 1-Wite bus, no change in Baud-rate is required.
While the chip is sleeping and when the SWS pin is reassigned, there is no access to programming.
You can restore communication via “Telink 1-Wire” by rebooting the chip and sending a command to stop the CPU. This is called “Activation”.
The USBCOMFlashTx.html program does not have feedback - it does not receive data from the chip. This is a simplified version and only works if all connections are made correctly.
In difficult cases, when the chip contains an unknown FW, it is necessary to use a chip reset or power supply during “activation”.
At the same time, take into account that the chip can be powered from the TX output. This is solved by connecting TX and +Vbat during “activation”.
Alternative programmers:
Telink 1-Wire
on a USB-UART adapter.Chipset LYWSD03MMC HW:B1.4
LYWSD03MMC B1.4 B1.5 BoardPinout
For LYWSD03MMC, the HW version is determined by the display and sensor addresses on I2C:
Version 1.7 or 2.0 is determined at first run by reading the HW line written in Flash. Display matrices or controllers are different for all versions, except B1.7 = B2.0.
Building the firmware
Windows:
Ubuntu:
Related Work
ATC_MiThermometer is based on the original work of @atc1441, who developed the initial custom firmware version and the web-based OTA flasher (Source).
Resources & Links
HTML files & IDs numbers of alternative firmware
Telink Linux Tool Chain 2020-06-26
LYWSD03MMC Forum link (russian)
MHO-C401 Forum link (russian)
Solar powered Bluetooth Thermometer with Supercap
Control function ID when connected
Primary Service UUID 0x1F10, Characteristic UUID 0x1F1F