DIY Air Quality Monitoring Station

0

Today it’s time to showcase my latest project: a DIY air quality monitoring station capable of recording temperature, humidity, atmospheric pressure, H2S and ozone levels. At the heart of the station is a Flip & Click SAM3X board from MikroElektronika, with one ESP8266-based WiFi3 Click to connect to the Internet. The sensors used are the Weather click and Ozone click from MikroElektronika, plus one H2S sensor from Spec Sensors.

The sensors are connected using two Shuttle click boards, each with two mikroBUS shuttles. The whole project requires a minimum amount of soldering. A bit of soldering to install the H2S sensor onto a Proto click, plus moving the SMD jumpers to configure the Weather click to work on SPI.

Air quality monitoring station

An air quality monitoring station

As a side note, although the Arduino Due and the Flip&Click boards have several years since they were first released, the I2C library within Arduino IDE still doesn’t work reliably. Most important, sending of the I2C stop condition doesn’t work well. As such, I have decided to use only SPI and serial sensors in this project.

The enclosure used is a 280 mm x 210 mm x130 mm IP65 PBE2821013 – ABS enclosure. Two CHDA202V vents (from Camdenboss) were installed in the sides of the enclosure, with forced ventilation provided by one 92mm fan placed in the bottom of the cabinet.

The acquired data is sent to ThingSpeak, using one ESP8266-based WiFi-3 click, programmed in Arduino IDE. The reason for choosing ThingSpeak is that I have used it a previous project, and I already had an account with them. Many aspects regarding ThingSpeak are covered in that blog post.

Air quality monitoring station: ESP8266 WiFi board

Air quality monitoring station: ESP8266 WiFi board

Regarding the sensors, the BME280 onboard the Weather click is well-known. I just mention here that I’ve used the code library provided by Adafruit, a library that can communicate with the sensor both using I2C and SPI.

The H2S sensor from SPEC sensors was covered in-extenso in another blog post, so it makes no sense to repeat here.

The ozone sensor uses one MiCS-2614 robust MEMS sensor for harsh environments with a detection range of 10-1000ppb. The output of the sensor goes into a 12-bit MCP3201 ADC. The MCP3201 is used in many other projects on this blog, so there’s no need for an in-depth look here. I just mention here that for the given moment I’ve decided to send the RAW O3 levels to ThingSpeak, as I still have some problems to convert the ADC result into ozone levels.

The whole project is developed using Arduino IDE, both for the Flip& Click and for the ESP8266. Below is the code for the Flip & Click (double click on the code to expand it):

Every 10 minutes the Flip & Click collects data to the sensors, parses the results and sends the data to the ESP8266. Debugging using the serial port is also possible, just set #define is_debugging 1 in the code. In a way, using a SAM3X microcontroller to perform those tasks is a bit overkill. But there aren’t any alternatives: I needed a 3.3V logic level microcontroller, and I needed three (or more) serial ports.

The code for ESP8266 is below:

Note the simple communication protocol. The ESP826 receives data, and sends it to ThingSpeak; There’s no way ESP8266 can signal to the Flip & Click if something is wrong. This is a feature I plan to include in the next version of the station.

Programming of the ESP8266 is done using my old programming rig, which I have found to be a bit hard to use when it comes to performing repeated code updates. I feel the need to make a better and easier to use programmer (this will be the subject of a future blog post).

For the given moment I’ve decided to make the acquired data public. However, as this is a work in progress, do expect to have periods of time with missing data. Also, the data should be taken “AS IS”, as for the given moment I have to rely on the factory calibration of the sensors, and hope everything is OK.

Share.

Leave A Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.