Introduction
This experiment shows how to measure air quality by detecting PM2.5 particulate matter using an SDS011 sensor with Arduino.

Components Needed
- SDS011 PM2.5 Sensor
- Arduino
- Jumper Wires
Circuit Setup
- Connect the SDS011 sensor to the Arduino's RX and TX pins using a SoftwareSerial connection.
- Power the sensor with 5V and GND pins of the Arduino.
The SDS011 sensor measures particulate matter in the air and sends the data to the Arduino.

Code for PM2.5 Measurement
Upload the following code to your Arduino to measure PM2.5 levels:
#include
#include
SoftwareSerial mySerial(10, 11); // RX, TX pins
SDS011 sensor(mySerial);
void setup() {
Serial.begin(9600);
mySerial.begin(9600);
sensor.begin();
}
void loop() {
float pm25, pm10;
sensor.read(&pm25, &pm10);
Serial.print("PM2.5: ");
Serial.print(pm25);
Serial.print(" µg/m³ | PM10: ");
Serial.println(pm10);
delay(1000);
}
Explanation
The SDS011 sensor detects the concentration of particulate matter in the air. The Arduino reads this data and displays the PM2.5 and PM10 levels on the Serial Monitor.
Troubleshooting
- If the sensor isn't outputting data, check the wiring and ensure the sensor is powered properly.
- Ensure the sensor is connected to the correct RX/TX pins on the Arduino.