I’m atempting to build a multi-point air quality monitor. At the moment, I am just getting myself familiar with the sensors and their output using the example code. In my testing so far, the Grove Dust Sensor is extremely erratic. The concentration fluctuates wildly, and I frequently get 0 results. I have tried two separate dust sensors, and I am getting similar results.
I thought it might be the air quality in my office, but even after placing the sensor under a glass beaker, the results continue to be erratic. Here is a picture of my current setup:
I am running a very slightly tweaked version of the example code from the wiki. The only thing I added was a start notification and the number of seconds running at the beginning of each status line:
[code]/* Grove - Dust Sensor Demo v1.0
Interface to Shinyei Model PPD42NS Particle Sensor
Program by Christopher Nafis
Written April 2012
http://www.seeedstudio.com/depot/grove-dust-sensor-p-1050.html
http://www.sca-shinyei.com/pdf/PPD42NS.pdf
JST Pin 1 (Black Wire) => Arduino GND
JST Pin 3 (Red wire) => Arduino 5VDC
JST Pin 4 (Yellow wire) => Arduino Digital Pin 8
*/
int pin = 8;
unsigned long duration;
unsigned long starttime;
unsigned long sampletime_ms = 30000;//sampe 30s ;
unsigned long lowpulseoccupancy = 0;
float ratio = 0;
float concentration = 0;
void setup() {
Serial.begin(9600);
pinMode(8,INPUT);
starttime = millis();//get the current time;
Serial.println(“Starting…”);
}
void loop() {
duration = pulseIn(pin, LOW);
lowpulseoccupancy = lowpulseoccupancy+duration;
if ((millis()-starttime) > sampletime_ms)//if the sampel time == 30s
{
ratio = lowpulseoccupancy/(sampletime_ms10.0); // Integer percentage 0=>100
concentration = 1.1pow(ratio,3)-3.8pow(ratio,2)+520ratio+0.62; // using spec sheet curve
Serial.print(int(millis()/1000));
Serial.print(": “);
Serial.print(lowpulseoccupancy);
Serial.print(”,");
Serial.print(ratio);
Serial.print(",");
Serial.println(concentration);
lowpulseoccupancy = 0;
starttime = millis();
}
}[/code]
Here’s my output for a run slightly over 3000 seconds:
Starting...
30: 1220209,4.07,2126.80
61: 1701086,5.67,3027.53
92: 1914760,6.38,3450.74
122: 1807166,6.02,3235.60
152: 1426533,4.76,2505.62
183: 3006978,10.02,5938.64
213: 1159515,3.87,2017.19
244: 242371,0.81,418.83
274: 871489,2.90,1506.10
304: 1251248,4.17,2183.16
335: 968484,3.23,1676.73
365: 1058239,3.53,1835.90
396: 2177995,7.26,3996.44
427: 2367387,7.89,4408.01
458: 772707,2.58,1333.57
488: 1720543,5.74,3065.41
519: 565793,1.89,975.19
550: 2751042,9.17,5297.79
580: 24565,0.08,43.17
611: 171147,0.57,296.24
642: 0,0.00,0.62
672: 414898,1.38,715.42
704: 0,0.00,0.62
735: 0,0.00,0.62
765: 508987,1.70,877.30
795: 403998,1.35,696.68
826: 415559,1.39,716.55
857: 0,0.00,0.62
888: 377043,1.26,650.34
919: 0,0.00,0.62
949: 1012068,3.37,1753.86
980: 0,0.00,0.62
1011: 272181,0.91,470.09
1042: 0,0.00,0.62
1073: 0,0.00,0.62
1104: 0,0.00,0.62
1135: 36936,0.12,64.59
1166: 48415,0.16,84.44
1197: 0,0.00,0.62
1227: 167083,0.56,289.24
1258: 0,0.00,0.62
1289: 121669,0.41,210.96
1320: 248009,0.83,428.53
1350: 423979,1.41,731.03
1381: 417091,1.39,719.19
1412: 0,0.00,0.62
1443: 378301,1.26,652.50
1474: 37503,0.13,65.57
1505: 0,0.00,0.62
1536: 0,0.00,0.62
1567: 149235,0.50,258.49
1598: 109904,0.37,190.66
1628: 144106,0.48,249.65
1659: 0,0.00,0.62
1690: 144137,0.48,249.70
1721: 306985,1.02,529.93
1751: 131915,0.44,228.63
1782: 8154,0.03,14.75
1813: 13523,0.05,24.05
1843: 258052,0.86,445.80
1874: 0,0.00,0.62
1906: 0,0.00,0.62
1937: 0,0.00,0.62
1968: 73322,0.24,127.50
1999: 0,0.00,0.62
2030: 0,0.00,0.62
2061: 0,0.00,0.62
2091: 56572,0.19,98.55
2121: 52979,0.18,92.34
2153: 0,0.00,0.62
2184: 0,0.00,0.62
2215: 0,0.00,0.62
2246: 0,0.00,0.62
2277: 0,0.00,0.62
2308: 0,0.00,0.62
2339: 0,0.00,0.62
2370: 0,0.00,0.62
2400: 25343,0.08,44.52
2431: 0,0.00,0.62
2463: 0,0.00,0.62
2493: 231493,0.77,400.12
2524: 5464,0.02,10.09
2554: 84757,0.28,147.25
2585: 465211,1.55,801.95
2615: 123222,0.41,213.64
2646: 223548,0.75,386.45
2676: 384966,1.28,663.96
2707: 145576,0.49,252.18
2738: 0,0.00,0.62
2769: 0,0.00,0.62
2800: 118720,0.40,205.87
2831: 0,0.00,0.62
2862: 0,0.00,0.62
2893: 0,0.00,0.62
2924: 138761,0.46,240.43
2955: 102007,0.34,177.04
2986: 0,0.00,0.62
3017: 153547,0.51,265.92
3048: 11107,0.04,19.87
3078: 673729,2.25,1161.71
3109: 560051,1.87,965.29
3140: 0,0.00,0.62
3170: 185301,0.62,320.62