System to monitor environmental conditions by displaying temperature, humidity and CO2 concentration levels.
The system is built with a dual microcontroller setup:
- Master Microcontroller: ESP32 OLED
- Secondary Microcontroller: ESP32-WROOM-32D, for CO2 acquiring
The environmental data acquiring is done using two sensors: a DHT-22 for the temperature and the humidity, and an MH-Z19B for the CO2 concentration.
Upon powering up, the master microcontroller initiates the display with "acquiring..." placeholders for each metric as it awaits data.
The temperature and humidity values arrive during the first ten seconds after the system is turned on, but the CO2 sensor sometimes needs to calibrate. In this case, the CO2 field displays "calibrating...".
After calibrating the CO2 sensor, the system has completely finished initializing and can display all environmental information to the user.
If the system detects a problem with sensor data, it displays a message to warn the user:
- "incoherent": Displayed when data is beyond plausible ranges (e.g., humidity > 100%). Note that the detection of incorrect values does not work if the value is negative, so as not to risk masking error codes which are represented by negatives.
- "error reading sensor": Shown when there's a hiccup in sensor data retrieval.
- "nothing received": Appears after 20 unsuccessful attempts to read from a sensor.
The system's assembly and power configurations are detailed below. You can power the system through either the CO2-dedicated ESP32 or the ESP32 OLED.
The software was developed using:
- IDE: VSCode
- Platform: PlatformIO
- Framework: ESP-IDF (Espressif IoT Development Framework) for ESP32-DevKitC
Connectivity to the development PC is established via the CP210x USB to UART bridge driver.