Nothing on this page will run on a bare S3. The page below is unchanged — read it if you are planning ahead or using a different board.
Zigbee, Thread and Matter
The C6 and H2 have a second radio that is not Wi-Fi and not Bluetooth. It does something neither can - messages hop from device to device - and it is what gets a homemade sensor into Apple Home without an app.
Why a mesh needs a wall socket
The three words, untangled
- 802.15.4 — the radio. Low power, low rate, 2.4 GHz, built for hopping.
- Zigbee and Thread — two networking layers on that radio. Thread carries IP addresses, which is why it is the one with a future.
- Matter — the application layer above either, plus Wi-Fi. Matter is what makes a device appear in Apple Home, Google Home and Alexa without an app of your own.
What you need in the house
A border router — an Apple TV, a HomePod, a Nest hub, or an ESP32 running one — bridges the 802.15.4 network to your Wi-Fi. Without one, a Thread device has nothing to talk to.
When to use it instead of Wi-Fi
When the device runs on a coin cell and must be reachable at any moment. Everything else — a mains sensor, a display, anything sending more than a few bytes — is simpler over Wi-Fi and MQTT.
The code
The Arduino Zigbee library wraps a great deal of machinery. What you write is the device type and the value - joining, routing and rejoining are handled below you.
#include "Zigbee.h"
ZigbeeTempSensor sensor(10); // endpoint number
void setup() {
Serial.begin(115200);
sensor.setManufacturerAndModel("Lonely Binary", "Greenhouse");
sensor.setMinMaxValue(-20, 60);
Zigbee.addEndpoint(&sensor);
// END_DEVICE sleeps. ROUTER stays awake and forwards for others.
if (!Zigbee.begin(ZIGBEE_END_DEVICE)) {
Serial.println("failed to start");
return;
}
while (!Zigbee.connected()) delay(100);
}
void loop() {
sensor.setTemperature(21.4);
sensor.report();
delay(60000);
}Select the Zigbee end-device partition scheme in the IDE, or it will not fit. This is the one place where a menu you have never opened decides whether the sketch compiles.
There is no MicroPython support for Zigbee, Thread or Matter on these chips. This is a C-side feature today, and it is worth saying plainly rather than leaving you to discover it.
# Zigbee, Thread and Matter on the C6 and H2 are ESP-IDF and Arduino only.
#
# If the project must be MicroPython, the practical route is:
# sensor --ESP-NOW or BLE--> a C-side gateway --Matter--> the home
#
# or skip the mesh entirely and use MQTT over Wi-Fi.The C6's MicroPython build has Wi-Fi and BLE. The 802.15.4 radio is not exposed, and there is no timeline for it.
When it does not work
It joined as an end device with no router in range, or the parent it chose has gone. A mesh needs mains-powered nodes to relay - a network of battery devices is not a mesh.
Matter needs a border router on the network - a HomePod, an Apple TV, or a Google Nest hub. Without one there is nothing to bridge Thread to your Wi-Fi.
Choose the Zigbee partition scheme in Tools. The stack plus the certificates does not fit the default layout.
Correct - they have no 802.15.4 radio. Among the chips here it is the C6, plus the H2 which has the radio and no Wi-Fi.
A mesh covers a house. The next page covers a valley, at the cost of almost all the bandwidth.
LoRa for long range →Edit this page — content/esp32/zigbee-thread-and-matter.mdx
Discuss this article
Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.