Introduction
With growing urbanization and industrial activities, air pollution poses a significant threat to health and the environment. Measuring particulate matter such as PM2.5 and PM10 helps in assessing air quality and understanding pollution levels. In this guide, we’ll demonstrate how to build a simple yet effective air quality monitor using the SDS011 sensor and Arduino, enabling real-time PM2.5 measurement and data visualization.
Components Needed
- SDS011 PM2.5 Sensor
- Arduino (e.g., Uno or Nano)
- Jumper Wires
- USB Cable for Arduino
- Breadboard (optional)
- 5V Power Supply (if not using Arduino power)
Circuit Setup
- Connect the SDS011 sensor's RX and TX pins to the Arduino's TX and RX pins, respectively, using a SoftwareSerial library connection. (For Arduino Uno, use pins 10 and 11.)
- Provide power to the SDS011 sensor through the Arduino's 5V and GND pins.
- If using a breadboard, neatly arrange the components for easier debugging.
Below is a diagram of the circuit setup:
How the SDS011 Sensor Works
The SDS011 sensor uses laser scattering to detect fine particles in the air. A laser beam is passed through the air inside the sensor, and a photodetector measures the intensity of scattered light. This data is processed to calculate the concentration of PM2.5 and PM10 particles in micrograms per cubic meter (µg/m³).
Code for PM2.5 Measurement
Use the following code to measure PM2.5 levels. Upload this sketch to your Arduino using the Arduino IDE:
#include
#include
SoftwareSerial mySerial(10, 11); // RX, TX pins
SDS011 sensor(mySerial);
void setup() {
Serial.begin(9600);
mySerial.begin(9600);
sensor.begin();
Serial.println("PM2.5 Air Quality Monitor");
}
void loop() {
float pm25, pm10;
if (sensor.read(&pm25, &pm10) == 0) { // If data is successfully read
Serial.print("PM2.5: ");
Serial.print(pm25);
Serial.print(" µg/m³ | PM10: ");
Serial.println(pm10);
} else {
Serial.println("Error reading data from SDS011 sensor");
}
delay(1000); // Read data every second
}
Make sure to install the SDS011 library in the Arduino IDE before running the code.
Understanding PM2.5 Levels
Particulate matter is categorized by size:
- PM2.5: Fine particles smaller than 2.5 microns. These particles can penetrate deep into the lungs and even enter the bloodstream.
- PM10: Particles smaller than 10 microns, which can cause respiratory issues.
The sensor outputs readings in µg/m³. Below is a general guide for PM2.5 levels:
PM2.5 Level (µg/m³) | Air Quality |
---|---|
0-12 | Good |
13-35 | Moderate |
36-55 | Unhealthy for Sensitive Groups |
56-150 | Unhealthy |
151-250 | Very Unhealthy |
251+ | Hazardous |
Practical Applications
- Monitor air quality in urban areas.
- Integrate with IoT platforms for smart home automation.
- Deploy in schools, offices, and factories to track pollution levels.
- Use in portable air monitoring devices for personal health tracking.
Troubleshooting
- If the sensor outputs invalid or no data, double-check the wiring and power connections.
- Ensure the RX and TX pins are connected properly and match the pins specified in the code.
- Check for sufficient power supply to the sensor.