float dustVal=0;
int ledPower=2;
int delayTime=280;
int delayTime2=40;
float offTime=9680;
void setup(){
Serial.begin(9600);
pinMode(ledPower,OUTPUT);
pinMode(dustPin, INPUT);
}
void loop(){
// ledPower is any digital pin on the arduino connected to Pin 3 on the sensor
digitalWrite(ledPower,LOW);
delayMicroseconds(delayTime);
dustVal=analogRead(dustPin);
delayMicroseconds(delayTime2);
digitalWrite(ledPower,HIGH);
delayMicroseconds(offTime);
delay(1000);
if (dustVal>36.455)
Serial.println((float(dustVal/1024)-0.0356)*120000*0.035);
}


主要特点:
日本夏普公司灰尘传感器GP2Y1010AU,体积小巧,灵敏度高,可以用来测量0.8微米以上的微小粒子,可用于室内环境中烟气、粉尘、花粉等浓度的检测。此款产品不但可以检测出单位体积粒子的绝对个数,而且内置气流发生器,可以自行吸入外部空气。
灰尘传感器GP2Y1010AU安装保养方便,使用寿命长,精度高,稳定性好。
应用领域:
1、空气净化器和空气清新机;
2、空调;
3、空气质量监控仪;
4、空调等相关产品。
主要参数:
该装置中,一个红外发光二极管和光电晶体管,对角布置成允许其检测到在空气中的灰尘反射光。
该传感器具有极低的电流消耗(最大20mA,11毫安典型的),可以搭载高达7VDC的传感器。输出的是一个模拟电压正比于所测得的粉尘浓度,敏感性为0.5V/0.1mg/m3。
规范
电源电压:5-7V
工作温度:-10-65摄氏度
消耗电流:20mA最大
最小粒子检出值:0.8微米
灵敏度:0.5V/(0.1mg/m3)
清洁空气中电压:0.9V 典型值
工作温度:-10~65℃
存储温度:-20~80℃
使用寿命:5年
尺寸大小:46mm×30mm×17.6mm
重量大小:15g
Arduino 源代码
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | int dustPin=0; int dustVal=0; int ledPower=2; int delayTime=280; int delayTime2=40; float offTime=9680; void setup(){ Serial.begin(9600); pinMode(ledPower,OUTPUT); pinMode(4, OUTPUT); } void loop(){ // ledPower is any digital pin on the arduino connected to Pin 3 on the sensor digitalWrite(ledPower,LOW); // power on the LED delayMicroseconds(delayTime); dustVal=analogRead(dustPin); // read the dust value via pin 5 on the sensor delayMicroseconds(delayTime2); digitalWrite(ledPower,HIGH); // turn the LED off delayMicroseconds(offTime); delay(3000); Serial.println(dustVal); } |

