Redson Dev · Idea
Local Air Quality Monitor with a Raspberry Pi Zero
Published June 10, 2026
This project is for developers, makers, or tinkerers who want to contribute to local environmental awareness. Build a low-cost, open-source air quality monitoring station that publishes real-time data, allowing a small community center or a neighborhood group to easily track air pollution levels. For instance, a school could use this to monitor air quality near play areas and make informed decisions about outdoor activities.
What you'll need
- Raspberry Pi Zero W x1
- PMS5003 or Nova PM SDS011 particulate matter sensor x1
- BME280 temperature, humidity, pressure sensor x1
- Micro SD card (8GB or larger) x1
- USB power supply (5V, 2A) x1
- Breadboard x1
- Jumper wires (male-female) x1 pack
- Weather-resistant enclosure x1
Step-by-step
- 01
Set up Raspberry Pi OS Lite
Download the latest Raspberry Pi OS Lite image and flash it to your Micro SD card using tools like Balena Etcher. Enable SSH and configure Wi-Fi by creating 'wpa_supplicant.conf' and 'ssh' files in the boot directory of the SD card before first boot. Insert the card into the Pi and power it on.
- 02
Connect Sensors to Raspberry Pi
Wire the PMS5003 sensor: VCC to Pi's 3.3V (pin 1), GND to Pi's GND (pin 6), TXD to Pi's RXD (GPIO15, pin 10). For the BME280: VCC to 3.3V (pin 1), GND to GND (pin 9), SDA to SDA (GPIO2, pin 3), SCL to SCL (GPIO3, pin 5). Double-check your connections against a Pi Zero W pinout diagram.
- 03
Install Sensor Libraries and Dependencies
SSH into your Raspberry Pi. Update your package lists: `sudo apt update && sudo apt upgrade -y`. Install Python3 and pip if not present: `sudo apt install python3-pip -y`. For the BME280, install its library: `pip3 install RPi.bme280`. For the PMS5003, install a compatible library: `pip3 install pms5003`.
- 04
Enable Serial and I2C Interfaces
Run `sudo raspi-config` on your Pi. Navigate to 'Interface Options' and enable both 'P3 I2C' and 'P6 Serial Port'. Choose 'No' when asked about login shell over serial and 'Yes' for serial port hardware enabled. This ensures your Pi can communicate with the sensors.
- 05
Write Python Script for Data Collection
Create a Python script (e.g., `aq_monitor.py`) to read data from both sensors. Use the installed libraries to get readings for PM2.5, PM10, temperature, humidity, and pressure. The script should print these values to the console. Start with a simple loop to fetch data every few seconds as a test.
- 06
Set up Data Logging and Basic Web Interface
Install a lightweight web server like Flask or use a service like 'thingspeak' for external data logging. Modify your Python script to send sensor readings to a local file or the chosen platform. If using Flask, create simple routes to display the latest readings on a local webpage that can be accessed from other devices on the same network.
Tips
- Ensure your weather-resistant enclosure has proper ventilation for accurate readings, especially for temperature and humidity. Consider creating vents with a mesh to keep out insects.
- Place the sensor away from direct sunlight, rain, and sources of localized pollution (e.g., exhaust vents) for the most representative readings of your general area.
- Explore data visualization libraries like Matplotlib or services like Grafana if you want to create more advanced graphs and dashboards from your collected data.
