Multpurpose Apocalypse Sensors

The end seems pretty nigh, so why not measure it? This sensor array is ready whether it’s fires or nuclear war, chemical attack or nuclear winter.

This Sensor Array Measures:

    • Particulate Matter: PM2.5 is the international standard measure of air quality related to fires. It measures density of particulate matter with a size larger than 2.5 microns (Technically 2.5 microns is an average, and this metric generally refers to particles larger than 0.8 microns.).  This includes smoke but also includes pollen and some other pollutants.
    • Nuclear Radiation: I have always wanted to have a geiger counter, so I decided to buy two; one for inside and one for outside.
    • Smoke and Carbon Monoxide: Every year is the worst fire year ever.
    • Temperature and Humidity: Temperature and humidity play a huge role in the impact of particulate matter in the air on the respiratory system. Even without smoke, the wrong humidity levels can cause respiratory problems for sensitive people. Tracking this number will help us see the potential impact on air quality indoors and out.

As the latest worst-ever fire season gets started, I am planning to explore the effectiveness of several methods for indoor air filtration. I wanted to measure the results so I decided to expand on earlier work and build a series of high precision sensor arrays which can measure and compare smoke levels in the air.

Why not radiation too? These sensor arrays will become an ongoing source of interesting data as the world continues to fall apart. Watching the Chernobyl miniseries, I was struck by the fact that the scientists had a sort of “smoke alarm” for radiation in their offices. I asked myself why that isn’t something we all have. How would we know if there was some serious radiation danger? Well now I will know.  lol.

Additionally, I will be comparing the efficacy of house plants alone and together with air filters on improving indoor air quality during fires. This builds on earlier work by NASA which showed that in general, house plants have a major positive impact on indoor air quality, but smoke was not one of the things NASA tested for.

(Incomplete photo, just waiting on the geiger counters.)

Apocalypse Sensors

I also wanted to experiment with building a multisensor wifi array for the first time. I decided to do four sensors which will give a lot of relevant data.

The Sensors

DHT22 Sensor: Gives temperature and humidity with high precision. This is not directly relevant but it makes it a more complicated and interesting project. Also, I suspect that humidity in particular will have an impact on filter performance.

PM2.5 Sensor: This sensor measures particulate matter larger than 2.5 microns. This is the standard unit of measure for air quality related to fires. I also got some tiny fans to blow air through these sensors in order to maintain a good sample of the air quality on an ongoing basis.

Geiger Counter: This is self explanatory. The Geiger-Muller tube detects ionizing particles which intersect it. This gives us the cool radioactive clicking sound and lots of information about radioactivity in the air. Scientists have declared that radiation is the hallmark of the Holocene or the epoch of humanity. It always seems like some nuclear disaster is spreading and threatening the globe. Let’s measure it over time!

MQ-2 Sensor: Gives smoke and carbon monoxide in particles per million. This is more like a smoke detector sensor versus an air quality meter. I have no idea what we will see with this sensor. It will be interesting to start comparing the PPM data to the PM2.5 data.

The Microcontroller

Probably any microcontroller will work, but initially I decided to use the very cheap and simple NodeMCU which is just a few dollars. This has wifi and I already had a box full of them. I’ve used these in the past on other projects. While they work great with digital inputs, I was not able to get the analog input to work; also there is only one analog input and no analog outputs which is frustrating.

I changed my mind and decided to go with the new Arduino Mkr Wifi 1010 because it has so many analog pins which makes this project a lot easier. It’s a little more expensive but it has much better support in addition to those critical analog GPIO pins. It also has eight digital pins with six being PWM; a very versatile microcontroller. Allegedly it even has OTA so you don’t have to plug it in to flash new software. This will be great if the sensors are set up somewhere and I need to push an update without moving the array. The simple I2C interface means this microcontroller  can also run an lcd screen in addition to the sensors which means it will be easier to have verbose output on the data.

The Code

The microcontroller simply hosts a webpage as well as a json endpoint with all the data. It also has REST endpoints for each sensor so it’s very easy to query the sensors or to quickly view all the data on the homepage.

Here is the first draft of the final code. The DHT22, MQ-2, and PM2.5 sensors are implemented. Each sensor has an API endpoint so they can be polled individually, or there is a json endpoint to poll them all simultaneously. This version also includes the LCD display which cycles through displaying all the sensor values.

I still need to incorporate the geiger counters once they arrive.

If you’re going to use this on another microcontroller, you would probably just need to change the wifi parts or remove them. You could also simply log the data through USB.

Sources

Some of the PM2.5 math comes from work done on this post.

Some of the code for MQ-2 is based on this post.

The DHT code is based on the sample code from the Adafruit library in the Arduino IDE.