multigcs / z03mmc

Xiaomi LYWSD03MMC Zigbee Firmware

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Zigbee 3.0 Firmware for original LYWSD03MMC Sensor

This repository contains the Zigbee firmware for Xiaomi LYWSD03MMC Bluetooth temperature and humidity sensor.

Forked from https://github.com/devbis/z03mmc/

my Changes

  • optional switch output (to control relais or light)

  • optional switch input (for light switches)

  • optional switch input (for window/door contact or presense sensors)

  • optional disable lcd-display (too minimize delays)

known issues

  • sometimes 1-3s delay while toggle the switch output

comments

i have problems to flash the devices, best way for me at the moment:

  • using pl2303hx usb adapter
# erase complete flash with one tool
python3 TLSR825xComFlasher.py -p /dev/ttyUSB0 -b 500000 ea
# then write with an other tool
python3 ATCtelink.py  --port /dev/ttyUSB0 --baud 500000 build/src/z03mmc.bin

found my problem, timing issue, my USB-Adapter have no Crystal and depends on temperature, order a new one

Overview

The LYWSD03MMC is a Bluetooth temperature and humidity sensor that can be integrated into a Zigbee network using this firmware. This repository hosts the code and related resources to flash the device and make it compatible with Zigbee networks.

Features

Getting Started

Prerequisites

  • Zigbee compatible hardware (e.g., Zigbee coordinator or gateway).
  • Necessary tools for flashing firmware to the sensor.

Building firmware

  1. Clone TC32 toolchain according to your host OS:

    git clone https://github.com/devbis/tc32.git -b linux
    git clone https://github.com/devbis/tc32.git -b macos
    git clone https://github.com/devbis/tc32.git -b windows
  2. Clone this repository and SDK:

    git clone https://github.com/devbis/z03mmc.git
    git clone https://github.com/devbis/tl_zigbee_sdk.git -b 3.6.8.5 --depth 1
    
    cd z03mmc
  3. Configure and build:

    cmake -DSDK_PREFIX=$(pwd)/../tl_zigbee_sdk -DTOOLCHAIN_PREFIX=$(pwd)/../tc32 -B build .
    cmake --build build --target z03mmc.zigbee

    Firmware binary is located at build/src/z03mmc.bin The binary with OTA header is at the same folder, ending with z03mmc.zigbee

Flashing firmware with USB to UART

Prerequisites:

  1. TTL-USB adaptor
  2. 1k-1.8k Ohm resistor
  3. python3 with pyserial module installed

To flash a new firmware via an standard USB to UART adapter, simply connect the Thermometer as seen in the picture Mi_SWS_Connection.jpg to the USB to UART converter and run the TLSR825xComFlasher.py tool.

Example: python3 TLSR825xComFlasher.py -p COM3 wf 0 z03mmc.bin

Example: python3 TLSR825xComFlasher.py -p /dev/ttyUSB0 wf 0 z03mmc.bin

In case if the SWS pin is used by the firmware, try this sequence:

  1. Power off the sensor
  2. python3 TLSR825xComFlasher.py -p <YOUR_COM_PORT> -t5000 wf 0 z03mmc.bin
  3. Now you have 5 seconds to power on the sensor
  4. In case the chip has not started being flashed, run python3 TLSR825xComFlasher.py -p <YOUR_COM_PORT> wf 0 z03mmc.bin without the timeout again.

If the flashing fails try to increase timeouts in the script.

The UART flasher software uses the tool from https://github.com/pvvx/ATC_MiThermometer. Thanks to pvvx for the awesome work on this!

Related Work

z03mmc is based on the original work of @pvvx, and @atc1441, who developed the initial firmware versions for bluetooth-capable device.

Usage

  1. Flash the firmware
  2. Enable pairing mode on Zigbee coordinator
  3. In case it is not joining, close the RESET and GND contacts on the board for 3 seconds to reset Zigbee settings. Replug the battery may require.
  4. It introduces itself as Heiman STHM-I1H model to match the model in zigbee2mqtt and other controller software tools

License

This project is licensed under the GNU General Public License 3.0 or later - see the LICENSE.txt file for details.

About

Xiaomi LYWSD03MMC Zigbee Firmware

License:GNU General Public License v3.0


Languages

Language:C 70.8%Language:Python 22.7%Language:CMake 5.9%Language:JavaScript 0.6%