There are some low cost analyzers for about $15US. For home or test projects these sensors are great but I wouldn’t recommend them for any serious environmental studies. (For true air quality monitoring you need to compensate for temperature and humidity).
For this projects we used a 90mA PM2.5 Dust Sensor PPD42NS / PPD42NJ Sensor. These sensor need to be mounted upright, so we used some Meccano to build a simple stand.
The sensors have 5 pins, with the pinouts of:
- Pin 1 => GND
- Pin 3 => 5 VDC
- Pin 4 => Data Pin
To see the results we used a 16×2 LCD shield.
The product example samples every 30 seconds and it returns a value of particles per 1/100 of a cubic foot (pcs/0.01cf).
The returned values (in pcs/0.01cf) will need some validation but from our testing we found that :
- 0-500 pcs/0.01cf = a clear room
- 500-1500 pcs/0.01cf = a “fairly” clean room
- 1500-4000 pcs/0.01cf = a room in need of dusting (but not super dusty)
- 4000+ pcs/0.01cf = if you have allergies you may notice the room
Our code for the project is:
90mA PM2.5 Dust Sensor PPD42NS / PPD42NJ Sensor with an 16x2 LCD Shield JST Pin 1 (Black Wire) => Arduino GND JST Pin 3 (Red wire) => Arduino 5VDC JST Pin 4 (Yellow wire) => Arduino Digital Pin 8 */ #include <LiquidCrystal.h> LiquidCrystal lcd(8, 9, 4, 5, 6, 7); int pin = 28; unsigned long duration; unsigned long starttime; unsigned long sampletime_ms = 30000; unsigned long lowpulseoccupancy = 0; float ratio = 0; float concentration = 0; float maxcon = 0; void setup() { Serial.begin(9600); pinMode(8,INPUT); starttime = millis(); lcd.begin(16, 2); } void loop() { duration = pulseIn(pin, LOW); lowpulseoccupancy = lowpulseoccupancy+duration; if ((millis()-starttime) > sampletime_ms) { ratio = lowpulseoccupancy/(sampletime_ms*10.0); // Integer percentage 0=>100 concentration = 1.1*pow(ratio,3)-3.8*pow(ratio,2)+520*ratio+0.62; if (concentration > maxcon){ maxcon = concentration;} lcd.setCursor(0, 0); lcd.print("now: "); lcd.setCursor(5, 0); lcd.print(concentration); lcd.setCursor(0, 1); lcd.print("max: "); lcd.setCursor(5, 1); lcd.print(maxcon); Serial.print(" concentration: "); Serial.print(concentration); Serial.println(" pcs/0.01cf"); Serial.print(" max concentration: "); Serial.print(maxcon); Serial.println(" pcs/0.01cf"); lowpulseoccupancy = 0; starttime = millis(); } }