介紹
鋒利的光學粉塵感應器 (GP2Y1010AU0F) 是在檢測極細的粒子像香煙的煙霧特別有效和常用的空氣淨化系統。
紅外發射二極體和光敏三極管對角地被安排到這個設備,使其能夠檢測空氣中的灰塵反射的光。
感應器具有非常低的電流消耗 (20mA 最大,11mA 典型),可以與通電 7VDC。感應器的輸出是類比電壓成正比測量的粉塵濃度,靈敏度為 0.5V/0.1mg/m3。
規格
##電源電壓: 5-7V
##工作溫度:-10-65 攝氏度度
##消耗電流: 20mA 最大
int measurePin = 0; //Connect dust sensor to Arduino A0 pin
int ledPower = 2; //Connect 3 led driver pins of dust sensor to Arduino D2
int samplingTime = 280;
int deltaTime = 40;
int sleepTime = 9680;
float voMeasured = 0;
float calcVoltage = 0;
float dustDensity = 0;
void setup(){
Serial.begin(9600);
pinMode(ledPower,OUTPUT);
}
void loop(){
digitalWrite(ledPower,LOW); // power on the LED
delayMicroseconds(samplingTime);
voMeasured = analogRead(measurePin); // read the dust value
delayMicroseconds(deltaTime);
digitalWrite(ledPower,HIGH); // turn the LED off
delayMicroseconds(sleepTime);
// 0 - 5V mapped to 0 - 1023 integer values
// recover voltage
calcVoltage = voMeasured * (5.0 / 1024.0);
// linear eqaution taken from http://www.howmuchsnow.com/arduino/airquality/
// Chris Nafis (c) 2012
dustDensity = 0.17 * calcVoltage - 0.1;
Serial.print("Raw Signal Value (0-1023): ");
Serial.print(voMeasured);
Serial.print(" - Voltage: ");
Serial.print(calcVoltage);
Serial.print(" - Dust Density: ");
Serial.println(dustDensity); // unit: mg/m3
delay(1000);
}