Arduino 各种模块篇 粉尘传感器 dust sensor 空气质量检测

Testing a sensor from here.

http://www.seeedstudio.com/wiki/Grove_-_Dust_Sensor

It's a dust sensor. Everyone can buy it anywhere also. It's a cheep one actually.

We can find its document here: http://www.seeedstudio.com/wiki/images/4/4c/Grove_-_Dust_sensor.pdf

Arduino 各种模块篇 粉尘传感器 dust sensor 空气质量检测

It looks good.

It's more cheaper if you buy it from taobao.com or other whole sellers.

Now cut the crap, just send me those codes here:

/* 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 = ;
unsigned long duration;
unsigned long starttime;
unsigned long sampletime_ms = ;//sampe 30s ;
unsigned long lowpulseoccupancy = ;
float ratio = ;
float concentration = ; void setup() {
Serial.begin();
pinMode(,INPUT);
starttime = millis();//get the current time;
} void loop() {
duration = pulseIn(pin, LOW);
lowpulseoccupancy = lowpulseoccupancy+duration; if ((millis()-starttime) > sampletime_ms)//if the sampel time == 30s
{
ratio = lowpulseoccupancy/(sampletime_ms*10.0); // Integer percentage 0=>100
concentration = 1.1*pow(ratio,)-3.8*pow(ratio,)+*ratio+0.62; // using spec sheet curve
Serial.print(lowpulseoccupancy);
Serial.print(",");
Serial.print(ratio);
Serial.print(",");
Serial.println(concentration);
lowpulseoccupancy = ;
starttime = millis();
}
}

Here's what you can get

Arduino 各种模块篇 粉尘传感器 dust sensor 空气质量检测

via serial promte, you can see:

Arduino 各种模块篇 粉尘传感器 dust sensor 空气质量检测

For more information , you can check this out the link above.

Now please let me explain it from the bottom of it:

Arduino 各种模块篇 粉尘传感器 dust sensor 空气质量检测

Let's see what the spec sheet carve of it:

The curve indicates that the bigger of the Concentration value is, the higher of the Low Pluse Occupancy will be.

So what's the Low Pulse Occupancy Time perentage for?

Let's check out this:

Arduino 各种模块篇 粉尘传感器 dust sensor 空气质量检测

we count the time from the starting moment of the low pulse begins until the moment of next high pulse stops.

The time we can get is the cycle period. We can caculate the ratio of the LowPluseOccupancyTime/TheTimeWeSetToMeasure

    # radio = LowPluseOccupancyTime/TheTimeWeSetToMeasure

With help of the chart which indicates the relationship of between the LowPulseOccupancyTimePercentage and the concentration, we can get the air quality value.

Arduino 各种模块篇 粉尘传感器 dust sensor 空气质量检测

the unit of the concentration is   : PCS/Liter.

PCS/liter is short for Particals / Liter

####################3

P.S. : There is another good air quality measuring module which looks like this :https://www.sparkfun.com/products/9689

I haven't tested it. But it looks neat and somehow better I guess.

So my next project will have something to do with a LIVE BROADCASTING AIR QUALITY STATION!

Let's see :)

上一篇:Thinkphp5 分页带参数


下一篇:Arduino 各种模块篇 震动模块 vibrator module