We could all benefit from cleaner air. For those with breathing problems, including asthma and COPD, air quality isn’t just important—it’s potentially life-threatening. Pollutants in the air, like allergens, dust, smoke, ozone, and particulate matter, can trigger dangerous flare-ups in their respiratory conditions. These folks need to keep tabs on the air quality in their homes or offices, and the Raspberry Pi is ideally suited to help with that.

Here’s an example of a project that monitors your air quality and turns on an air filtration system when there’s too much particulate matter in the air.

👁 screenshot of lovelace screensaver on a kindle device
5 cool things you can do with Home Assistant

Home Assistant is the best way to control all your smart home devices, but it can be so much more if you use a little imagination.

A simple project for an essential quality-of-life enhancement

Joyce Lin came up with the project, designed it, and provided full details on how to build the air quality monitor setup on the project page. Lin says it only takes around an hour to build.

What you’ll need

Raspberry Pi 5

PMS7003 particulate matter sensor

Jumper wires (generic)

Kasa smart plug

MERV 13 electrostatic air filter

Box fan

Once up and running, this Raspberry Pi-driven air monitoring device measures your air quality using a PMS7003 particulate sensor. It transmits a continuous data stream to the Raspberry Pi using the SBC’s GPIO header.

CanaKit Raspberry Pi 5 Starter Kit

The new Raspberry Pi 5 is the top option out there right now and the CanaKit Raspberry Pi 5 Starter Kit gets it into your hands. You can choose between 4GB or 8GB of RAM, and this comes with a Quad-Core Arm Cortex A-76 processor, which is a huge upgrade from previous versions. You'll also get a  45-watt power supply, 128GB microSD card, as well as two micro HDMI-to-HDMI cables, a power supply, a cooling fan, a heat sink, and a case. 

A laser in the sensor shines through an air sample in order to detect an air quality issue. Particles scatter the laser light, and a photodetector measures the amount of scattering to determine particulate matter concentration. When particulate levels are too high, the Raspberry Pi triggers an air filtration system. In its most basic implementation, this is simply a box fan with a MERV 13 electrostatic air filter attached to its intake side. The fan is plugged into a Kasa smart plug, so the Raspberry Pi can quickly turn it on when needed.

How to build your own air quality monitor

You can follow the instructions on the project page to build your own system like Lin’s. You must connect the PMS7003 air monitoring device to the UART transmit and receive pins on your SBC, which are pins 8 and 10 on the Raspberry Pi. You must also supply power to the sensor using pins 4 (3V) and 6 (GND) on the Raspberry Pi’s GPIO.

Credit: Source: Joyce Lin / Hackster.io

Install Raspberry Pi OS as you would for any other project. You can also install Home Assistant—while Lin doesn’t include its use in the project documentation, it can integrate well with the Viam platform (more on that later). Naturally, if you already have Home Assistant set up, you can add your new air monitoring system to the system. That way, you can quickly view your air quality levels in the HA dashboard.

It may not be the most elegant solution, but you can use a simple, inexpensive box fan as an air filtration device. Secure an air filter to the fan, ensuring the airflow arrow points towards the fan. The fan needs to pull air through the filter to remove the particulates that threaten your ease of breathing.

A simple, but effective, air filtration device
Credit: Source: Joyce Lin / Hackster.io

Plug your Kasa smart plug into a power outlet and set it up, then connect the fan. You could probably use another brand of smart plug, but Kasa is at an advantage because of the open-source Python-Kasa library to help control the plug from the Raspberry Pi.

Taking the air quality system even further

The project is built using the Viam engineering platform, which allows you to collect air quality data and visualize it over time. You can also import the data into a machine learning model to perform deeper analysis or even predict when you may need to be especially careful about your air quality.

As I mentioned, this system could also be integrated with your Home Assistant setup. Rather than using the Viam app to check the status of your air quality monitoring, you can add the sensor directly to your Home Assistant dashboard. Since the Kasa smart plug is also controllable through HA, you could easily schedule the filtration to turn on and off at certain times or in response to conditions not covered by the Viam automation.

Finally, if the box fan setup isn’t your style, you could build a Corsi-Rosenthal box. This DIY air purifier incorporates four or five air filters, and you can customize it to match your interior design esthetics.

Credit: Source: Wikimedia Commons

This air quality monitoring system shows how DIY projects can address real needs. Combining accessible technology and sensors like the PMS7003, we can create personalized solutions for home environmental conditions. It's pretty cool to see the innovative ways that DIY enthusiasts can use affordable, adaptable tools like the Raspberry Pi to monitor and improve air quality, promoting healthier living spaces and enhancing their technical skills along the way.