The Air Quality Sensor project contains two parts:
- Internal unit - the main unit placed inside the building
- External unit - the unit placed outside the building This repository contains the hardware and software definitions for the external unit. In the current state it's based on ESP32C3 module from DFRobot and communicate with the internal unit by ESP-NOW protocol. The temperature, humdity and pressure are measured each minute. The PMx values are measured each hour.
- Beetle ESP32-C3 main microcontroller board
- SPS30 sensor for particles matter measurement
- BME280 sensor for temperature, humidity and pressure measurement
- Pololu Mini MOSFET Switch low voltage module switch
- Pololu U1V10F5 5V step-up module
- Module with microUSB socket 5V power module
- Li-Pol Akyga 1950mAh 1S 3,7V Li-Pol accumulator
- Prototype board used to fit most of the components
Alternalively, the ESP32-based compact boards like Lolin32-Lite could be used, the possible parts and schematics are described here
- esp-idf main framework
- general-support-library common embedded library
- SimpleDrivers simple embedded drivers for SPS30 and BME280 sensors
The microcontroller, switch, step-up converter and BME-280 sensor are placed on the prototype board. It has to be cut to fit the size of the external cover. The SPS30 sensor and micro-USB socket module are placed aside and connected to the main board by the wires. The frame and cover parts are 3D printed.
The firmware is based on ESP-IDF framework (tested version is 4.4.6) and is written in C++17 language. The main task is to read the data from sensors and send them to the internal unit via Esp-Now protocol. The firmware is divided into several modules:
- components - contains the code of the external unit
- general-support library - contains the code for general support functions, obtained from this repository.
- SimpleDrivers - contains the code for the SPS30 and BME280 drivers, obtained from this repository.
- main - contains the main code of the external unit's firmware
- AppConfig - contains the code for the application's configuration
- AppMain - contains the app_main() function and hosts the controller object.
- EspNowTransport - contains the code for the communication with the main unit based on Esp-Now protocol
- DustMonitorController - contains the code for the controller class handling the main logic of the firmware
- PTHProvider - contains the code for the class providing the data from BME280 sensor
- SPS30DataProvider - contains the code for the class providing the data from SPS30 sensor
- CMakeLists.txt - main CMake file for the firmware
- sdkconfig - default configuration file for the ESP-IDF framework.
The main CMakeLists.txt file could be opened directly in IDE. To build manually, do the following steps:
mkdir build
cd build
cmake -DIDF_TARGET=esp32c3 -G Ninja ..
cd ..
idf.py build