Air-quality station with CO2, PM2.5 and AI alerts
An ESP32 reads a Sensirion SCD41 (true CO2, temperature, humidity) and a Plantower PMS5003 (fine particles), shows them on a small OLED, and sends them to Home Assistant, where a local AI model writes plain-English alerts like "CO2 is high in the office, open a window."

Safety first
- This is not a smoke alarm or a carbon monoxide (CO) detector. CO2 is a different gas. Keep certified smoke and CO alarms in your home.
- Use a listed USB power adapter. The PMS5003 fan draws about 100 mA, well within it.
Parts
| Part | Qty | Approx. each | Subtotal |
|---|---|---|---|
| Espressif ESP32-DevKitC-32E (DevKitC V4) development boardOfficial Espressif 38-pin DevKitC V4 with ESP32-WROOM-32E (4 MB). Micro-USB port, not USB-C. Buy only the official 38-pin Micro-USB board, not a USB-C or 30-pin clone. Primary listing: Mouser 356-ESP32-DEVKITC32E, $10.20, 1,701 in stock on Nov 12, 2026, per Findchips (https://www.findchips.com/search/ESP32-DEVKITC-32E). The Mouser US page itself returned 403 to a direct fetch, so click-confirm the US storefront before you order. Mouser Netherlands listed 1,622 in stock at €8.60 the same day. Do not use DigiKey as the default today (search snippets showed 0 in stock / long lead time). Official Amazon listing https://www.amazon.com/dp/B09MQJWQN2 was still unavailable; use it if it returns. Amazon search for the official board: https://www.amazon.com/s?k=ESP32-DevKitC-32E. Adafruit #3269 remains $15.00 and was out of stock (https://www.adafruit.com/product/3269). Typical $10-16.Mouser | 1 | $10.20 | $10.20 |
| Sensirion SCD41 CO2 sensor moduleAdafruit sells its SCD-41 board at $49.95 (seen Nov 12, 2026); cheaper modules exist. Typical $30-50, no verified link.Amazon (search) | 1 | $40 | $40 |
| Plantower PMS5003 particle sensor with cableAdafruit sells it with an adapter at $39.95 (seen Nov 12, 2026). Typical $22-40, no verified link.Amazon (search) | 1 | $30 | $30 |
| UCTRONICS 0.96-inch SSD1306 I2C OLED (128x64)Price seen $6.99 in our parts catalog (Nov 12, 2026). Typical $5-9.Amazon | 1 | $6.99 | $6.99 |
| 5 V 2 A USB wall adapterTypical $5-10, no verified link.Amazon (search) | 1 | $7 | $7 |
| 40-pin 20 cm female-to-female jumper wiresCatalog ASIN. Typical $4-8.Amazon | 1 | $5.50 | $5.50 |
| Estimated total (parts only) | $99.69 | ||
Typical US prices, checked 2026-11-12. Prices change and multi-packs are often cheaper per piece.
As an Amazon Associate I earn from qualifying purchases. Prices change; check the store.
Filament
PLA (1.75 mm): about 73 g (24.5 m), roughly 7.25 h of printing.
PLA, 0.2 mm layers, 15% infill, 2 walls (the settings the v1 files were sliced with); keep the vent slots open and the PMS5003 inlet and outlet unobstructed.
AI agents you'll use
- Code helper (ChatGPT, Claude, Gemini or Grok): Writes the ESPHome YAML for the SCD41, PMS5003 and OLED, and the Home Assistant automation that calls a local AI model.
- Air-quality explainer: Explains what the readings mean with sources, and refuses to give medical advice.
Tools
- Soldering iron
- Small screwdriver
- USB data cable
- Computer running Home Assistant (and optionally Ollama)
What you'll learn
- What CO2 and PM2.5 numbers mean indoors
- ESPHome sensor configs
- Home Assistant automations
- Feeding sensor data to a local AI model for summaries
Stuffy meeting room, smoky kitchen, wildfire season: this little box tells you when the air is getting worse, and a local AI turns the numbers into a short, useful message.
What you'll build
A palm-sized vented box. The SCD41 measures CO2 in ppm plus temperature and humidity; the PMS5003 counts fine particles (PM1, PM2.5, PM10). The OLED shows the latest values. ESPHome sends everything to Home Assistant, which logs trends and, when a threshold is crossed, asks a local model (for example through Ollama) to write a one-line alert to your phone.
The cost range is $85-110 for the parts listed below, allowing about 10% either way for price swings.
Print the parts
Print a two-part vented box: the PMS5003 needs its inlet and outlet open to room air, and the SCD41 should sit away from the ESP32's warm regulator for accurate temperature. Credit any designer you use.
Wiring
| From | To | Notes |
|---|---|---|
| SCD41 VIN / GND | ESP32 3V3 / GND | Check your module's voltage range. |
| SCD41 SDA / SCL | ESP32 GPIO21 / GPIO22 | I2C, address 0x62. |
| OLED SDA / SCL | ESP32 GPIO21 / GPIO22 | Same bus, address 0x3C. |
| PMS5003 VCC / GND | ESP32 5V(VIN) / GND | The fan needs 5 V. |
| PMS5003 TX | ESP32 GPIO16 (RX2) | 3.3 V logic UART. |
Step-by-step
- Wire the sensors on a breadboard and flash a minimal ESPHome config.
- Check that CO2 reads around 400-500 ppm next to an open window (outdoor air).
- Add the PMS5003 and check readings rise near a lit match (briefly, ventilate after).
- Add the OLED page and adopt the device in Home Assistant.
- Make an automation: if CO2 > 1000 ppm or PM2.5 is high for 10 minutes, send the values to the AI and notify your phone with its one-line summary.
- Print the case and place it at breathing height, away from windows and vents.
Code
ESPHome YAML using its scd4x, pmsx003 and ssd1306 components; no hand-written firmware.
Prompt for the code helper:
Write an ESPHome YAML for an ESP32 with an SCD41 (I2C 0x62 on GPIO21/22), a PMS5003 on UART RX GPIO16 at 9600 baud, and an SSD1306 128x64 OLED at 0x3C showing CO2, PM2.5, temperature and humidity.
Then write a Home Assistant automation that, when CO2 > 1000 ppm or PM2.5 > 35 for 10 minutes, calls my local conversation agent with the current values and sends its one-sentence summary as a phone notification.
Use only component names from the current ESPHome docs.
Troubleshooting
- CO2 reads high everywhere: The SCD41 needs automatic self-calibration time or a fresh-air calibration. See the Sensirion docs.
- Temperature reads warm: Heat from the ESP32. Move the sensor away and add a temperature offset.
- PM2.5 always zero: PMS5003 TX not on the RX pin, or the fan is not getting 5 V.
Print files
License CC BY 4.0, aimebro. v1, not test-printed yet
Files, code and docs
- ESPHome documentation (Vendor docs)
- Home Assistant (Vendor docs)
- Ollama (run local AI models) (Vendor docs)
- US EPA indoor air quality basics (Vendor docs)
Last checked 2026-11-12. Double-check parts against your own board and seller listings before you buy.