This project implements an air quality monitor using a BME680 environmental sensor and a Seeed Studio XIAO ESP32C3 microcontroller. It measures air quality, temperature, humidity, and CO2 levels, and integrates with HomeKit for easy monitoring. The project is developed using PlatformIO.
- Air Quality Index (AQI) measurement
- VOC (Volatile Organic Compounds) detection
- Temperature and humidity monitoring
- CO2 equivalent estimation
- Battery voltage monitoring
- HomeKit integration for easy access to sensor data
- Configured for 3.3V operation of BME680
- Sensor readings updated every 5 minutes
- Seeed Studio XIAO ESP32C3
- BME680 environmental sensor
- Battery (for portable operation)
- PlatformIO
- HomeSpan library
- BSEC2 library
-
Clone this repository:
git clone https://github.com/annoyedmilk/AirQualityMonitor.git
-
Open the project in PlatformIO.
-
PlatformIO should automatically detect and install the required libraries based on the
platformio.ini
file. If not, you can manually install them:- HomeSpan
- BSEC2
-
Connect the BME680 sensor to your XIAO ESP32C3:
- SDA to pin 20
- SCL to pin 21
- VCC to 3.3V
- GND to GND
-
If using a battery, connect it to pin 2 for voltage monitoring.
-
Build and upload the project to your XIAO ESP32C3 using PlatformIO.
- After uploading, power on the device.
- The device will appear as a HomeKit accessory.
- Add the accessory to your HomeKit setup using the Home app on your iOS device.
- You can now monitor air quality, temperature, humidity, and battery level through the Home app.
- The sensor is configured to use the Default_H2S_NonH2S configuration for the BME680.
- Sensor readings are updated every 5 minutes.
- Battery voltage is mapped to a percentage (0-100%) based on a range of 3.4V to 4.2V.
- Project-specific configurations can be found in the
platformio.ini
file.
To make changes or contribute to the project:
- Make your code changes.
- Use PlatformIO's build system to compile the project and check for errors.
- Test your changes thoroughly.
- If you're using VS Code with PlatformIO extension, you can use the PlatformIO toolbar for building, uploading, and monitoring.
Contributions to improve the project are welcome. Please follow these steps:
- Fork the repository
- Create a new branch (
git checkout -b feature/AmazingFeature
) - Make your changes and commit them (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
- HomeSpan for the HomeKit integration
- Bosch Sensortec for the BME680 sensor and BSEC library
- PlatformIO for the development platform