Georgetown University Low Cost Air Quality Sensor — Effective for Extended Outdoor Use?

Jack Orzechowski
16 min readMay 7, 2018

--

I. Introduction

This experiment and subsequent report serve to demonstrate the functionality of solar powered low-cost air quality sensors (LCAQS), built in STIA-315 at Georgetown University, when deployed outside over a 24-hour time period. First, the demand and utility of these LCAQS’s is explained in the context of international air quality and relevant health and medical concerns. Then, the functionality of each sensor used is explained, including the Feather HUZZAH microcontroller, the DHT11 sensor (temperature and humidity), the PPD42NS sensor (PM2.5 concentration), and the charge controller. Furthermore, the wiring necessary to integrate each component of the device is explained, as well as relevant associated costs and methods of air quality data collection and storage. A detailed description of the code used to program the LCAQS is provided, all in order to make this information as readily available as possible for potential replication and future at-home experiments. Ultimately, the device was tested outside over a 24-hour time period to track ambient air quality around a high-traffic domicile. The data collected demonstrates that this specific type of LCAQS can provide generalized tracking of temperature, relative humidity, and PM2.5 concentrations, albeit with some shortcomings in powering the device and recording consistent data.

II. Context for air pollution and air quality monitoring

Collective consciousness concerning the importance of air quality first began to take shape after World War II, when the United States and the Soviet Union were engaged in an arms race that left traces of radioactivity spreading far beyond the boundaries of their nuclear test sites. Then, the prevalence of acid rain in the 1980’s, concentrated around industrial hubs, brought the air quality conversation to the forefront of the world’s attention, where it has more or less remained until this day. Despite decades of regulatory action and policymaking, the World Health Organization is still reporting millions of annual deaths from outdoor air pollution alone. As economic growth and industrialization continue to expand to all corners of the globe, pollutants such as carbon monoxide (CO), carbon dioxide (CO2), and particulate matter (PM) are being released into the lower atmosphere at an unprecedented rate. These pollutants, specifically PM2.5 (particulate matter 2.5 micrometers or smaller), can cause respiratory health problems as it is easily inhaled and absorbed into the lungs and bloodstream.

The global economic costs of poor air quality can no longer be ignored, as they will continue to grow as long as pollution mitigation efforts continue to stall. Globally, increasing concentrations of PM2.5 in the air will lead to an increase of related healthcare costs from $21 billion to $175 billion by the year 2060. Furthermore, indirect costs from air pollution will have heavy economic costs in terms of lost labor productivity, and respective drops in agricultural yields around the world. The regions of the world that will bear the highest costs are those counties where the number of air quality induced medical complications are the highest per capita. For example, industrial hubs in China and Korea will continue to bear high economic costs, which will only continue to grow parallel to the country’s GDP if industrialization and the burning of fossil fuels continue to go largely unmitigated.

Low cost air quality monitoring devices provide an opportunity to begin testing air quality in regions of the world where regulatory-grade monitors (defined by the EPA) may be few and far between. These standard monitors can often cost up to $20,000, and require great manpower and resources to effectively maintain. Although the reduced price of low cost air quality sensors comes with a significant drop in quality, they can potentially fill the gaps in data from countries that lack air quality sensors by providing data on ambient temperature, humidity, and PM2.5. Despite questions concerning data standardization and quality posed by low cost sensors, a base of data can potentially stimulate further studies and subsequent policy making in order to reduce PM2.5 concentrations in areas with high air pollution. Reducing air pollution can increase life expectancy by upwards of three years, and LCAQS can provide a baseline of information to inform individuals of the air quality most relevant to them, particularly in regions where data has been previously absent.

III. Sensors: DHT11 & PPD42NS

These low cost air quality sensors contain two distinct sensors. The first, called the DHT11, is an integrated temperature and humidity sensor. The temperature function has a range of 0–50°C with a margin of error of +-2°C, and uses a thermistor, or a Negative Temperature Coefficient (NTC) sensor. This NTC sensor takes its measurements by recording fluctuations in resistance along with changes in temperature — an increase in resistance signals a decrease in temperature and vice versa. The DHT11 calculates humidity by measuring the changes in resistance between two electrodes, separated by a moisture holding substrate through which water vapor can permeate.

The other sensor is the PPD42NS, which measures levels of PM2.5 in the air. It does so by using a heater to draw air through the device, and then measures the amount of LED light that has been scattered by particulate matter contained in the air passing through the sensor. It is important to note that the PPD42NS does not measure the mass of the particles, but rather the number of them and the amount of time that they scatter the LED light in the sensor for. Furthermore, an initial filter removes insignificantly small particles before counting the time that the remaining particles are detected. This time period is called “Low Pulse Occupancy” (LPO), and indicates the “opacity” of the air inside the sensor.

IV. Microcontroller (Feather HUZZAH) & Display Screen

This low cost air quality sensor uses the Feather HUZZAH for its microcontroller. This is a small, stackable, and powerful microcontroller, which runs the same code as the Arduino IDE (integrated development environment), allowing for easy integration and transfer of data from the sensors to the Feather HUZZAH. Furthermore, code can be written in the Arduino IDE, and transferred to the microcontroller to perform various functions. Open-source hardware and an intuitive interface allow for simple functionality and accessibility. Furthermore, the microcontroller is equipped with built-in ESP8266 WiFi capabilities, as well as both a serial chip and a connector for lithium polymer batteries for potential portable use.

The LCAQS also uses a FeatherWing OLED screen in order to display air quality data (Temperature in degrees Celsius, relative humidity, and PM2.5 pieces per cubic foot) in real time. The time intervals between displaying new sets of data are specified in the Arduino code, which will be explained later. Furthermore, the FeatherWing OLED contains three user buttons, which can be programmed to execute various tasks. For example, this particular LCAQS has a pause and resume function, again specified in the code, and enabled by the buttons. The OLED display is small, but has a high contrast and requires no additional backlight, so it can effectively function while requiring minimal power.

V. Wiring and Connections

In this layout, the Feather HUZZAH microcontroller and the DHT-11 sensor are connected to a breadboard in order to allow for greater ease in the wiring of each device. Each wire must be connected to a specific pin in order to achieve the desired affect. First, the black wire on the top of the microcontroller runs from the Ground Pin (breadboard row 4) to the negative pins on the top of the breadboard, in order to connect all negative pins in that row to the Ground pin. Similarly, the red wire on the bottom of the microcontroller runs from the VBUS/USB (breadboard row 7) to the positive row of pins on bottom of the breadboard, in order to connect the VBUS/USB pin to each of those positive pins. The DHT11 sensor is connected to the bottom of the breadboard (rows 25–27). In row 27, the red wire connects to the positive pins on the bottom of the breadboard, thus connecting it to the VBUS/USB pin on the microcontroller. Row 26 is the data pin for the DHT-11 sensor, and the yellow wire is connected to row 14 on the breadboard as designated in the sensor’s code. In row 25, the gray wire runs to the negative pins on the top of the breadboard, and is thus connected to the Ground pin on the microcontroller.

Finally, the black wire runs from the PPD42NS sensor to the negative pins on the base of the breadboard, the red wire connects to the positive pins on top, and the yellow wire is connected to row 13 on the breadboard, which is the designated data pin for this PM2.5 sensor. The FeatherWing OLED display screen is connected to the sensor simply by attaching it to the top of the microcontroller, and is compatible with any Feather board. This is easily accomplished by lining up the pins on the bottom of the OLED with the holes on the top of the Feather HUZZAH.

Image 1: Sensor Wiring
Image 2: Solar Power Connections

VI. 3D-Printed parts and waterproof enclosure

Certain components for this LCAQS were created using the 3-D printers at Georgetown University’s state-of-the-art Maker Hub facility. Those components are the black plastic case that holds the breadboard, DHT11 sensor, necessary wiring, and a portable battery, the lid to the plastic case, leaving room for the OLED display monitor to show, and the plastic adapter, which allows for all components of the LCAQS to be held together, and eventually attached to the bottom of the waterproof controller. The designs for each of these components can be found on Thingiverse (click here!), under the “Thing Files” subsection. Each component has its own STL file, which can be downloaded and run through a slicer program. Slic3er, for example, can provide the Gcode needed to print the specific available designs as well.

Using the 3-D printed plastic adapter, the entire LCAQS is fitted neatly inside an Adafruit Large Plastic Project Enclosure. This weatherproof box is equipped with a clear polycarbonate cover, a waterproof gasket seal, and screws that allow for the frequent removal of the clear top without risk of breaking. Assembly is fairly straightforward, and just requires the proper screws and bolts to first attach each sensor component to the plastic adapter, and then screwing the plastic adapter tightly into the bottom of the plastic enclosure. The enclosure comes with attachments for the adapter to be screwed directly in.

VII. Battery and solar panel

This LCAQS is equipped with a portable lithium ion battery (3.7v & 2500mAh), a medium 6V solar panel, and a solar/USB lithium ion polymer charge control, which all work together in order to charge and power the device. The lithium ion polymer battery itself is equipped with a 2-pin JST-PH connector, which allows for easy connection and disconnection. The battery also includes circuitry that keeps the battery voltage from getting too high or too low, and will protect against shorts in power. This battery is plugged directly into the solar/USB lithium ion polymer charge controller’s BATT port. The charge controller is equipped with an assembled charger board, a 2-pin JST cable, and a stabilization capacitor. This cable must be soldered to the charge controller, and then is connected directly into the Feather HUZZAH microcontroller. Additionally, the charge controller is specifically designed for solar charging, and automatically takes the most current possible at any given time from the attached solar panel. Finally, this device uses a medium 6V 2W solar panel, which is connected to the charge controller through a 2.1mm DC Jack adapter cable. The solar panel is manufactured by Voltaic Systems, is waterproof and UV resistant, and uses a monocrystalline cell with an aluminum and plastic composite substrate, allowing it to be both lightweight and sturdy.

When sunlight is unavailable for charging, the charge controller has a USB port that can be fitted with a cable and plugged directly into an outlet for power. This may also be necessary for initial charging of the LCAQS, as the solar panel will take a long time to completely power the sensor from scratch. This became evident in the experiment conducted, as six-plus hours of direct sunlight were only able to power the LCAQS for a little more than four hours in the absence of daylight. However, once the sensor received an initial charge from the USB port, the solar panel did an effective job in keeping the device powered for the duration of a 24-hour long experiment.

VIII. Overall costs

AQ Sensor Component

Cost ($)

Source

Feather HUZZAH

16.95

https://www.adafruit.com/product/2821

DHT-11 Sensor

5.00

https://www.adafruit.com/product/386

PPD42NS Sensor

11.50

https://www.seeedstudio.com/Grove-Dust-Sensor%EF%BC%88PPD42NS%EF%BC%89-p-1050.html

Breadboard

5.00

https://www.adafruit.com/product/64

Lithium Ion Polymer Battery

14.95

https://www.adafruit.com/product/328

USB/Solar Lithium Ion/Polymer Charger (3.7v, 2500mAh)

17.50

https://www.adafruit.com/product/390

DC Jack Adapter Cable

0.95

https://www.adafruit.com/product/2788

Medium 6V 2W Solar Panel

29.00

https://www.adafruit.com/product/200

Large Plastic Weatherproof Enclosure

19.95

https://www.adafruit.com/product/905

FeatherWing OLED Display Add-on

14.95

https://www.adafruit.com/product/2900

3-D Printed Components

~3.00

N/A

Total LCAQS Sensor Cost: $138.75

IX. Data connectivity and Hosting

This low cost air quality sensor uses a microcontroller with built-in Wi-Fi capabilities, allowing for easy connection to the Internet. In the code itself, the SSID and the password for local Wi-Fi must be manually entered as constants. In terms of limitations for this method of data connectivity, measurements can only be taken where one has access to either unsecure Wi-Fi, or has access to a password for a secure network. This also brings security concerns to light, because an unsecure network such as GuestNet can be accessed by anyone at anytime, and may not be a reliable source for connectivity. A password-secure Wi-Fi network is the best way to combat this security deficiency. Finally, cost of data connectivity is dependent on access to Wi-Fi, and whether that access is free or comes at a price. In the absence of WiFi, the device could potentially use satellite technology to achieve data connectivity.

First, Arduino’s “Serial Monitor” was used to visualize data collected by the LCAQS. Now, however, these particular low cost air quality sensors are connected to “ThingSpeak” in order to better send, store, and visualize data for interpretation. Essentially, ThingSpeak is an Internet of Things (IoT) analytics platform that uploads live data retrieved from the cloud, and displays it in easy to understand graphs and tables. ThingSpeak uses either HTTP Internet connections or a Local Area Network to retrieve data, and also provides the user with the opportunity to interact with live data by calculating averages, medians, and other helpful analytics. ThingSpeak’s services are free for small-scale academic projects, but have certain limitations on functionality. In order to achieve full access to ThinkSpeak services, a student subscription costs $75 annually.

X. Description of code

The code begins by including each of the libraries needed. The libraries contain pre-written code that we can then use later on without having to actually write it again ourselves. Then, the code defines the settings, including constants and variables, for each of the components included in the low cost AQ sensors. These components include defining the Wi-Fi settings, the ThinkSpeak settings, the DHT11 sensor settings, and the PPD42NS settings. By defining constants such as the SSID and password, the functions in the code can easily call the information at anytime without having to manually enter the information each time it is needed. Furthermore, a delay time of 15 minutes between data being sent to the Thingspeak server is defined as a constant, as well as a maximum PM2.5 concentration of 2000 pcs per cubic foot in order to limit outlying data from clogging the server. A void display_text() function then defines the setup for the OLED display screen.

The void setup() function is then defined, runs once, calls the display function, and connects to the internet in the while() loop. The while loop cannot be passed until a successful connection has been established. The code then executes the entire void loop function, which runs as long as the device is connected to a power source, and measures high/low pulses from the PPD42NS sensor on multiple passes of the loop. The void loop function also contains code to specify the pause and resume button functions on the OLED display. The first if() statement delays 15 minutes, then calculates the PM2.5 concentration in the sensor and converts that data into a value expressed in pieces per cubic foot. The code then reads in humidity and temperature data and prints the values to Arduino’s serial monitor. The next if statement connects to the ThinkSpeak server using previously defined constants, and sends the data there to be displayed (PM2.5 maxes out at 2000 pieces per cubic foot). Finally, the connection to the ThinkSpeak server is closed, and the stopwatch time on the sensor is reset.

Click HERE for LCAQS source code!

XI. Description of testing

In terms of the experiment, the LCAQS was left outside of a townhouse in the Georgetown neighborhood, in Washington, D.C. Originally, it was placed outside the second floor of the domicile, with the solar panel pointed west towards the sun (away from the house), and the clear face of the sensor placed facing the wall to avoid direct sunlight hitting its components. However, this original position did not end up working out, as a six-hour solar charging period only powered the device for about four nighttime hours, with no plug within reaching distance. Subsequently, the LCAQS was placed outside the bottom floor of the house, and was plugged directly into a wall socket. However, this new location was far more enclosed than the previous one. Furthermore, an open container of gasoline and an old motorcycle were now in direct proximity with the LCAQS, which had implications for the PM2.5 sensor readings. However, this new position was more effective in measuring temperature, relative humidity, and PM2.5 all while connected to a reliable power source, making it the better option. In this new position, the device was left in a vertical position, again with the face pointing towards the house and away from the sunlight. The device remained in the same location for the duration of the 24-hour experiment.

Image 3: Original Testing Location
Image 4: Final Testing Location

These two images show the LCAQS initial testing location (3), and the final testing location (4). The positioning in Image 3 is optimal due to sunlight exposure and elevation, but in the end the final location had to be Image 4, due largely to its proximity to a power outlet.

The following charts show trends for temperature, humidity, and PM2.5 concentrations taken over 24 hours. Measurements were taken every 15 minutes, but the graphs display 30-minute time intervals in order to fit all the data collected into the space provided in a more user-friendly way.

In terms of temperature and relative humidity, the LCAQS performed very well. Generally, the temperature, measured in Celsius, rose throughout the daylight hours, and fell during the nighttime. The relative humidity readings also performed in a predictable manner, rising in the nighttime hours and falling during the day. This is because warm air has the potential to hold more water vapor than cold air, so if the moisture in the air stays the same but the temperature falls, then the maximum amount of moisture the air contains decreases and relative humidity increases. The PM2.5 readings were the most erratic, but this was also predictable. Throughout the LCAQS testing periods, PM2.5 readings were often skewed by many variables, including the movement of the wires connecting the PPD42NS sensor to the microcontroller. Despite occasional spikes above the maximum value of 2000 pieces per cubic foot, PM2.5 readings did stabilize for substantial periods of time, especially at the end of the experiment. However, these values were generally higher than expected, resting between 200–300 pieces per cubic foot, again likely due to the proximity of pollutants and the lower ground level of the secondary testing location.

XII. Suggestions for improvement

For future improvement, I would suggest first and foremost to solder more of the wires connecting the various sensors to the microcontroller, in order to prevent small movements from creating bad data. This was the largest complication with the PM2.5 sensor, as movements in the wiring were recorded as massive influxes in PM2.5 concentrations. However, this is merely a matter of time constraints on the building of the LCAQS, and can be easily mitigated in the future. Furthermore, a larger solar panel would be helpful in charging the device strictly on solar power, if an outlet is not an option for obtaining charge. Finally, the weatherproof enclosure used to encapsulate the various sensors had to be modified at the bottom to allow for the free passage of air to and from the sensors. However, since the device also had to be placed upright, this hole was partially covered. A case that allows for better airflow would be helpful in making sure readings are constantly accurate, but comes with the tradeoff of being negatively affected by potential inclement weather.

XIII. Conclusion

Overall, the building and programming of the device is accessible for all of those who have access to the necessary financial resources. At less than $150.00, this exact LCAQS can be replicated down to the screws. The coding itself is a bit complicated for those unfamiliar with the Arduino interface, but the source code is now holistically available online for easy download. In terms of testing the device, shorter, more specific tests were much more easily conducted, because the LCAQS did not have to rely on a power source for an extended period of time. Unfortunately, for the 24-hour testing period, more problems were encountered. Furthermore, after being left out in the heat for so long, some of the 3-D printed components in the sensor morphed, and I had to make some minor adjustments on the sensor because of this. For the most part, the device only ran into complications during the extended test because of solar panel efficiency and wire movements. Despite these factors, the device still largely performed as expected over the 24-hour test, when plugged directly into a power source. Because of this, I believe that this type of LCAQS has good potential for establishing a baseline of air quality data for personal knowledge in areas where testing is not yet prevalent, but this does not serve as a source of data that could potentially inform policy decisions. Errant and bad data can be misleading, and the unreliability of the solar charge is the sensors biggest setback, while the sensor’s low cost and functionality while directly plugged into a power source constitute its strengths.

--

--