Air quality in Indian cities regularly crosses hazardous levels — Delhi’s AQI routinely exceeds 300 during winter, and even cities like Bengaluru and Pune see spikes above 150. An air quality sensor connected to an Arduino or ESP32 gives you hyperlocal PM2.5 readings right where you live and breathe, rather than relying on the nearest government monitoring station that may be kilometres away. This guide walks you through building a complete PM2.5 monitor for under ₹2,500, covering sensor selection, wiring, code, and display setup.
What is PM2.5 and Why Monitor It?
PM2.5 refers to particulate matter with a diameter of 2.5 micrometres or smaller — about 30 times thinner than a human hair. These particles come from vehicle exhaust, construction dust, crop burning, and industrial emissions. They penetrate deep into lungs and enter the bloodstream, causing respiratory and cardiovascular problems with long-term exposure.
India uses the National Ambient Air Quality Standards (NAAQS) to classify air quality:
| AQI Range | Category | PM2.5 (µg/m³) | Health Impact |
|---|---|---|---|
| 0-50 | Good | 0-30 | Minimal |
| 51-100 | Satisfactory | 31-60 | Minor discomfort for sensitive people |
| 101-200 | Moderate | 61-90 | Breathing discomfort for asthma patients |
| 201-300 | Poor | 91-120 | Breathing difficulty on prolonged exposure |
| 301-400 | Very Poor | 121-250 | Respiratory illness on extended exposure |
| 401-500 | Severe | 250+ | Affects healthy people, serious impact on ill |
A DIY air quality monitor lets you check real-time readings inside your home, compare indoor vs outdoor pollution, and verify whether your air purifier is actually working.
Air Quality Sensor Comparison: SDS011 vs PMS5003 vs MQ-135
SDS011 — Best Overall for DIY Projects
The Nova SDS011 uses laser scattering to count particles, outputting PM2.5 and PM10 concentrations in µg/m³ via a UART serial interface. It’s the most popular choice for DIY air quality projects because of extensive documentation, good accuracy (±15% at 0-999 µg/m³), and easy interfacing. The built-in fan draws air through the sensing chamber automatically.
Dimensions are larger than the PMS5003 (71×70×23 mm), so it’s better suited for desktop monitors than wearables. Rated lifespan is about 8,000 hours of continuous operation — running it in intervals (30 seconds every 5 minutes) extends this dramatically.
PMS5003 — Compact Alternative
Plantower’s PMS5003 is significantly smaller (50×38×21 mm) and offers PM1.0, PM2.5, and PM10 readings. It uses the same laser scattering principle and communicates via UART. It’s the sensor inside many commercial air quality monitors. Accuracy is comparable to the SDS011 at moderate pollution levels but can differ at extremes.
MQ-135 — Gas Detection Only
The MQ-135 detects gases (NH3, NOx, benzene, CO2) but does NOT measure particulate matter. It’s useful for detecting bad smells or gas leaks but gives no PM2.5 data. Many beginners confuse “air quality” with “gas detection” — if you want to monitor pollution in the PM2.5 sense, you need a particle sensor, not an MQ-135.
Which Sensor Should You Buy?
| Feature | SDS011 | PMS5003 | MQ-135 |
|---|---|---|---|
| Measures PM2.5 | Yes | Yes | No |
| Measures Gases | No | No | Yes |
| Interface | UART | UART | Analogue |
| Price (₹) | 1,200-1,800 | 1,000-1,500 | 80-150 |
| Size | Large | Small | Small |
| Best For | Desktop monitor | Portable device | Gas alarms |
Components You Need
Here’s the complete bill of materials for a PM2.5 monitor with OLED display:
- SDS011 air quality sensor — ₹1,200-1,800
- Arduino Nano or ESP32 — ₹250-450
- 0.96″ I2C OLED display (SSD1306) — ₹150-200
- Jumper wires and breadboard — ₹100
- USB cable and 5V power supply — ₹100
Total cost: ₹1,800-2,500 depending on sensor variant and microcontroller choice.
Wiring the SDS011 with Arduino
The SDS011 uses a 7-pin connector (only 4 pins used) and communicates via UART at 9600 baud. Here’s the connection:
| SDS011 Pin | Arduino Pin | Notes |
|---|---|---|
| 5V (Pin 3) | 5V | Power supply |
| GND (Pin 5) | GND | Common ground |
| TXD (Pin 7) | D2 (SoftSerial RX) | Sensor data output |
| RXD (Pin 6) | D3 (SoftSerial TX) | Optional, for sleep/wake commands |
Use a SoftwareSerial connection since the Arduino Uno’s hardware serial is shared with USB. If using an Arduino Mega (multiple hardware serials) or ESP32, use a hardware serial port instead for reliability.
Arduino Code for PM2.5 Readings
#include <SoftwareSerial.h>
SoftwareSerial sdsSerial(2, 3); // RX, TX
float pm25 = 0;
float pm10 = 0;
void setup() {
Serial.begin(9600);
sdsSerial.begin(9600);
Serial.println("SDS011 Air Quality Monitor");
Serial.println("Warming up sensor (30 seconds)...");
delay(30000); // Allow sensor fan to stabilise
}
void loop() {
if (readSDS011()) {
Serial.print("PM2.5: ");
Serial.print(pm25);
Serial.print(" ug/m3 | PM10: ");
Serial.print(pm10);
Serial.print(" ug/m3 | AQI: ");
Serial.println(getAQI(pm25));
}
delay(2000);
}
bool readSDS011() {
byte buffer[10];
int idx = 0;
while (sdsSerial.available()) {
byte b = sdsSerial.read();
if (b == 0xAA && idx == 0) {
buffer[idx++] = b;
} else if (idx > 0) {
buffer[idx++] = b;
if (idx == 10) {
if (buffer[1] == 0xC0 && buffer[9] == 0xAB) {
pm25 = ((buffer[3] << 8) + buffer[2]) / 10.0;
pm10 = ((buffer[5] << 8) + buffer[4]) / 10.0;
return true;
}
idx = 0;
}
}
}
return false;
}
int getAQI(float pm) {
// Simplified Indian AQI calculation for PM2.5
if (pm <= 30) return map(pm, 0, 30, 0, 50);
if (pm <= 60) return map(pm, 31, 60, 51, 100);
if (pm <= 90) return map(pm, 61, 90, 101, 200);
if (pm <= 120) return map(pm, 91, 120, 201, 300);
if (pm <= 250) return map(pm, 121, 250, 301, 400);
return map(pm, 251, 500, 401, 500);
}
Adding an OLED Display
A 0.96″ SSD1306 OLED connected via I2C (pins A4/A5 on Arduino Uno) makes the monitor standalone — no computer needed. Install the Adafruit_SSD1306 and Adafruit_GFX libraries, then add display code to your loop:
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);
void setupDisplay() {
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(SSD1306_WHITE);
display.display();
}
void updateDisplay(float pm25, float pm10, int aqi) {
display.clearDisplay();
// Header
display.setTextSize(1);
display.setCursor(0, 0);
display.print("Air Quality Monitor");
// PM2.5 value (large)
display.setTextSize(2);
display.setCursor(0, 16);
display.print("PM2.5:");
display.print(pm25, 1);
// PM10 and AQI
display.setTextSize(1);
display.setCursor(0, 40);
display.print("PM10: ");
display.print(pm10, 1);
display.print(" ug/m3");
display.setCursor(0, 52);
display.print("AQI: ");
display.print(aqi);
display.print(" - ");
display.print(getAQILabel(aqi));
display.display();
}
const char* getAQILabel(int aqi) {
if (aqi <= 50) return "Good";
if (aqi <= 100) return "OK";
if (aqi <= 200) return "Moderate";
if (aqi <= 300) return "Poor";
if (aqi <= 400) return "V.Poor";
return "Severe";
}
ESP32 WiFi Version with Online Dashboard
Upgrading from Arduino to ESP32 adds WiFi connectivity, letting you push data to ThingSpeak, Blynk, or your own server. The wiring is identical — connect SDS011 TX to ESP32 GPIO16 (UART2 RX).
With the ESP32 version, you can:
- Log PM2.5 data every 5 minutes to a cloud dashboard
- Set up Telegram or WhatsApp alerts when AQI crosses a threshold
- Compare indoor and outdoor readings from different rooms
- Share your sensor data with community air quality networks like Sensor.Community
To extend sensor lifespan, put the SDS011 in sleep mode between readings. Send the sleep command via serial, wait 5 minutes, wake it, wait 30 seconds for the fan to stabilise, take a reading, then sleep again. This extends the 8,000-hour lifespan to several years of continuous operation.
Frequently Asked Questions
How accurate are DIY PM2.5 sensors compared to government monitors?
The SDS011 and PMS5003 typically agree within 15-20% of reference-grade instruments at moderate pollution levels (AQI 50-200). At very high concentrations (300+), they can overread. They’re accurate enough to know whether your air is good, moderate, or unhealthy — they’re not laboratory instruments, but they cost 100x less.
Can I use MQ-135 to measure PM2.5?
No. The MQ-135 detects gas molecules (NH3, CO2, benzene), not particulate matter. PM2.5 measurement requires a laser particle counter like the SDS011 or PMS5003. If you want both gas and particle monitoring, use one of each.
How long does the SDS011 sensor last?
The SDS011’s laser diode is rated for 8,000 hours of operation. Running continuously, that’s about 11 months. Using sleep mode with readings every 5 minutes extends this to 4-5 years. The fan bearing may also wear out over time — if readings become noisy, the fan is usually the first thing to fail.
Which is better for Indian conditions — SDS011 or PMS5003?
Both work well. The SDS011 is better documented with more Arduino tutorials, making it the safer choice for beginners. The PMS5003 is smaller and includes PM1.0 readings. For extreme Delhi winter pollution (PM2.5 > 400), both sensors max out — but at that level, you already know the air is hazardous.
Can I run this on battery power?
The SDS011 draws about 70 mA during operation, plus your Arduino/ESP32. A 10,000 mAh power bank would last about 2-3 days with continuous operation, or 2-3 weeks with sleep mode (reading every 5 minutes). Solar panels (5W) can keep it running indefinitely outdoors.
Conclusion
For under ₹2,500, you can build an air quality monitor that rivals commercial devices costing ₹8,000-15,000. The SDS011 gives reliable PM2.5 readings, and adding a BME280 gives you temperature, humidity, and pressure for a complete environmental monitoring station. Whether you use it to check if your air purifier is earning its keep or to track pollution trends in your neighbourhood, the data is yours — no subscriptions, no cloud dependence, and no vendor lock-in.
Find all the components you need for your air quality project at Zbotic’s sensor modules section.
Add comment