So, over the last few months I have been curious as to the levels of pollution during my commute to work. I have to drive from the countryside of Kent into the Isle of Dogs, London, via the Blackwall Tunnel and at part of that journey I can literally taste the fumes from the other cars. I thought it would be interesting to try and see what the levels of particulates are plus some other air pollutants and so set of on a journey to build a sensor station with some relevant sensors for this task.
After speaking to Oly at Maidstone Hackspace, who had built something similar, I decided on the SPS30 particulate sensor and an MH-Z19 CO₂ sensor. I also added uBlox NEO 6M GPS module so that I could obtain accurate time plus the location of the device when in mobile mode. I also added an HTU21D temperature and humidity sensor. The entire thing currently looks like the prototype below.
Bottom middle is the microcontroller. I have used an ESP32, mainly as it is an ESP based device with plenty of GPIO pins. I needed a few for the various devices plus room for additional sensors in the future.
Right of that is the uBlox NEO 6M GPS module. Currently I am only extracting time and date from it but will also be capturing longitude and latitude data so I can record where the device was whilst in mobile mode.
Above the GPS modile is a HUT21D temperature and humidity sensor.
Above the ESP32 is a small golden box. This is the MH-Z19 CO₂ sensor. Left of that is a 2.2″ TFT display showing the various bits of data from the sensors. You can see I am displaying the PM2.5 and PM10.0 values as well as the CO₂ reading, temperature and humidity.
Above the display is the SPS30 particulate sensor. This was the most expensive sensor in the setup at approx £30 each. However, it comes highly rated and has excellent reviews. Above the SPS30 is a breadboard PSU as the ESP32 does not have enough juice to power all of the devices via USB.
I will be adding an SD Card reader/writer module soon to enable me to log the data to SD Card including the location of the device when on the move. At first, all of the data I was sending up to ThingSpeak to record and display it. This was fine to start with but I soon became frustrated with the very limited graphing and display options with ThingSpeak. I wanted the ability to be able to zoom in and out of graphs, which ThingSpeak does not offer. I then came across the open-source Grafana project which allows you to display your data in beautiful ways and has the option to annotate certain parts of the graph, change what date and time range to display on the graph quickly and easily as well as zoom in and out on whatever area you want at any time.
As I had a few spare Raspberry Pi’s lying around I decided to go down the route of self-hosting my own data and graphs. So I took a Pi, installed InfluxDB as my database to store the sensor data and also Grafana to display all of the readings. All of the above was pretty easy to set-up. There are plenty of tutorials online to assist you with this.
I have to say I am very pleased with the results so far. As you can see above the Grafana dashboard looks amazing. You have plenty of options with regard to how the data is displayed and what colours to use, etc. It has been a very interesting experience to watch the levels of CO₂ go up and down in rooms that are occupied or not, or have ventilation or not. I have to admit I am more inclined to keep windows open since seeing the CO₂ readings go above 1000ppm on occasion. It is also seeing the levels of particulates go up into what is considered unhealthy ranges just by doing things like cooking. You can also tell when people are getting out of bed, moving around the house, etc. by the particulate levels as the settled dust gets kicked up into the air again. The whole project has been a real eye opener.
I have a whole bunch of the MQ sensors and intend on adding a few onto the sensor station, particularly those relevant to car fumes so I can use the device in mobile mode and take it in the car on a daily commute.
Overall this has been a very satisfying project and a real eye opener as I was totally unaware of the levels of pollution just inside my own home. I would recommend you, the reader, to also build one of these as you will be surprised at what you find. Give me a shout if you have any questions or need some help with your own project.