7-in-1 Smart Home Kit Using ESP32-C6 and Matter

by techiesms in Circuits > Wireless

231 Views, 0 Favorites, 0 Comments

7-in-1 Smart Home Kit Using ESP32-C6 and Matter

fd3d46bf-b87c-41d8-8fff-6697f1040977.png
fd3d46bf-b87c-41d8-8fff-6697f1040977.png
xmk_02_kit.jpg
xmk_01_title.jpg

Over the last few months, we made a full ESP32 Matter Series on our channel. In 7 episodes, we built one Matter device at a time: a smart light, a scene button, a temperature sensor, an RGB light, a motion sensor and a fan speed controller.

For the final episode, we put all of them on one small board. We call it the XIAO Matter Kit.

It runs on the Seeed Studio XIAO ESP32-C6 and shows up as 7 different smart home devices at the same time. You pair it once, and you can control everything from Alexa, Google Home, Apple Home or Home Assistant. No extra app and no hub needed.

Key Features

  1. 7 Matter Devices in One Board: Light, scene button, temperature, humidity, RGB light, motion sensor and fan.
  2. Works Everywhere: Alexa, Google Home, Apple Home and Home Assistant.
  3. 4-Speed Fan Control: Use the app, your voice, a knob (potentiometer) or a push button.
  4. Physical Buttons: 3 buttons for light, scene and fan speed.
  5. Remembers Last State: After a power cut, everything comes back the way it was.
  6. One Simple Code: No Wi-Fi password or login needed in the code.

Supplies

Here is everything you need to build this kit. You can buy the parts one by one, or get the complete XIAO Matter Kit.

  1. Seeed Studio XIAO ESP32-C6 x1
  2. DHT11 Temperature & Humidity Sensor x1
  3. PIR Motion Sensor x1
  4. WS2812B RGB LED (NeoPixel) x2
  5. 5V Relays x4 (1 for light, 3 for fan)
  6. Push Buttons x3
  7. Potentiometer x1
  8. Fan capacitors (for fan speed control)
  9. Custom PCB from NextPCB (or a Breadboard for testing)

What Is the Matter Protocol?

matter_1.jpg

Matter is a new smart home standard. It lets smart devices from different brands talk to each other in one common language.

Before Matter, every brand had its own app and hub. An Alexa device might not work with Google Home, and an Apple device might not work with Alexa. Matter fixes this problem.

Why Matter is useful:

  • One device, all apps: A Matter device works with Amazon Alexa, Google Home, Apple Home, Samsung SmartThings and Home Assistant.
  • Works locally: Devices talk to each other over your home network, so they are fast and still work even if the internet is slow.
  • Easy setup: You pair a device by scanning a QR code or typing a short pairing code.
  • Secure: Every device is checked and all messages are encrypted.
  • Multi-admin: You can add the same device to more than one app at the same time (for example Alexa and Google Home).

How it works (simple view):

  • Matter runs over Wi-Fi, Thread or Ethernet.
  • Bluetooth is used only at the start, to set up (commission) the device.
  • Our kit uses Matter over Wi-Fi.

Why the XIAO ESP32-C6?

The ESP32-C6 has Wi-Fi 6, Bluetooth LE and Thread (802.15.4) on one small chip. The ESP32 Arduino core already has Matter support built in, so you can make a Matter device with just a few lines of code. That's why we used it for the whole series.

One Board, 7 Smart Devices

xmk_23_final.jpg

Now that you know what Matter is, let's see what our kit can do.

In Matter, one board can show up as many devices. Each device is called an endpoint. Our kit has 7 endpoints:

  1. Light - a relay to turn a bulb on or off (Episode 1 & 2)
  2. Scene Button - a button you can link to any Alexa routine (Episode 3)
  3. Temperature - from the DHT11 sensor (Episode 4)
  4. Humidity - from the same DHT11 sensor (Episode 4)
  5. RGB Light - two WS2812B LEDs that can show any color (Episode 5)
  6. Motion Sensor - a PIR sensor that detects people (Episode 6)
  7. Fan - 4-speed control using relays and capacitors (Episode 7)

We won't explain every part in detail here. If you want to learn how each one works, watch the single episodes in our ESP32 Matter Series playlist.

Circuit Schematic

xmk_03_schematic.jpg

We made the schematic episode by episode, so it is easy to follow. The XIAO ESP32-C6 sits in the middle and every part connects to it.

Pin Connections:

  • Fan speed knob (Potentiometer) → D0
  • PIR Motion Sensor → D1
  • WS2812B RGB LEDs → D2
  • Light Relay → D3
  • Fan Relays → D4, D5, D6
  • DHT11 Sensor → D7
  • Light Button → D8
  • Scene Button → D9
  • Fan Button → D10

The fan speed uses the capacitor dimming method. Three relays switch different capacitors in series with the fan. This gives us 4 speed levels (plus off).

Tip: Want to try it on a breadboard first? You can. Just use the same pins.

Custom PCB

xmk_08c_box.jpg
xmk_09_pcbs.jpg
xmk_05_pcb_3d_front.jpg
xmk_11_soldering.jpg

After the schematic, we designed a custom PCB. We put all the parts on the board itself: the PIR sensor, DHT11, potentiometer, RGB LEDs and relays. No loose wires.

All parts are on the top side and the bottom side is empty. This keeps the board small and easy to assemble.

We ordered the PCBs from NextPCB. Just upload the Gerber file, choose the quantity and color, and add a stencil for the top side. The PCBs came in about a week, in vacuum packing, and the quality was really good.

Sponsored by NextPCB:

The PCBs for this project were made by NextPCB. They offer PCB prototyping, SMT assembly, multilayer boards and free DFM checks. If your next PCB project is ready, give NextPCB a try.

PCB Assembly

The assembly is simple:

  1. Apply solder paste on the PCB using the stencil.
  2. Place all the SMD parts.
  3. Put the board on a hot plate until the solder melts.
  4. Solder the through-hole parts (relays, sensors, buttons and XIAO headers) by hand.

Check for shorts with a multimeter before you power it on. That's it, the hardware is ready!

Uploading the Code

xmk_13_serial_code.jpg

The code is a mix of all 7 episode codes. If you use the same pins as us, you don't need to change anything. No Wi-Fi name, password or login is needed.

  1. Download the code from our GitHub (open the Episode8 folder).
  2. Use these versions (we tested with them):
    • Arduino IDE 2.3.7
    • ESP32 Boards Package v3.3.6 (Matter is already inside)
    • Adafruit NeoPixel library v1.15.5
    • DHT Sensor library v1.4.6
  3. Go to Tools > Board and select XIAO_ESP32C6.
  4. Select the right COM port.
  5. Go to Tools > Partition Scheme and select Huge APP (3MB No OTA).
  6. Turn on Tools > Erase All Flash Before Sketch Upload.
  7. Click Upload.

After the upload, open the Serial Monitor. You will see a manual pairing code and a QR code link. Keep it open for the next step.

Tip: To reset the board and pair it again, long press the BOOT button on the XIAO.

Pairing With Alexa

xmk_14_alexa_pair.jpg
xmk_15_alexa_devices.jpg

We used the Alexa app here. Google Home and Apple Home work in a similar way.

  1. Open the Alexa app and tap the + icon.
  2. Tap Add Device.
  3. Tap the Matter icon. If you don't see it, scroll down to Other and choose Matter.
  4. Tap Yes, then Try Numeric Code, then Enter Code.
  5. Type the pairing code from the Serial Monitor. Tap Next, then Connect.
  6. Keep your phone and Echo speaker close to the kit while it pairs.

After a few seconds, Alexa finds all 7 devices. Tap the X and open the Devices tab to see them.

Testing All Features

xmk_16_temp.jpg
xmk_17_rgb.jpg
xmk_18_motion.jpg
xmk_19_light.jpg
xmk_20_fan.jpg

Now let's test everything one by one.

  • Temperature & Humidity: Open these devices in the app. You will see live values from the DHT11.
  • RGB Light: Turn it on or off and change the color from the app.
  • Motion Sensor: Wave your hand and it shows "Motion detected". Stay still and it changes to "No motion".
  • Light: Turn it on from the app, or press Button 1. The app always shows the right state.
  • Fan: You can control the speed in 4 ways: the app slider, Alexa voice, the potentiometer knob, or Button 3 (each press goes 1 → 2 → 3 → 4 → off).

In the video, we used a filament bulb in place of a fan, so you can see the speed levels as brightness.

Make Your Own Projects With Routines

xmk_21_custom_button.jpg
xmk_22_routine.jpg

Here is the fun part. You can make new projects without changing the code. Just create routines in the Alexa app.

Example: Scene button changes the RGB color

  1. In the Alexa app, go to More > Routines and tap +.
  2. For When this happens, choose the scene button (First Remote) and select Single Press.
  3. For Add action, go to Smart Home > Lights, choose the RGB light and set the color to Blue.
  4. Tap Save.

Now press the scene button, and the LEDs turn blue!

More ideas to try:

  • Turn on the light when motion is detected.
  • Play a welcome message on Alexa when the button is pressed.
  • Turn on the fan when the temperature goes above 30°C.

Conclusion

xmk_24_final2.jpg

And that's it! One small board, one code and 7 Matter smart home devices. It is a great kit to learn Matter and try new smart home ideas.

Resources:

If you make your own version, share it in the comments. And tell us which series we should make next!