W-air Quality: Wearable Air-Quality Sensor

From Idea Shop Wiki
Revision as of 18:52, 20 April 2020 by Jricker (talk | contribs)


What is W-Air Quality

In 2018 Chicago received an F grade on its air pollution quality report from the American Lung Association, and it was still only the 22nd worst city in America. Pollution is known to be seriously harmful to those with asthma and is detrimental to health over long term exposure. [1] This project will attempt to shed some light on the issue of air quality by creating a live map of Chicago with points indicating the worst air quality in the city.

This wearable device creates a live-map of air quality in a city, based on sensor data from an MQ-135 air quality sensor and location from a NEO 6-M GPS module. An ESP32 microcontroller (MCU) will analyze sensor data, and transmit locations of poor air quality using the RESTful API to a Raspberry Pi cloud that pins that location on a map.

[pollution.ddns.net Pollution Tracking Website]

Device Architecture

Essentially, while you're out and about the device will constantly be looking for pollution. If a high enough level of pollution is reached the user will receive feedback from a ring of LEDs. The device takes sensor readings to determine the level of gasses present and then grabs the GPS location and stores the value and GPS location in memory. When the device is near Wi-Fi again this data is uploaded to a Raspberry Pi server which applies the data to a live map based on the GPS coordinates.

In the prototype, the sensor readings are uncalibrated, and should only be compared to other sensor readings from the same prototype.

Sensing Pollution

The device utilizes an MQ-135 air quality sensor capable of NH3, NOx, Alcohol, Benzene, Smoke, CO2. Chemicals in those gasses interact with a tin-oxide (SnO2) layer, which will change resistance when the gas is present, allowing us to detect the above gases. The sensor is also very sensitive to heat, so a heating-element is included in the sensor module to maintain a constant temperature.

The MQ-135 sensor was far from perfect. The heating element required substantial current (150 mA, more than the current draw of the MCU), and several minutes to warm up to operating temperatures. The sensor was also very inaccurate, although it could easily detect the presence of gasses it's difficult to determine the concentration of the gas which could be used to determine the AQI (Air Quality Index), which is widely used to gather Air Quality data. This definitely leaves room for the project to expand.

Originally, the levels of gas were measured as a threshold value. However, to determine the severity of pollution in an area, the device records the peak value from the sensor as a function of voltage. Once the threshold for pollution is reached, the device begins tracking the highest value of pollution detected to be recorded as the "peak value". A sampling function was also included, which takes 5 samples during the data collection period and averages them to even out faulty sensor data.


In these tests, a 40% alcohol solution was introduced to the sensor for 5 sensor cycles (2.5 seconds), and the resulting data is recorded above. With the sampling algorithm applied, you can observe that the readings appear much steadier.

GPS Information

To retrieve its location the device utilizes NEO-6M GPS module. The GPS module I’m using for this device is self-contained, and simply sends NMEA Strings over Serial Communication lines to the Arduino (at 9600 baud). NMEA stands for National Marine Electronics Association, and is the standard for GPS communication world-wide (GPS World). I used the TinyGps++ library to parse these strings and read the latitude, longitude, and number of satellites the GPS module can see.

After implementing the library, I found that it takes a lock on at least 3 satellites to get the position, but the best accuracy is had at a lock on 4 satellites. This is useful to know, we can require a lock on 4 satellites before longitude and latitude values are accepted.

Website Interface

The server


[1] - “Chicago Gets 'F' Grade in 2018 Air Pollution Report,” WTTW News. [Online]. Available: https://news.wttw.com/2018/04/20/chicago-gets-f-grade-2018-air-pollution-report. [Accessed: 16-Mar-2020].