夏普GP2Y1010AU0F_粉尘传感器参考程序

合集下载

微雪Dust Sensor 用户手册说明书

微雪Dust Sensor 用户手册说明书

Dust Sensor灰尘传感器用户手册1.特性和原理本模块是以夏普GP2Y1010AU0F为核心的灰尘传感器。

传感器内部的红外二极管,可以输出一个跟灰尘浓度成线性关系的电压值。

通过该电压值即可计算出空气中的灰尘和烟尘含量。

测量对象:直径大于0.8μm灰尘颗粒有效量程:500μg/m3输出类型:电压模拟量工作电压: 2.5V~5.5V产品尺寸:63.2mm×41.3mm固定孔尺寸: 2.0mm通气孔尺寸:9.0mm1.1.传感器输出特性传感器输出电压与灰尘浓度关系在0到0.5mg/m3范围内成线性关系,如下图所示:图1: 传感器输出特性曲线1.2.传感器控制原理1)通过设置模块I LED引脚为高电平,从而打开传感器内部红外二极管。

2)等待0.28ms,外部控制器采样模块A OUT引脚的电压值。

这是因为传感器内部红外二极管在开启之后0.28ms,输出波形才达到稳定。

如下图所示:图2: I LED与红外二极管输出波形关系3)采样持续0.04ms之后,再设置I LED引脚为低电平,从而关闭内部红外二极管。

4)根据电压与浓度关系即可计算出当前空气中的灰尘浓度,具体实现细节请参考Demo程序。

注:输出的电压经过了分压处理(查看原理图),要将测得的电源放大11倍才是实际传感器输出的电压。

1.3.主要用途检测空气中灰尘浓度,用于空气净化器、空气质量监测仪、PM2.5检测仪等。

2.操作和现象2.1.传感器接口说明表1: 传感器接口说明2.2.连接开发板使用下面章节以四款不同类型的开发板为例,描述具体操作步骤及实验现象。

2.2.1.Open103R(主控芯片STM32F103R)1)编译下载Demo程序。

2)3)表2: 传感器和Open103R引脚对应关系4)开发板上电,可看到串口助手不断显示当前灰尘浓度值,当有大量灰尘颗粒进入通气孔时,数据发生明显变化,实验现象见附录。

2.2.2.Open407Z-C(主控芯片STM32F407Z)1)编译下载Demo程序。

基于单片机的智能空气净化系统

基于单片机的智能空气净化系统

2019年9月第19卷第3期廊坊师范学院学报(自然科学版)Journal of Langfang Normal University (Natural Science Edition)Sep.2019Vol.19 No.3基于单片机的智能空气净化系统郑安豫,杨胜春,李红祥,房雁平(安徽电气工程职业技术学院,安徽合肥230051)【摘要】设计了一种基于单片机的智能空气净化系统。

通过传感器实时采集空气中PM2.5、甲醛等有害健康物质的浓度,将各项数据显示到液晶显示屏,当浓度超过设置的警戒值时,控制蜂鸣器发出警报。

根据浓度大小控制空气净化 器电机转速,实现空气净化器的智能控制,空气质量差时,实现快速空气净化;空气质量好时,能省电降低噪音。

实验表 明,该系统对清除室内空气污染物质、提高室内空气质量有良好的效果。

【关键词】单片机;空气净化;传感器A Design of Intelligent Air Purifier System Based on MCUZHENG An-yu, YANG Sheng-chun, LI Hong-xiang, FANG Yan-ping(Anhui Electrical Engineering Professional Technique College, Hefei 230051, China)[Abstract] An smart air purification system based on 51 single chip computer is designed. The concentration of PM2.5,fbimaldehyde and other harmful health substances in the air is collected by sensors in real time, and the data are displayedon the LCD screen. When the concentration exceeds the standard, the buzzer is controlled to give an alarm. According to theconcentration, the motor speed of air purifier is controlled. When the air quality is poor, the rapid air purification is achieved.When the air quality is good, the power saving and noise reduction are achieved.[Key words] MCU; air purification; sensor冲图分类号〕TP212.9〔文献标识码〕A 〔文章编号〕1674 - 3229(20⑼03- 0039 - 030 引言随着生活水平的提高,人们对生活环境舒适度的要求也随之提高,室内装修也越来越精致。

空气粉尘浓度检测器电路设计与软件编程论文

空气粉尘浓度检测器电路设计与软件编程论文

空气粉尘浓度检测器电路设计与软件编程论文空气粉尘浓度检测器电路设计与软件编程论文本设计以ATmega382p单片机为控制中心,由GP2Y1010AU0F 光学空气质量传感器测量空气粉尘浓度,通过单片机内置的10位A/D 转换将模拟的电压信号转换成数字信号,得到粉尘浓度值,并由LCD1602显示屏显示出来。

同时,设置浓度预警值并同测量值一起显示在显示屏上。

当测量浓度超过预警值时,仪器就会报警。

0 引言随着人类工业和经济的快速发展,我们的环境污染越来越严重。

除废气、废水外,颗粒状粉尘、烟尘向大气排放所造成的污染已成为一个十分突出的问题。

PM2.5,PM10,PM0.1及其吸附的重金属粒子是雾霾的重要组成部分[1]。

2012年2月,《环境空气质量标准》新增了对PM2.5的检测指标,PM2.5成为空气质量标准之一。

数据表明,我国空气质量超标的城市中68%都存在可吸入颗粒物的问题[2]。

由此可以看出粉尘对人类健康和生产的危害十分严重。

所以,粉尘浓度的检测和控制具有重要的意义。

1 系统工作原理单片机选用ATmega328p,粉尘浓度传感器选用夏普GP2Y1010AU0F灰尘传感器,按键部分通过电阻与按键串联将信号输入模拟口,通过读取模拟值的不同判断按键值,显示部分采用LCD1602并用采取I2C总线的8位远程I/O扩展口芯片PCF8574进行引脚简化。

将粉尘检测器电源开关打开,当传感器得到一个由粉尘浓度转换得来的0~5V的`电压信号时,进入单片机,经过处理后转变为十进制数通过I/O口在显示屏上显示出精确数值。

数值量随输入电压的扰动而变化。

同时键盘设定预警值送入单片机,与测量值一同显示出来。

当采集的当前粉尘浓度大于预警值时,单片机驱动蜂鸣器报警。

2 系统电路设计2.1 电路总体设计以ATmega328p单片机为核心,主要包括单片机处理模块,信号采集模块,独立按键模块,显示模块和蜂鸣器报警模块。

系统通过信号采集模块采集空气中的粉尘,得到0~5V的电压信号后,由单片机内部自带的10位ADC进行模数转换得到粉尘浓度,与此同时,通过独立按键模块设定浓度预警值,通过液晶显示模块将粉尘浓度和预警值同时显示在显示屏上。

使用夏普GP2Y1010AU0F灰尘传感器检测空气质量..

使用夏普GP2Y1010AU0F灰尘传感器检测空气质量..

使用夏普GP2Y1010AU0F灰尘传感器检测空气质量夏普灰尘传感器价格较便宜,能检测出室内空气中的灰尘和烟尘含量.检测原理其原理如下图,传感器中心有个洞可以让空气自由流过,定向发射LED光,通过检测经过空气中灰尘折射过后的光线来判断灰尘的含量。

电路图因为数据是通过pin 5的电压模拟信号输出的,而树莓派的引脚不支持模拟信号直接读取(需要增加数模转换芯片),所以先用Arduino来实验。

Arduino 代码根据电路图,把Arduino和传感器连接起来:1.Sharp pin 1 (V-LED) => 5V 串联1个150欧姆的电阻(最好在电阻一侧和GND之间再串联一个220uf的电容)2.Sharp pin 2 (LED-GND) => GND3.Sharp pin 3 (LED) => Arduino PIN 2 (开关LED)4.Sharp pin 4 (S-GND) => GND5.Sharp pin 5 (Vo) => Arduino A0 pin (空气质量数据通过电压模拟信号输出)6.Sharp pin 6 (Vcc) => 5V1./*2.Interface to Sharp GP2Y1010AU0F Particle Sensor3.Program by Christopher Nafis4.Written April 20125.6.7.8.9.Sharp pin 1 (V-LED) => 5V (connected to 150ohm resister)10.Sharp pin 2 (LED-GND) => Arduino GND pin11.Sharp pin 3 (LED) => Arduino pin 212.Sharp pin 4 (S-GND) => Arduino GND pin13.Sharp pin 5 (Vo) => Arduino A0 pin14.Sharp pin 6 (Vcc) => 5V15.*/16.#include<SPI.h>17.#include<stdlib.h>18.19.int dustPin=0;20.int ledPower=2;21.int delayTime=280;22.int delayTime2=40;23.float offTime=9680;24.25.int dustVal=0;26.int i=0;27.float ppm=0;28.char s[32];29.float voltage=0;30.float dustdensity=0;31.float ppmpercf=0;32.33.void setup(){34.Serial.begin(9600);35. pinMode(ledPower,OUTPUT);36.37.// give the ethernet module time to boot up:38. delay(1000);39.40. i=0;41. ppm=0;42.}43.44.void loop(){45. i=i+1;46. digitalWrite(ledPower,LOW);// power on the LED47. delayMicroseconds(delayTime);48. dustVal=analogRead(dustPin);// read the dust value49. ppm=ppm+dustVal;50. delayMicroseconds(delayTime2);51. digitalWrite(ledPower,HIGH);// turn the LED off52. delayMicroseconds(offTime);53.54. voltage=ppm/i*0.0049;55. dustdensity=0.17*voltage-0.1;56. ppmpercf=(voltage-0.0256)*120000;57.if(ppmpercf<0)58. ppmpercf=0;59.if(dustdensity<0)60. dustdensity=0;61.if(dustdensity>0.5)62. dustdensity=0.5;63.String dataString="";64. dataString+=dtostrf(voltage,9,4,s);65. dataString+=",";66. dataString+=dtostrf(dustdensity,5,2,s);67. dataString+=",";68. dataString+=dtostrf(ppmpercf,8,0,s);69. i=0;70. ppm=0;71.Serial.println(dataString);72. delay(1000);73.}把传感器和Ardiuno连接好后,可以连续打印出传感器的输出电压值。

一种基于某51单片机地粉尘监测系统地设计—定稿子

一种基于某51单片机地粉尘监测系统地设计—定稿子

届.别.2016届学号毕业设计基于51单片机的PM2.5检测系统的设计与实现姓名系别、专业电子信息与电气工程学院电子信息科学与技术专业导师姓名、职称完成时间 2016年5月10日目录摘要 (I)Abstract (I)1 绪论 (1)1.1 课题背景 (1)1.2 国内外研究现状 (1)2 系统仿真软件与总体设计方案 (1)2.1 Keil4软件开发坏境 (1)2.2 软件烧录工具 (2)2.3程序结构分析 (4)2.4 整体的设计方案 (4)2.5电源模块 (4)3 主要元器件简介43.1 GP2Y1010AU0F传感器简介 (5)3.2 ADC0832模数转换器简介 (7)3.3 LCD1602液晶显示屏 (10)3.4 STC89C52单片机的简介 (12)4 系统单元电路模块设计 (15)4.1主控制模块 (15)4.2显示模块电路 (16)4.3关于报警模块的设计 (16)4.4按键模块的设计 (17)4.5粉尘模块电路设计 (17)4.6电源局部的设计 (17)5 系统测试与实现 (18)5.1系统程序流图 (18)5.2 仿真电路 (20)5.3 软件跟硬件结合 (21)5.4 测试结果分析 (23)5.5 系统实现 (23)6、总结 (24)致谢 (24)参考文献 (25)附录1:系统整体电路原理图 (26)附录2:系统设计局部源程序 (27)摘要现在社会开展的越来越快,随着工业的开展,虽然给人们的生活带来很多便利。

但是,在生产过程产生很多对人体有害的因素工业生产过程中会,例如煤炭灰开采、水泥生产等行业中的粉尘污染。

我的设计采用由LCD1602液晶模块、STC89C52单片机最小系统、ADC0832模数转换器模块、GP2Y1010AU粉尘传感器、电源模块、蜂鸣器报警模块和按键模块模块组成。

单片机是通过ADC0832转换芯片采集GP2Y1010AU粉尘传感器的粉尘的浓度,通过单片机的数据转换处理后在液晶屏上显示空气中的质量,测量空间中的粉尘浓度如果大于当时设置粉尘浓度时,蜂鸣器就会产生报警的声音和发光二极管发出声光报警。

夏普原版灰尘传感器gp2y1010au规格书

夏普原版灰尘传感器gp2y1010au规格书

GP2Y1010AU0FGP2Y1010AU0FCompact Optical Dust Sensor■Description■Features■Compliance■Applications1. Detecting of dust in the air.2. Example: Air purifier, Air conditioner, Air monitor1. Compliant with RoHS directive (2002/95/EC)1. Compact, thin package (46.0 × 30.0 × 17.6 mm)2. Low consumption current (Icc: MAX. 20 mA)3. The presence of dust can be detected by the photometry of only one pulse4. Enable to distinguish smoke from house dust5. Lead-free and RoHS directive compliantNotice The content of data sheet is subject to change without prior notice.In the absence of confirmation by device specification sheets, SHARP takes no responsibility for any defects that may occur in equipment using any SHARP devices shown in catalogs, data books, etc. Contact SHARP in order to obtain the latest device specification sheets before using any SHARP device.GP2Y1010AU0F is a dust sensor by optical sensing system.An infrared emitting diode (IRED) and an phototran-sistor are diagonally arranged into this device.It detects the reflected light of dust in air.Especially, it is effective to detect very fine particle like the cigarette smoke.In addition it can distinguish smoke from house dust by pulse pattern of output voltage.■Internal schematic■Outline Dimensions(Unit : mm)V-LEDLED-GND LED S-GND V O V CC123456132654Marking informationDate code (2 digit)1st digit2nd digitYear of production Month of productionA.D.Mark Month Mark2000011200112220022332003344200445520055662006677200778820088992009910X2010011Y::12Z repeats in a 10 year cycleCountry of originPhilippines■■ Absolute Maximum Ratings*1 Open drain drive inputParameter Symbol Rating Unit Supply voltageCC V Operating temperature T T opr −10 to +65°C −0.3 to V CC V −0.3 to +7Input terminal voltage V V LED *1Soldering temperaturesol−20 to +80°CElectro-optical Characteristics■ Recommended input condition for LED input terminalParameter ConditionsSymbol K V OC I LED *1 *2 *3*2 *3*2 *3R L =4.7k Ω*2LED terminal voltage = 0*2R L =∞MIN.0.3503.4−−TYP.0.50.9−1110MAX.1.50.65−2020Unit V/(0.1mg/m 3)V V mA mASensitivityOutput voltage at no dust V OH Output voltage range LED terminal current I CCConsumption current*1 Sensitivity is specified by the amount of output voltage change when dust density changes by 0.1 mg/m 3.And the dust density for detection is a value of the density of cigarette (MILD SEVEN®) smoke measured by the digital dust monitor (P-5L2: manufactured by SHIBATA SCIENTIFIC TECHNOLOGY LTD.).*2 Input condition is shown in Fig. 1*3 Output sampling timing is shown in Fig. 2(T a =25°C)(T a =25°C, V CC =5V)ParameterPulse Cycle Pulse WidthOperating Supply voltageSymbol T P W V CCValue 10 ± 10.32 ± 0.025 ± 0.5Unit ms ms VFig. 1 Input Condition for LED Input TerminalFig. 2 Sampling Timing of Output PulseI LEDRemarks : Please be aware that all data in the graph are just for reference and are not for guarantee.432100.20.40.60.8O u t p u t v o l t a g e (V )Dust density (mg/m 3)Fig. 3 Output Voltage vs. Dust Density●Notes1 Connection of case and GNDCase material use conductive resin as cover case {printed model No.} and metal {test terminal side}as bottom cover. The metal case connects with GND in sensor.2 CleaningPlease don’t do cleaning, because there is a case that this device is not satisfied with its characteristics by cleaning.3 Pulse input rangePlease subject to recommendation as regard input condition for LED in order to keep reliability.4 Dust adhesionThere is a case that this product does not detect the dust density correctly, since the dust adhered to the inside of the dust through hole may project into the detecting space which consist of emitter anddetector light axis. Please take the structure and mechanism of the equipment into consideration toavoid the influence of adhered dust. And when the dust is adhered, please consider the maintenance such as vacuuming or blowing off the dust by air.In addition, please pay attention to structure and placing location of the application to avoid anyadhesive particle like oil, etc. to gets into the device. If it sticks to optical part, malfunction may occur.5 Light outputIn circuit designing, make allowance for the degradation of the light emitting diode output that resultsfrom long continuous operation. (50% degradation/5 years)6 Sensitivity adjustment VRVR for sensitivity adjustment is set up at shipping from sharp. Please do not touch the VR orElectro-optical characteristics specified on the specification will be invalid.7 ResolutionPlease do not disassemble the device such as removing tapping screw and so on. Even if the device is reassembled, it may not satisfy the specification.8 Application to fire alarmPlease do not use this device for a fire alarm application. When using this device to application other than air purifying and equipment with air purifying function, please inform us before usage.9 Noise influenceIf the sensor is located close to noise generator (ex. Electric dust collector, etc. ), the sensor outputmay be affected by leaded noise. On top of that noise from power supply line also may affect thesensor output. When desinging the system, please consider the effect from noise.10 Vibration influenceThe sensor may change its value under mechanical oscillation. Before usage, please make surethat the device works normally in the application.11 Incident light influenceThere is a case that the sensor output may be affected when outer-light comes through dust through hole on printed side. In order to avoid any influence from outer-light, please locate the printed sideof sensor facing to inside of the application.12 When inside of the sensor is moisturized, this product does not keep its proper function. Pleasedesign the application so that moisturization of the sensor does not happen.Sheet No.: E4-A01501EN●Presence of ODC etc.This product shall not contain the following materials.And they are not used in the production process for this product.Regulation substances : CFCs, Halon, Carbon tetrachloride, 1.1.1-Trichloroethane (Methylchloroform) Specific brominated flame retardants such as the PBB and PBDE are not used in this product at all.This product shall not contain the following materials banned in the RoHS Directive (2002/95/EC).• Lead, Mercury, Cadmium, Hexavalent chromium, Polybrominated biphenyls (PBB),Polybrominated diphenyl ethers (PBDE).Packing SpecificationPACKING METHOD1. Each tray holds 50 pieces. Packing methods are shown in (A).2. Each box holds 5 trays. Pads are added to top (B).3. The box is sealed with packing tape. (C) shows the location of the Model number, Quantity, and Inspection date.4. Weight is approximately5.6 kg■Important Notices· The circuit application examples in this publication are provided to explain representative applications of SHARP devices and are not intended to guarantee any circuit design or license any intellectual property rights. SHARP takes no responsibility for any problems related to any intellectual property right of a third party resulting from the use of SHARP's devices.· Contact SHARP in order to obtain the latest device specification sheets before using any SHARP device. SHARP reserves the right to make changes in the spec- ifications, characteristics, data, materials, structure, and other contents described herein at any time without no-tice in order to improve design or reliability. Manufactur-ing locations are also subject to change without notice.· Observe the following points when using any devices in this publication. SHARP takes no responsibility for damage caused by improper use of the devices which does not meet the conditions and absolute maximum ratings to be used specified in the relevant specification sheet nor meet the following conditions:(i) The devices in this publication are designed for use in general electronic equipment designs such as:--- Personal computers--- Office automation equipment--- Telecommunication equipment [terminal]--- Test and measurement equipment--- Industrial control--- Audio visual equipment--- Consumer electronics(ii) Measures such as fail-safe function and redundant design should be taken to ensure reliability and safety when SHARP devices are used for or in connection with equipment that requires higher reliability such as:--- Transportation control and safety equipment (i.e., aircraft, trains, automobiles, etc. )--- Traffic signals--- Gas leakage sensor breakers--- Alarm equipment--- Various safety devices, etc.(iii) SHARP devices shall not be used for or in connec-tion with equipment that requires an extremely high level of reliability and safety such as:--- Space applications--- Telecommunication equipment [trunk lines]--- Nuclear power control equipment--- Medical and other life support equipment (e.g., scuba).· If the SHARP devices listed in this publication fall within the scope of strategic products described in the Foreign Exchange and Foreign Trade Law of Japan, it is necessary to obtain approval to export such SHARP devices.· This publication is the proprietary product of SHARP and is copyrighted, with all rights reserved. Under the copyright laws, no part of this publication may be re-produced or transmitted in any form or by any means, electronic or mechanical, for any purpose, in whole or in part, without the express written permission of SHARP. Express written permission is also required before any use of this publication may be made by a third party.· Contact and consult with a SHARP representative if there are any questions about the contents of this publi-cation.Sheet No.: E4-A01501EN。

灰尘传感器 GP2Y1010AU

灰尘传感器 GP2Y1010AU

灰尘传感器GP2Y1010AU
型号:GP2Y1010AU
主要特点:
日本夏普公司灰尘传感器GP2Y1010AU,体积小巧,灵敏度高,可以用来测量0.8微米以上的微小粒子,可用于室内环境中烟气、粉尘、花粉等浓度的检测。

此款产品不但可以检测出单位体积粒子的绝对个数,而且内置气流发生器,可以自行吸入外部空气。

灰尘传感器GP2Y1010AU安装保养方便,使用寿命长,精度高,稳定性好。

应用领域:
1、空气净化器和空气清新机;
2、空调;
3、空气质量监控仪;
4、空调等相关产品。

主要参数:
灵敏度:0.5V/(0.1mg/m3)
输出电压:0.9V(TYP)
消耗电流:11mA
工作温度:-10~65℃
存储温度:-20~80℃。

GP2Y1010AU0FC0L模块使用说明书

GP2Y1010AU0FC0L模块使用说明书

开发控制板组成,
GP2Y1010AU0FC01模块使用说明书
一, 简介
1,该模块由夏普粉尘传感器GP2Y1010AU0F 和模块型号是:GP2Y1010AU0FC01,模块经过精确标定后,检测空气中的粉尘浓度,精度高,一致性强。

2,传感器智能校准:当灰尘附着于传感器或传感器老化时,系统会自动进行浓度参数校准,确保测量的准确性。

3,提供多种浓度值输出接口:模拟电压输出:灰尘浓度越高,输出模拟电压越高。

数字串口输出;供其它平台MCU 直接读取。

二,接线图
第一脚:5V 工作电压输入端
第二脚:串口数据输出
第三脚:串口数据输入
第四脚:灰尘浓度模拟电压输出
第五脚:不用连接
第六脚:工作电压地
三,技术参数
四,通信协议命令格式
1,模块读取除尘机工作状态:
传感器发送命令格式:05FEF603
除尘机收到上述命令后返回工作状态
①除尘机处于开机状态:返回数据格式06FEF103
②除尘机处于关机状态:返回数据格式06FEF003
2,除尘机读取灰尘浓度值:
除尘机发送命令格式:05FEF503
模块收到上述指令后返回浓度值。

返回数据格式:06ABCD03
浓度计数方法:浓度值(十六进制)=0XABCD(ug/m3)。

例如AB=01,CD=0X23:则
浓度(十六进制)=0X0123(ug/m3)
浓度(十进制)=291(ug/m3)。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

夏普GP2Y1010AU0F_粉尘传感器参考程序简介:
Sharp's GP2Y1010AU0F 是一款光学空气质量传感器,设计用来感应空气中的尘埃粒子,其内部对角安放着红外线发光二极管和光电晶体管,使得其能够探测到空气中尘埃反射光,即使非常细小的如烟草烟雾颗粒也能够被检测到,通常在空气净化系统中应用。

该传感器具有非常低的电流消耗(最大20mA,典型值11mA),可使用高达7VDC。

该传感器输出为模拟电压,其值与粉尘浓度成正比。

可测量0.8微米以上的微笑粒子,感知烟草产生的咽气和花粉,房屋粉尘等.体积小,重量轻,便于安装,广泛应用于空气清新机,换气空调,换气扇等产品.
灵敏度:
0.5V/0.1mg/m3
尺寸:
46.0 × 30.0 × 17.6 mm)
Do not miss the 150ohm resistor and a 220uF capacitor
Arduino Pin
Sensor
Pin
1Vled–>5V (150ohm
resistor)
2LED-GND–>GND
3LED–>Digital pin 2
4S-GND–>GND
5Vo–>Analog pin 0
6Vcc–>5V
The LED pin has to be modulated with a cycle of 1ms as discussed in the datasheet. The LED seems to use a PNP transistor so to power on, the LED pin must actually recieve a lower voltage.
例程;
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);
}
如有侵权请联系告知删除,感谢你们的配合!。

相关文档
最新文档