This repository contains an example code to flash an ESP32-C6 and enable Zigbee functionality, allowing it to be discovered as an on/off light bulb. This project is designed to be used with PlatformIO.
Before getting started, ensure you have the following installed on your machine:
- PlatformIO (recommended for dependency management and flashing)
- ESP-IDF (if you prefer using ESP-IDF directly)
- An ESP32-C6 with Zigbee-compatible firmware
- A development environment configured for PlatformIO (e.g., VSCode with the PlatformIO extension)
- src/: Contains the application source code.
- include/: Contains header files.
- partitions.csv: Partition table file for the ESP32-C6.
- platformio.ini: PlatformIO configuration file.
Clone this repository to your local machine:
git clone https://github.com/technoo10201/esp32-c6-zigbee-example-platformio
cd esp32-c6-zigbee-example-platformioOpen the project in VSCode with PlatformIO. Ensure the platformio.ini file is properly configured for your environment.
Before flashing the code, you need to flash the partitions to the ESP32-C6. Use the following command in the PlatformIO terminal:
pio run --target uploadfsThis will flash the partitions defined in partitions.csv to the ESP32-C6.
Once the partitions are flashed, you can flash the code to the ESP32-C6 using the following command:
pio run --target uploadTo view the logs from the ESP32-C6, use the following command:
pio device monitorOnce the code is flashed, the ESP32-C6 should be discovered as a Zigbee light bulb in your Zigbee network. You can use a Zigbee control application (such as Zigbee2MQTT or a compatible app) to interact with the light bulb.
The main code is located in src/main.cpp. It implements a basic Zigbee light bulb with the following features:
- Turn the light bulb on/off
- Respond to Zigbee commands