“(SKU:SEN350406)夏普灰尘空气质量传感器模块 PM2.5 GP2Y10 SHARP”的版本间的差异
来自YwRobot Studio Wiki
YWrobot WM(讨论 | 贡献) |
(→样例代码) |
||
第26行: | 第26行: | ||
===样例代码=== | ===样例代码=== | ||
<pre style="color:blue"> | <pre style="color:blue"> | ||
− | + | /* | |
+ | Standalone Sketch to use with a Arduino UNO and a | ||
+ | Sharp Optical Dust Sensor GP2Y1010AU0F | ||
+ | */ | ||
+ | |||
+ | 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); | ||
+ | } | ||
</pre> | </pre> | ||
2017年1月11日 (三) 09:23的最新版本
简介
GP2Y1010AU0F 是一款光学空气质量传感器,设计用来感应空气中的尘埃粒子,其内部对角安放着红外线发光二极管和光电晶体管,使得其能够探测到空气中尘埃反射光,即使非常细小的如烟草烟雾颗粒也能够被检测到,通常在空气净化系统中应用。该传感器具有非常低的电流消耗(最大20mA,典型值11mA),可使用高达7VDC。该传感器输出为模拟电压,其值与粉尘浓度成正比。 可测量0.8微米以上的微笑粒子,感知烟草产生的咽气和花粉,房屋粉尘等.体积小,重量轻,便于安装,广泛应用于空气清新机,换气空调,换气扇等产品. 灵敏度:0.5V/0.1mg/m3
产品参数
- 型号:GP2Y10
- 尺寸:46*30*17.6mm
- 重量:约16g
- 电压:5-7V
- 功耗:<20ma
- 工作温度:-10~65℃
- 检测粒子:>0.8微米
- 灵敏度:0.5V/(0.1mg/m³)
- 输出:模拟量电压(0.9V洁净空气典型电压)
- 检测原理:光电对管检测空气中灰尘反射光
- 典型应用:烟雾、空气质量、PM2.5检测等
使用教程
样例代码
/* Standalone Sketch to use with a Arduino UNO and a Sharp Optical Dust Sensor GP2Y1010AU0F */ 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); }
更多
[YWRobot产品资料下载]
购买 YWRobot商城购买链接
购买 YWRobot商城购买链接