You are on page 1of 5

Build an air quality sensor with these two simple, hardware

devices and a few lines of code.


14 Mar 2018 Stephan Tetzel Feed

196

up

6 comments

Image by :

Opensource.com

x
Subscribe now
Get the highlights in your inbox every week.

We regularly measure particulate matter in the air at our school in Southeast


Asia. The values here are very high, particularly between February and May,
when weather conditions are very dry and hot, and many fields burn. These
factors negatively affect the quality of the air. In this article, I will show you
how to measure particulate matter using a Raspberry Pi.

What is particulate matter?


More on Raspberry Pi
 What is Raspberry Pi?
 Getting started with Raspberry Pi
 Getting started with Raspberry Pi cheat sheet
 Our latest on Raspberry Pi
 Send us your Raspberry Pi projects and tutorials
Particulate matter is fine dust or very small particles in the air. A distinction is
made between PM10 and PM2.5: PM10 refers to particles that are smaller
than 10µm; PM2.5 refers to particles that are smaller than 2.5µm. The smaller
the particles—i.e., anything smaller than 2.5µm—the more dangerous they
are to one's health, as they can penetrate into the alveoli and impact the
respiratory system.

The World Health Organization recommends limiting particulate matter to the


following values:

 Annual average PM10 20 µg/m³


 Annual average PM2,5 10 µg/m³ per year
 Daily average PM10 50 µg/m³ without permitted days on which exceeding is
possible.
 Daily average PM2,5 25 µg/m³ without permitted days on which exceeding is
possible.

These values are below the limits set in most countries. In the European
Union, an annual average of 40 µg/m³ for PM10 is allowed.

What is the Air Quality Index (AQI)?


The Air Quality Index indicates how “good” or “bad” air is based on its
particulate measurement. Unfortunately, there is no uniform standard for AQI
because not all countries calculate it the same way. The Wikipedia article on
the Air Quality Index offers a helpful overview. At our school, we are guided by
the classification established by the United States' Environmental Protection
Agency.
air_quality_index.png

Air quality index

What do we need to measure particulate matter?


Measuring particulate matter requires only two things:

 A Raspberry Pi (every model works; a model with WiFi is best)


 A particulates sensor SDS011

particulate_sensor.jpg
Particulate sensor

If you are using a Raspberry Pi Zero W, you will also need an adapter cable to
a standard USB port because the Zero has only a Micro USB. These are
available for about $20. The sensor comes with a USB adapter for the serial
interface.

Installation
For our Raspberry Pi we download the corresponding Raspbian Lite Image
and write it on the Micro SD card. (I will not go into the details of setting up the
WLAN connection; many tutorials are available online).

If you want to have SSH enabled after booting, you need to create an empty
file named ssh in the boot partition. The IP of the Raspberry Pi can best be
obtained via your own router/DHCP server. You can then log in via SSH (the
default password is raspberry):

$ ssh pi@192.168.1.5

First we need to install some packages on the Pi:

$ sudo apt install git-core python-serial python-enum lighttpd

Before we can start, we need to know which serial port the USB adapter is
connected to. dmesg helps us:

You might also like