# Air Quality Sensor

[W]ithout something to care about the universe in which it lives, this is all completely sterile to begin with. Eric Weinstein

This is an air quality sensor based on the Grove Multichannel Gas Sensor v1.0, which uses a MiCS-6814 gas sensor.

Grove warns that the device is meant to be used to track gross trends only.

Note that The sensor value only reflects the approximated trend of gas concentration in a permissible error range, it DOES NOT represent the exact gas concentration. The detection of certain components in the air usually requires a more precise and costly instrument, which cannot be done with a single gas sensor. If your project is aimed at obtaining the gas concentration at a very precise level, then we do not recommend this gas sensor.

In my situation it does show reasonable/believable trends. For example; propane levels predictably rise in the evening when the cooker is used. Nitrogen dioxide levels predictably rise in the morning when the house is opened up and drop at night when it is closed. So I have relative confidence in it’s ability to track trends.

I used the protective shell from an unused DHT21/AM2301 sensor:

The microcontroller is one of my favorites; an M0 RFM96 LoRa Radio from Adafruit. With the LoRa radio it participates in a LoRa broadcast network I have built in the house with a number of other sensors. A web gateway receives data from the sensor and uploads it via MQTT to Adafruit IO (AIO) where it can be displayed and analyzed on a web dashboard:

I setup the dashboard to display all the latest readings and also a way to see trends in NO2 vs propane. I want to watch the propane because our cooker uses a propane tank stored inside the house and NO2 to see general air pollution.

I have the unit sampling the air every 20 seconds and broadcasting data every five minutes. The web gateway does some statistical analysis of the data as it receives it (hourlyavg, hourlymin, hourlymax, etc) before uploading all of that data to AIO. The dashboard and data are publicly available. At the bottom of that dashboard I have added local weather data from OpenWeatherMap so I can easily see weather factors such as wind speed and direction that may affect readings (on my list of projects is to build a local weather station of-sorts).

Update August 9, 2020 I have created a new dashboard to view NO2-specific data.

The code is available at GitHub. It’s not quite finished (is it ever?). Some new programming techniques I’ve played with on this project are data structures with struct and using a union for converting float values to bytes for lora transmission. I’ve been working my way through Programming: Principles and Practice Using C++ 1st Edition and enjoying it. I should have done that sooner!