A Rust-based air quality monitoring system using ESP32-C3 microcontroller, SCD41 CO2 sensor, and SSD1306 OLED display.
- Measures CO2, temperature, and humidity using Sensirion SCD41 sensor
- Displays readings on a SSD1306 OLED display
- Broadcasts readings over BLE (GATT server)
- Written in Rust using esp-idf framework
- Periodic measurements with configurable interval
- Error handling and display
- Automatic disabling of the onboard LED (GPIO 8) to prevent interference
- ESP32-C3 development board (e.g., ESP32-C3 DevKitM-1)
- Sensirion SCD41 CO2 sensor
- SSD1306 OLED display (128x64)
- I2C connections:
- SDA: GPIO4
- SCL: GPIO5
- Install Rust and ESP-IDF toolchain
- Clone the repository:
git clone https://github.com/arietis/esp32-co2-monitor.git cd esp32-co2-monitor - Build the project:
cargo build
- Flash to ESP32:
cargo run
The default measurement interval is 5 seconds. You can modify this in src/main.rs:
const MEASUREMENT_INTERVAL_MS: u32 = 5000;The firmware exposes sensor readings over BLE using a custom GATT service:
- Device name:
ESP32-CO2 - Service UUID:
c892f08b-0502-49a6-8c52-b959aa997e54 - Characteristics:
- CO2:
00002b8c-0000-1000-8000-00805f9b34fb - Temperature:
00002a6e-0000-1000-8000-00805f9b34fb - Humidity:
00002a6f-0000-1000-8000-00805f9b34fb
- CO2:
This project is licensed under the MIT License - see the LICENSE file for details.