Build a PM2.5 air quality monitor with a PMS5003 and ESPHome
Disclosure: As an Amazon Associate I earn from qualifying purchases. Links to parts on this page are affiliate links, some through brand partnerships, so I may earn a commission at no extra cost to you. It never changes which parts I recommend.
Fine particles from cooking, candles, wildfire smoke and dust are invisible, but a $20 laser particle counter can see them. This build reports PM1, PM2.5 and PM10 plus the US Air Quality Index to Home Assistant, which can then switch on an air purifier for you.
- Cost
- $25–40
- Time
- 45 minutes
- Difficulty
- Beginner
- Skills
- 4 jumper wires
What PM2.5 is
PM2.5 is the mass of particles smaller than 2.5 micrometers in each cubic meter of air, in µg/m³. They're small enough to get deep into the lungs, which is why they're the headline number in air quality reports. The PMS5003 draws air through with a small fan and counts particles by the laser light they scatter.
Parts
- An ESP32 DevKit and a 5 V USB supply.
- A Plantower PMS5003. Buy one that comes with its breakout adapter and cable: the sensor's own connector is a tiny 1.25 mm plug.
- Optional: a BME280 for temperature and humidity, which helps you make sense of the readings (see below).
- ESP32 DevKitView on AmazonPhoto: Edwiyanto, CC BY-SA 4.0

- PMS5003 particle sensor with adapterView on AmazonIllustration
- BME280 sensor boardView on AmazonPhoto: SparkFun, CC BY 2.0

- Female-to-female jumper wiresView on AmazonPhoto: oomlout, CC BY-SA 2.0

- 5 V USB power supplyView on AmazonPhoto: Сергей Михель, CC BY-SA 3.0

Wiring
| PMS5003 (adapter) | ESP32 |
|---|---|
| VCC | 5V (VIN) |
| GND | GND |
| TX | GPIO39 |
| RX | GPIO23 |
| SET, RESET | Leave unconnected |
The fan needs 5 V, but the data pins work at 3.3 V, so they connect straight to the ESP32 with no level shifter. The BME280, if used, goes on the I2C pins: SDA to GPIO21, SCL to GPIO22.
Build this config in the generator
The ESPHome config
uart:
- id: pms_uart
tx_pin: GPIO23
rx_pin: GPIO39
baud_rate: 9600
i2c:
sda: GPIO21
scl: GPIO22
sensor:
- platform: pmsx003
uart_id: pms_uart
type: PMSX003
pm_1_0:
name: "PM1.0"
pm_2_5:
id: pm25
name: "PM2.5"
pm_10_0:
id: pm10
name: "PM10"
update_interval: 120s
- platform: aqi
name: "Air quality index"
pm_2_5: pm25
pm_10_0: pm10
calculation_type: AQI
- platform: bme280_i2c
address: 0x76
temperature:
name: "Temperature"
humidity:
name: "Humidity"
pressure:
name: "Pressure"
update_interval: 60s
With update_interval over 30 seconds and the ESP32's TX wired to the sensor, ESPHome puts the fan to sleep between readings. The fan and laser wear with use, so ESPHome recommends 120 seconds or more.
What the numbers mean
These are the US EPA's PM2.5 breakpoints, updated in 2024. The AQI sensor in the config converts readings to this scale for you.
| PM2.5 (µg/m³) | AQI | Category |
|---|---|---|
| 0.0–9.0 | 0–50 | Good |
| 9.1–35.4 | 51–100 | Moderate |
| 35.5–55.4 | 101–150 | Unhealthy for sensitive groups |
| 55.5–125.4 | 151–200 | Unhealthy |
| 125.5–225.4 | 201–300 | Very unhealthy |
| 225.5 and up | 301+ | Hazardous |
The official AQI uses 24-hour averages. A live indoor reading jumps around: frying food can briefly push PM2.5 into the hundreds. Use the trend, not a single spike.
Placement and quirks
- Keep the inlet and outlet clear, out of direct sun and drafts, and not right next to the stove unless you want a cooking monitor.
- High humidity reads high. Laser counters see fog and water droplets as particles, so readings inflate when humidity is very high. That's what the BME280 is for: if PM2.5 and humidity rise together on a damp morning, it's probably moisture.
- Cheap sensors vary from unit to unit. They're good for trends and comparisons, not lab-grade measurements.
Adding gas readings: the BME680
The PMS5003 counts particles: smoke, dust, pollen. It can't see gases like cooking fumes, paint, cleaning products or the stale air of a closed room. A BME680 fills that gap. It does everything the BME280 does, temperature, humidity and pressure, plus a small heated gas sensor that reacts to volatile organic compounds (VOCs).
- BME680 temperature, humidity, pressure and gas sensorView on AmazonIllustration
It wires like the BME280, on the same I²C pins, and uses ESPHome's built-in bme680 platform:
sensor:
- platform: bme680
address: 0x77
update_interval: 60s
temperature:
name: "Air temperature"
oversampling: 16x
humidity:
name: "Air humidity"
pressure:
name: "Air pressure"
gas_resistance:
name: "Gas resistance"
heater:
temperature: 320
duration: 150ms
- Gas resistance goes down as air gets worse. It's a raw reading in ohms, not a standard air quality index, and every sensor reads differently. Watch it for a few days to learn its normal range in your room, then automate on big drops from that baseline.
- Give it a couple of days to settle. A new BME680's gas reading drifts while the sensor burns in.
- The address is 0x77 on some boards and 0x76 on others, depending on how the board wires its SDO pin. The I²C scan in the log shows which; change the config to match.
- Want an air quality index? Bosch's BSEC library turns the raw reading into an IAQ score, and ESPHome supports it through a separate component. It's more setup and more memory, so the raw reading is the easier start.
Home Assistant automations
- Run the purifier: turn on a smart-plug air purifier when PM2.5 stays above 12 µg/m³ for 10 minutes, and off when it's below 5 for 20 minutes.
- Smoke alert: notify when the AQI goes over 100 — useful in wildfire season to know when to close windows.
- Pair it with the CO2 monitor: CO2 tells you when to bring fresh air in, PM2.5 tells you when not to.
Frequently asked questions
What does a PMS5003 sensor measure?
Particles in the air: PM1, PM2.5 and PM10 concentrations. ESPHome can turn PM2.5 into the US Air Quality Index for Home Assistant.
Can the PMS5003 detect VOCs or cooking smells?
No, it only counts particles. Add a gas sensor such as the BME680 to pick up VOCs from cooking, paint or cleaning products.
How do I make a PMS5003 last longer?
Let it sleep between readings. ESPHome can wake its fan for each update and turn it off in between, which saves the laser and fan.
Troubleshooting
| Symptom | Likely cause and fix |
|---|---|
| No data at all | Check 5 V to the fan, a shared ground, sensor TX to ESP32 RX, and 9600 baud. |
| update_interval does nothing | The ESP32 TX to sensor RX wire is missing, so the sensor can't be told to sleep. |
| Checksum errors in the log | Power dips or long wires. Give the fan a steady 5 V and keep the wires short. |
| Huge PM2.5 spikes | Usually real: cooking, candles, aerosols, or an ultrasonic humidifier nearby. |
| Readings drift high in humid rooms | Water droplets count as particles. Keep it out of bathrooms and away from humidifiers. |