PicoAir — Open Source Air Quality Monitor for Everyone

by 2010aanandar in Circuits > Raspberry Pi

275 Views, 7 Favorites, 0 Comments

PicoAir — Open Source Air Quality Monitor for Everyone

198e98ae-5516-4257-8ecf-d2e7a9348300.png
Screenshot 2026-05-02 154423.png
Screenshot 2026-05-02 154529.png
Screenshot 2026-05-02 154611.png

Air pollution is one of the biggest public health crises of our time. In cities across the world — especially in South and Southeast Asia — millions of people breathe unsafe air every single day without even knowing it. Commercial air quality monitors exist but cost thousands of rupees, putting them out of reach for most households, schools and communities.

PicoAir is my answer to that problem. A fully open source, 3D printable air quality monitor built around the Raspberry Pi Pico W that anyone can build for under ₹900(est) in components. It monitors air quality, temperature and humidity in real time, displays live readings on an OLED screen, and gives instant visual feedback through a color coded RGB LED — green for clean, yellow for moderate, red for dangerous.

Supplies

Screenshot 2026-05-02 155123.png
Screenshot 2026-05-02 155208.png
Screenshot 2026-05-02 155304.png
Screenshot 2026-05-02 155414.png
Screenshot 2026-05-02 155338.png
Screenshot 2026-05-02 155452.png
  1. Raspberry Pi Pico W
  2. MQ135 air quality sensor
  3. DHT22 temperature and humidity sensor
  4. 0.96" OLED display
  5. RGB LED
  6. USB cable
  7. 3D printed PicoAir enclosure (files attached)


The Problem

Screenshot 2026-05-02 155935.png

Step 1: The Problem

Air pollution is one of the biggest public health challenges of our time. In cities across the world, millions of people breathe unsafe air every single day without even knowing it. Commercial air quality monitors exist but are expensive and out of reach for most households, students and communities.

PicoAir is my answer to that. A fully open source, 3D printable air quality monitor built around the Raspberry Pi Pico W that anyone can build for under ₹900(est) in components. It monitors air quality, temperature and humidity in real time and gives instant visual feedback through a color coded RGB LED — green for clean, yellow for moderate, red for dangerous.

The Enclosure

Screenshot 2026-05-02 160048.png

The PicoAir enclosure was designed in OnShape and measures 90 × 60 × 65mm — roughly the size of a small speaker, compact enough for any desk.

Key design decisions:

  1. Two hexagonal mesh grilles on the front face allow proper airflow to both the MQ135 and DHT22 sensors
  2. A 0.96 inch OLED window at the top displays live readings
  3. An RGB LED diffuser hole sits center front for the air quality color indicator
  4. Rear vent slots allow heat from the MQ135 internal heater to escape
  5. A 10 degree angled base tilts the face toward the user for easy reading
  6. Single USB cable powers everything — no separate power supply needed

Download the STL file attached to this step and print it in PLA at 0.2mm layer height with 20% infill.

Wiring

Screenshot 2026-05-02 155910.png

Connect everything as follows:

MQ135 sensor:

  1. VCC → VBUS pin (Pin 40) — needs full 5V
  2. GND → Any GND pin
  3. AOUT → GP26

DHT22 sensor:

  1. VCC → 3.3V pin (Pin 36)
  2. GND → Any GND pin
  3. DATA → GP15

OLED display:

  1. VCC → 3.3V pin
  2. GND → Any GND pin
  3. SDA → GP4
  4. SCL → GP5

RGB LED:

  1. Red → GP10
  2. Green → GP11
  3. Blue → GP12
  4. GND → Any GND pin

Important: Always connect MQ135 to VBUS not 3.3V. The MQ135 needs 5V to run its internal heater correctly. Connecting it to 3.3V will give wrong readings.

check out the image for finding the GPIO pins of Raspberry PI PICO

Installing MicroPython and Libraries

1.Download MicroPython for Pico W from micropython.org

2.Hold the BOOTSEL button on your Pico W and plug it into your computer

3.Drag and drop the MicroPython UF2 file onto the Pico drive that appears

4.Open Thonny IDE — download free from thonny.org

5.In Thonny go to Tools → Manage Packages → search for ssd1306 and install it

6.You are ready to upload the code


MicroPython: https://micropython.org/

Thonny: https://thonny.org/

The Code

What the code does:

  1. Shows a startup screen on boot
  2. Reads air quality from MQ135 every 2 seconds
  3. Reads temperature and humidity from DHT22
  4. Displays all readings live on the OLED
  5. Sets LED to green below 300ppm, yellow between 300-600ppm, red above 600ppm
  6. Shows an error message if a sensor fails instead of crashi

Copy and Paste This Code:

# PicoAir — Air Quality Monitor

# For Raspberry Pi Pico W

# Sensors: MQ135 (air quality), DHT22 (temp & humidity)

# Display: 0.96" OLED (I2C)

# RGB LED for air quality indicator

#

# Pin assignments:

# MQ135 → GP26 (ADC0)

# DHT22 → GP15

# OLED SDA → GP4

# OLED SCL → GP5

# LED Red → GP10

# LED Green → GP11

# LED Blue → GP12


import machine

import time

import dht

from machine import Pin, ADC, I2C

import ssd1306


# ── Pin setup ──────────────────────────────────────────────

mq135 = ADC(Pin(26))

dht_sensor = dht.DHT22(Pin(15))

led_red = Pin(10, Pin.OUT)

led_green = Pin(11, Pin.OUT)

led_blue = Pin(12, Pin.OUT)

i2c = I2C(0, sda=Pin(4), scl=Pin(5), freq=400000)

oled = ssd1306.SSD1306_I2C(128, 64, i2c)


# ── Helpers ────────────────────────────────────────────────

def set_led(r, g, b):

led_red.value(r)

led_green.value(g)

led_blue.value(b)


def read_mq135():

raw = mq135.read_u16()

ppm = int((raw / 65535) * 1000)

return ppm


def air_quality_label(ppm):

if ppm < 300:

return "Good"

elif ppm < 600:

return "Moderate"

else:

return "Poor"


def update_led(ppm):

if ppm < 300:

set_led(0, 1, 0) # Green

elif ppm < 600:

set_led(1, 1, 0) # Yellow

else:

set_led(1, 0, 0) # Red


def update_display(ppm, label, temp, humidity):

oled.fill(0)

oled.text("PicoAir", 35, 0)

oled.hline(0, 10, 128, 1)

oled.text("Air: " + str(ppm) + " ppm", 0, 18)

oled.text("Quality: " + label, 0, 30)

oled.hline(0, 42, 128, 1)

oled.text("Temp: " + str(temp) + " C", 0, 48)

oled.text("Hum: " + str(humidity) + " %", 0, 58)

oled.show()


# ── Startup screen ─────────────────────────────────────────

oled.fill(0)

oled.text("PicoAir", 35, 20)

oled.text("Starting up...", 10, 40)

oled.show()

set_led(0, 0, 1) # Blue while starting

time.sleep(2)


# ── Main loop ──────────────────────────────────────────────

while True:

try:

# Read MQ135

ppm = read_mq135()

label = air_quality_label(ppm)


# Read DHT22

dht_sensor.measure()

temp = dht_sensor.temperature()

humidity = dht_sensor.humidity()


# Update LED and display

update_led(ppm)

update_display(ppm, label, temp, humidity)


except Exception as e:

# If sensor read fails show error on display

oled.fill(0)

oled.text("Sensor error!", 0, 25)

oled.text(str(e), 0, 40)

oled.show()

set_led(1, 0, 1) # Purple = error


time.sleep(2) # Read every 2 seconds

A Better World


Clean air monitoring should not be a luxury. PicoAir makes it accessible to anyone with a 3D printer and under ₹900(est) in components.

With PicoAir, a student can monitor their classroom air quality. A parent can check their child's bedroom. A community center can track pollution levels over time. No subscription, no expensive hardware, no technical expertise needed beyond basic wiring.

Open source. Fully printable. Designed for real people.

If air quality data is more widely available, people can make better decisions — opening windows, avoiding polluted areas, or pushing for cleaner environments in their communities. That is the better world PicoAir is working toward.