CO2 Temperature Humidity Sensor on ESP32 (Thinger.io connected) - atzounis/arduino-projects GitHub Wiki
Intro - Components
In this project, you can see a working example of a CO2 sensor (COZIR AH-5000) that additionally offers Temperature and Relative Humidity readings for indoor air quality monitoring.
The components (Nokia-type LCD screen, ESP32 board, COZIR CO2/Temperature/R.Humidity sensor.
The LCD screen pinout.
The sensor pinout.
The components are assembled on a prototyping board.
The device going live!!!
Connections
COZIR Sensor
- GND -> GND sensor
- RX2 -> TX sensor
- TX2 -> RX sensor
Common connection
- 3V3 -> VCC (sensor) + VCC (screen)
NOKIA Screen
- GND -> GND Screen
- D15 -> CE
- D2 -> RST
- D4 -> DC
- D18 -> CLK
- D23 -> DIN
Air Quality Logic
In this code, you will notice some logic correlating CO2 levels with Air Quality. We consider the concentration between 300 - 1099PPM as healthy air, 1100 - 1999PPM as needing aeration, and 2000 - 4999PPM as dangerous air. You can see more information related to this logic here.
ThingerIO Panel
The sensor is connected to Thinger.io platform over wifi. A number of widgets are created including two text widgets (Temperature and Relative Humidity) showing the latest reading, a gauge widget showing the latest reading of CO2 concentration, and two charts showing the trends of temperature, relative humidity, and CO2 for the last 7 days, and, in 15-minute intervals. You will also notice a slider button that when activated sends a Fresh Air Calibration command to the sensor remotely via Thinger.io. This is a particularly useful feature as the sensor may need to be moved to an outdoor space and get calibrated in fresh air (i.e. in 400PPM).
A view of the Thinger.io widgets and the charts.
It is always useful to include the #define _DEBUG_
tag at the top of your *.ino file. It helps a lot to identify all sorts of issues or failures, for example, communication errors while your device is attempting to communicate with Thinger.io. In my case it was needed to add the tag: #define _DISABLE_TLS_
to overcome the connection failures
See the Thinger.io documentation related to ESP32 board here.
BOM
The materials used in this project are the following: