Hello everyone! Today I want to share with you my new DIY project. It is an open source air quality sensor. This project uses a novelty from Sensorion - TVOC sensor SGP40. The second main element of the project is the 2.13-inch e-ink display. I think these displays are worthy of more than just showing you the price of an item on store shelves. Since we now spend more time at home, it's a good idea to monitor the air quality. Make this project for yourself!

 In addition to assessing the air quality, the sensor can estimate the indoor light level, temperature, humidity and atmospheric pressure, based on the atmospheric pressure data, the device can predict the weather forecast. 

The sensor works on nRF52 microcontrollers, 4 versions of pcb have been developed for nRF52 radio modules from different manufacturers. One main and three more extended versions (explanations will be a little later in the text).
Models of radio modules used in the project: main MINEW MS88SF3 (nRF52833, nRF52840), additional: MINEW MS50SFA1 (nRF52810, nRF52811), MINEW MS50SFA2 (nRF52832), EBYTE E73-2G4M08S1C (nRF52833, nRF52840)
Sensors used in the project: room air quality sensor for VOC measurement - SGP40, pressure, temperature and humidity sensor - BME280, illumination sensor MAX44009.
A little later, due to problems with the production of electronic components and an incredible increase in prices for many components, the BMP280 and SHTC3 sensors were added to the project, which, in terms of functionality, can replace the BME280 sensor. For this reason, three additional modifications of the boards were made, support for additional radio modules was also added, protection against polarity reversal was added, and the design of the boards was improved.

The device can display data on the screen and transmit data to the Smart Home systems, it can also work in the "offline" mode.

To display information, an ultra-low consumption 2.13-inch e-ink display from WaveShare was used.

Display characteristics:

In the near future, the project will add support for the DES e-Ink 2.13 display with an operating temperature of -20C ~ 60C (what is DES).

Basic version of PCB sensor:

Additional versions:

Earlier I wrote that the main sensor in this project is the SGP40 indoor air quality sensor. We can say that this is a novelty on the market from the Sensorion company with very good characteristics.

The sensor measures the total volatile organic compound (TVOC) concentration. In comparison with the previous sensor from this company SGP30, the consumption has been significantly reduced, 48 mA when measured with the SGP30 and 2.6 mA with the SGP40. True, the previous sensor could give ready-made values for VOC and CO2 equivalent, while the new product gives raw data that must be further processed on the MK side using the library supplied with the sensor with an air quality calculation algorithm. Datasheet for SGP40 sensor.

I had to modify the Adafruit_SGP40 library to run on a small battery in an ultra-low device power mode. Added work with the sensor heater, receiving, saving, unloading the current states of the sensor fast start algorithm, for example, after replacing the battery, bypassing the learning mode. For some reason, nobody was puzzled by these moments, I could not find a ready-made library that supports all the functionality of the sensor. The modified library is on my GitHub. Perhaps this is due to the fact that the SGP40 is a fairly new product.

Device diagram:

Data transfer to Smart Home systems from a sensor is based on the MySENSORS open source home automation project.

I will briefly describe the functionality of the sensor. When turned on, the device tries to find a network, if the network is not found, then the device goes into the main mode of operation without working on the network (does not send data), but periodically makes short search requests for the network (~ once every 2 hours). The polling interval of the SGP40 sensor is 3 seconds, the reading of the remaining sensors, the sending of data and the screen refresh (in the main mode) is carried out every 1 minute. The screen is refreshed and data is sent (if network is available) when the air quality level (TVOC) data changes by 10 units, temperature by 0.5C, humidity by 5%, pressure by 1 unit when the light level changes by 10 lux and also when changing the weather forecast. The battery polling interval is set by the user in the range from 1 hour to 24 hours, by default the polling occurs every 6 hours.
There is also an additional subroutine for updating the screen and sending data when the TVOC level rises sharply by 30 units, the check interval is every 6 seconds.

When the device is turned on for the first time, the training cycle of the air quality calculation algorithm takes place; in my implementation, the maximum training time is 12 hours. After learning, the sensor begins to save the current states of the algorithm in the memory of the MC with an interval of four hours. When the device is rebooted, when it resumes operation after the device is turned off, when the batteries are replaced, the presence of algorithm state records is checked, if any, these data are unloaded, and the device skips the 12 hours learning period.
The device has a "menu" button. Available functions of the "menu" button: 1. screen inversion, 2. sending a presentation, 3. entering the configuration mode (receiving external commands by radio, 4. searching for a network, 5. resetting the device.

Also, in addition to the "menu" button, the sensor can be configured by external commands from the interface of the Smart Home system. To do this, activate the desired menu item "Sensor configuration" by pressing the "Menu" button. After activating the configuration mode, the sensor will enter listening mode for 20 seconds. The command must be sent within this interval. External commands can set the battery check interval, change the display of information on the screen in inversion, select the operating mode: LP (reading the SGP40 sensor every 3 seconds) or ULP (reading 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. Description of the weather forecast calculation algorithm - (NXP Application Note 3914 | John B. Young)

An indication of the direction of change of values 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 consumption of the sensor in sleep mode is on average 33μA (see datasheet on SGP40), in sensor readout and screen refresh mode 4mA (average), in data transfer mode 8mA (average), the transmission time of one message is 10ms (ideal conditions). The sensor operates on a CR2477 battery (950mA), the average estimated operating time of the device is 1 year (depending on the firmware configuration, installed sensors on the device, more sensors will need to be sent more data, and air transmission is the main consumer).

I printed the models of the developed sensor enclouser on an FDM 3D printer to achieve a more or less decent look, after printing the body was polished. Magnets can be installed inside the enclouser.

GitHub of the project - github.com/smartboxchannel/

The readme file contains instructions for installing and configuring the environment for editing and compiling sensor software.

OPEN SOURCE HARDWARE CERTIFICATION
OSHWA UID: RU000004

Thanks for attention.