Skip to content

kochaika/m20c-thread-proxy

Repository files navigation

Matter logo

M20C Thread Proxy

A Matter-over-Thread proxy for the Zhiyun FIVERAY M20C RGB LED light, running on a Seeed Studio XIAO ESP32-C6.

The ESP32-C6 exposes a Matter Extended Color Light device over Thread and proxies all commands to the M20C via on-demand BLE.

Note: use your own device, partition name and other parameters value. This is not a complete guide.

Features

  • Power on/off
  • Brightness control (0–100%)
  • CCT color temperature (2500–10000K)
  • Hue/Saturation color control
  • Battery level reporting (polled periodically via BLE)
  • Status LED on GPIO15 — lights up while BLE is connected to M20C

How It Works

The XIAO ESP32-C6 uses its 802.15.4 radio for Thread (Matter transport) and its BLE radio to talk to the M20C. BLE connections are on-demand: the proxy connects to the M20C only when a Matter attribute changes or when polling battery, then disconnects.

The M20C BLE protocol is documented at kochaika/m20c-ble-api.

Configuration

Set the M20C BLE MAC address before building:

idf.py menuconfig
# → M20C Thread Proxy Configuration → M20C BLE MAC Address

Other configurable options:

  • Battery poll interval (default: 60s)
  • BLE connect timeout (default: 5000ms)

Resources

Clone

Clone this repo to the esp-matter directory.

Environment Setup

Open IDF Terminal, navigate to esp-matter directory.

  1. source ./export.sh
  2. export IDF_CCACHE_ENABLE=1

Restart from scratch

idf.py fullclean
rm -rf build/
esptool.py --chip esp32c6 --port /dev/cu.usbmodem2101 erase_flash

Build and Flash

Navigate to this project directory.

  1. idf.py set-target esp32c6
  2. idf.py build
  3. idf.py -p /dev/cu.usbmodem2101 flash

Debug

Should be enabled before. It was disabled here.

idf.py -p /dev/cu.usbmodem2101 monitor

Generating pair codes with partitions

esp-matter-mfg-tool -n 1 \
  -v 0xFFF1 -p 0x8001 \
  --vendor-name "ChaikaMatter" \
  --product-name "M20C_Proxy" \
  --hw-ver 1 --hw-ver-str "1.0"

Flashing partitions

esptool.py --chip esp32c6 --port /dev/cu.usbmodem2101 write_flash 0x10000 out/fff1_8001/**/**-partition.bin

Hardware Configuration

Antenna

An external UFL antenna is used for Thread communication. The FM8625H RF switch on the XIAO ESP32-C6 is configured at startup via GPIO3 (enable) and GPIO14 (antenna select).

Status LED

The built-in LED on GPIO15 indicates active BLE connection to the M20C (cathode on GPIO, active-low).

About

Thread proxy for Zhiyun FIVERAY M20C light

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors