DIY an open source air quality monitor
Source: InternetPublisher:司马缸砸光 Keywords: Sensors DIY Air Quality Monitors Updated: 2024/12/13
Hello everyone! Today I want to share my new DIY project with you. It is an open source air quality sensor.
This project uses Sensorion's new product - TVOC sensor SGP40. It also uses a 2.13-inch e-ink display. Since we are spending more time at home now, I made this air quality monitor.
In addition to assessing air quality, the sensor can also estimate indoor light levels, temperature, humidity and atmospheric pressure. Based on the atmospheric pressure data, the device can predict the weather forecast.
The sensor is designed for nRF52 microcontrollers and 4 versions of the PCB have been developed for nRF52 radio modules from different manufacturers. One main version and three more extended versions (explained later in the text).
Radio module models used in the project: Main MINEWMS88SF3 (nRF52833, nRF52840), Additional: MINEWMS50SFA1 (nRF52810, nRF52811), MINEWMS50SFA2 (nRF52832), EBYTEE73-28RFC3040
Sensors used in the sensor room (nRF52833, nRF52840) Air quality sensor for VOC measurement - SGP40, Pressure, temperature and humidity sensor - BME280, Illuminance sensor MAX44009.
Later, due to problems with the production of electronic components and the incredible price increases of many components, the BMP280 and SHTC3 sensors were added to the project, which were functionally replacements for the BME280 sensors. For this purpose, three additional modifications were made to the board, which also added support for additional radio modules, added polarity reversal protection, and improved the design of the board.
The device can display data on a screen and transmit data to a smart home system, and it can also work in an "offline" mode.
To display information, WaveShare's ultra-low-power 2.13-inch E-Ink display is used.
Display features:
Resolution: 250x122
Operating temperature range: 0-50C
Running consumption: 3mA
Deep sleep consumption: 1μA
Minimum screen refresh time: 0.3 seconds.
Later I plan to add support for DESe-Ink2.13 displays with an operating temperature of -20C ~ 60C to this project.
Basic version of PCB sensor:
Additional versions:
I have written before that the main sensor in this project is the SGP40 Indoor Air Quality Sensor. It can be said that this is a new product launched on the market by Sensorion with very good characteristics.
The sensor measures total volatile organic compound (TVOC) concentrations. Power consumption is significantly reduced compared to the company’s previous SGP30 sensor, at 48mA when measuring with the SGP30 and 2.6mA when measuring with the SGP40. Granted, the previous sensor provided ready-made values for VOC and CO2 equivalents, whereas the new product provides raw data that must be further processed on the MK end using the libraries and air quality calculation algorithms that come with the sensor. SGP40 sensor data sheet.
I had to modify the Adafruit_SGP40 library to run in ultra low device power mode with small batteries. Added work on the sensor heater, receiving, saving, unloading the current state of the sensor fast start algorithm, for example after changing the battery, bypassing the learning mode. For some reason nobody bothered about these moments and I couldn't find a ready-made library that supports all the features of the sensor. The modified library is on my GitHub. Maybe this is because the SGP40 is a fairly new product.
Equipment diagram:
The data transmission from sensors to the smart home system is based on the MySENSORS open source home automation project.
I will briefly describe the sensor's functionality. When switched on, the device tries to find a network, if no network is found, the device enters the main operating mode, not working on the network (not sending data), but regularly making short search requests to the network (~ every 2 hours). The polling interval for the SGP40 sensor is 3 seconds, the remaining sensors are read, data is sent and the screen is refreshed every 1 minute (in main mode). The screen is refreshed and data is sent when the air quality level (TVOC) data changes by 10 units, the temperature changes by 0.5C, the humidity changes by 5%, the pressure changes by 1 unit, when the light changes by 10 lux (if the network is available) and when the weather forecast changes.
There is an additional subroutine that updates the screen and sends data if the TVOC level rises sharply by 30 units, with a check interval of every 6 seconds.
When the device is powered on for the first time, a training cycle of the air quality calculation algorithm is performed; in my implementation, the maximum training time is 12 hours. After learning, the sensor starts saving the current state of the algorithm in the memory of the MC at four-hour intervals. When the device is restarted, when the device resumes operation after shutdown, and when the battery is replaced, it checks whether the algorithm status record exists. If so, this data is unloaded and the device skips the 12-hour learning period.
The device has a "Menu" button. Available functions of the "Menu" button: 1. Screen inversion, 2. Send demo, 3. Enter configuration mode (receive external commands via radio, 4. Search network, 5. Reset device.
In addition to the "Menu" button, the sensor can also be configured by external commands from the smart home system interface. To do this, activate the required menu item "Sensor configuration" by pressing the "Menu" button. After activating the configuration mode, the sensor will go into listening mode for 20 seconds. The commands must be sent within this time interval. The external commands make it possible to set the battery check interval, change the inversion of the screen information display, select the operating mode: LP (read the SGP40 sensor every 3 seconds) or ULP (read the SGP40 sensor every 5 seconds).
The sensor can analyze the atmospheric pressure data and calculate the weather forecast based on it, display the weather forecast data on the screen, and send these values to the smart home system. Weather Forecast Calculation Algorithm Description - (NXP Application Note 3914 | John B. Young)
An indication of the direction in which the value changes appears on the screen next to each type of data.
To compile the required software version, you need to configure the aConfig.h file.
The sensor consumes an average of 33μA in sleep mode (see datasheet on SGP40), 4mA (average) in sensor reading and screen refresh mode, 8mA (average) in data transfer mode, the transmission time for one message is 10ms (under ideal conditions). The sensor operates on a CR2477 battery (950mA), the average estimated operating time of the device is 1 year (depending on firmware configuration, sensors installed on the device, more sensors will need to send more data, over the air transmission is the main consumer).
I printed a model of the developed sensor housing on a FDM3D printer to achieve a more or less decent look, after the printed body was polished. The magnets can be mounted inside the housing.
GitHub
The Readme file contains instructions for installing and configuring your environment to edit and compile the sensor software.
Open Source Hardware Certification
OSHWAUID:RU000004
- How to Make a Pet Robot
- Design of a tomato sorting machine based on Raspberry Pi
- Share a fire sensor solution using MLX90640
- Plastic sealing machine circuit diagram
- Experiment on making a demonstration device for mobile phone electromagnetic radiation
- DIY Solar Detector
- How to create image processing solutions using HLS capabilities
- Input and output polarity reversal circuit composed of MAX660
- Fiber Optic Data Receiver Circuit
- Simple water level control
- X-Class CMOS sensor, do you know it?
- Low power consumption 1.8V temperature sensor, have you heard of it?
- Interface technology circuit analysis of sensors used in ESP
- Multiple input light sensors
- strain sensor
- Digital pressure measurement circuit
- Thermocouple Thermometer Circuit
- AMN1 pyroelectric sensor with relay circuit
- Linear transform position sensor (LVDT) position measurement circuit
- Bridge sensor transmit/receive circuit