Projects / PM2.5 dust monitor with PMS5003

PM2.5 dust monitor with PMS5003

Intermediate1.3 hGuided buildReviewed

Build it step by step

0 of 5 done
  1. ESP32PMS5003USB

    Fit the adapter

    Plug the PMS5003's ribbon into its adapter board. The pins are tiny: do not force them.

  2. ESP32

    Wire the sensor

    VCC to VIN (5 V), GND, TX to GPIO16, RX to GPIO17.

  3. ESP329.4 mASSD1306

    Wire the OLED

    SDA 21, SCL 22, 3V3, GND.

  4. ESP32

    Upload

    The fan starts when powered. Readings appear about every second.

  5. ESP32

    Place it well

    Keep the inlet and outlet clear, at breathing height, away from the kitchen stove.

In short

How do you build a PM2.5 dust monitor with PMS5003?

A PMS5003 laser sensor measures PM1, PM2.5 and PM10 in µg/m³, and an ESP32 shows them on an OLED with India's AQI band for PM2.5. You need ESP32 DevKit V1, PMS5003 particulate matter sensor, SSD1306 OLED Display, USB A to micro-USB cable (data), 5 V 2 A USB adapter and Jumper wires female to female (40 pcs). It takes 5 steps and about 75 minutes.

Level
Intermediate
Time
About 75 min
Parts
6

Parts list

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
PMS5003 VCC / GNDESP32 VIN (5 V) / GNDThe fan needs 5 V
PMS5003 TXESP32 GPIO16 (RX2)Data frames at 9600 baud (3.3 V logic)
PMS5003 RXESP32 GPIO17 (TX2)Optional, for sleep commands
OLED SDA / SCL / VCC / GNDGPIO21 / GPIO22 / 3V3 / GNDDisplay

Code

Arduino IDE with the ESP32 board package (Espressif), board "ESP32 Dev Module". Install "PMS Library" by Mariusz Kacki and "Adafruit SSD1306". The AQI band is for a 24-hour average; a single reading is only a guide.

Runs on a virtual ESP32 Dev Module in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).

#include <PMS.h>
#include <Adafruit_SSD1306.h>

PMS pms(Serial2);
PMS::DATA data;
Adafruit_SSD1306 oled(128, 64, &Wire, -1);

// Indian National AQI bands for PM2.5 (24-hour average, µg/m³)
const char* band(int pm) {
  if (pm <= 30) return "Good";
  if (pm <= 60) return "Satisfactory";
  if (pm <= 90) return "Moderate";
  if (pm <= 120) return "Poor";
  if (pm <= 250) return "Very poor";
  return "Severe";
}

void setup() {
  Serial.begin(115200);
  Serial2.begin(9600, SERIAL_8N1, 16, 17);
  oled.begin(SSD1306_SWITCHCAPVCC, 0x3C);
  oled.setTextColor(SSD1306_WHITE);
}

void loop() {
  if (!pms.read(data)) return;                // waits for a full, checked frame
  int pm25 = data.PM_AE_UG_2_5;
  Serial.printf("PM1 %d  PM2.5 %d  PM10 %d\n", data.PM_AE_UG_1_0, pm25, data.PM_AE_UG_10_0);
  oled.clearDisplay(); oled.setTextSize(1); oled.setCursor(0, 0); oled.print("PM2.5 ug/m3");
  oled.setTextSize(3); oled.setCursor(0, 12); oled.print(pm25);
  oled.setTextSize(1); oled.setCursor(0, 40); oled.print(band(pm25));
  oled.setCursor(0, 54); oled.print("PM1 "); oled.print(data.PM_AE_UG_1_0); oled.print("  PM10 "); oled.print(data.PM_AE_UG_10_0);
  oled.display();
}

Test checklist

What you should see at each check. If a reading is far off, stop and use the troubleshooting list.

CheckExpected
Clean room with windows shutPM2.5 often 10 to 60 µg/m³ in Indian cities
Incense stick or match blown out nearbyJumps above 150 within seconds
Serial monitorOne line per second with three numbers

If it does not work

Nothing on screen

Swap TX and RX, and check the fan spins (it needs 5 V).

Numbers stuck at 0

The sensor is in standby. Power cycle it.

Readings much higher than the city station

Indoor sources (cooking, incense, dusting) are common. Compare at the same time with windows open.

Still stuck? Find the fault step by step with your multimeter →

Ask Lark AI

Common questions

What parts do I need for the PM2.5 dust monitor with PMS5003?

ESP32 DevKit V1, PMS5003 particulate matter sensor, SSD1306 OLED Display, USB A to micro-USB cable (data), 5 V 2 A USB adapter and Jumper wires female to female (40 pcs). PMS5003 particulate matter sensor: Comes with a small adapter board and cable.

How long does the PM2.5 dust monitor with PMS5003 take to build?

About 75 minutes for a intermediate maker, in 5 steps.

How do I know the PM2.5 dust monitor with PMS5003 works?

Clean room with windows shut: PM2.5 often 10 to 60 µg/m³ in Indian cities. Incense stick or match blown out nearby: Jumps above 150 within seconds. Serial monitor: One line per second with three numbers.

Nothing on screen: what should I check?

Swap TX and RX, and check the fan spins (it needs 5 V).

Numbers stuck at 0: what should I check?

The sensor is in standby. Power cycle it.

Readings much higher than the city station: what should I check?

Indoor sources (cooking, incense, dusting) are common. Compare at the same time with windows open.