使用夏普GP2Y1010AU0F灰尘传感器检测空气质量
微雪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程序。
基于stm32单片机的空气净化器设计
基于stm32单片机的空气净化器设计一、系统总体设计本空气净化器主要由传感器模块、风机模块、净化模块、控制模块和显示模块组成。
传感器模块用于检测空气中的污染物浓度,如 PM25、甲醛、TVOC 等。
常见的传感器有激光粉尘传感器、电化学甲醛传感器等。
这些传感器将检测到的数据传输给控制模块。
风机模块负责驱动空气流动,使空气经过净化模块进行净化处理。
风机的转速可以根据空气质量的好坏进行调节,以达到节能和高效净化的目的。
净化模块是空气净化器的核心部分,通常采用多层滤网结构,包括初效滤网、高效滤网(HEPA 滤网)、活性炭滤网等。
初效滤网主要过滤大颗粒灰尘,高效滤网能有效去除微小颗粒物,活性炭滤网则用于吸附甲醛、TVOC 等有害气体。
控制模块采用 stm32 单片机作为核心处理器,接收传感器模块传来的数据,并根据预设的算法控制风机模块和净化模块的工作状态。
同时,还负责与显示模块进行通信,将空气质量信息和设备工作状态显示出来。
显示模块一般采用液晶显示屏(LCD)或触摸屏,向用户直观地展示空气质量指标、工作模式、风速等信息,方便用户操作和了解设备运行情况。
二、硬件设计1、传感器选型与接口设计选择精度高、响应速度快的传感器。
例如,选用夏普的GP2Y1010AU0F 粉尘传感器来检测 PM25 浓度,其输出为模拟电压信号,通过 ADC 转换后输入到 stm32 单片机。
对于甲醛和 TVOC 检测,采用 ZE08-CH2O 电化学传感器,其输出为数字信号,通过 UART 接口与单片机通信。
2、风机驱动电路设计选用无刷直流电机作为风机,通过 MOSFET 管组成的 H 桥电路进行驱动。
stm32 单片机输出的PWM 信号控制MOSFET 的导通与截止,从而实现风机转速的调节。
3、净化模块电路设计净化模块中的滤网需要定期更换,通过在滤网上安装检测装置,将滤网的使用情况反馈给单片机,当滤网达到使用寿命时,通过显示模块提醒用户更换。
基于单片机的智能空气净化系统
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 引言随着生活水平的提高,人们对生活环境舒适度的要求也随之提高,室内装修也越来越精致。
使用夏普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连接好后,可以连续打印出传感器的输出电压值。
夏普原版灰尘传感器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。
基于51单片机下的空气质量测试仪
《基于51单片机下的空气质量测试仪》的文献综述项目名称:基于51单片机下的空气质量测试仪项目负责人:杨宽(学号:16012311)项目参加者:白名章(学号:16012312)姚宇(学号:16012628)许珊(学号:16012306)项目指导老师:潘石(所属院系:电气工程学院)一.背景介绍工农业的快速发展使得人们物质生活水平得到前所未有的快速提高,但是随之而来的空气污染问题却愈加严重。
世界银行发布的报告表明,由空气污染导致的过早死亡人数,平均为每天1000人,也就是每年有35至40万的人面临着死亡。
近年来,随着一连串有关空气质量问题的事件的发生,人们对空气污染问题愈加地担忧,对创建绿色健康的生活环境的呼声也日益高涨。
中国环境监测总站2012年5月下发的《PM2.5自动监测仪器技术指标与要求(试行)》确定了三种PM2.5的自动监测方法,分别是β射线方法仪器加装动态加热系统,β射线方法仪器加动态加热系统联用光散射法,微量振荡天平方法仪器加膜动态测量系统。
这些方法固然准确,但是我们只能通过媒体查询获得关于较大范围内,比如整个城市内的空气质量指数,却不能实时地监测身边的尤其是室内的空气质量,从而不能及时注意到身边的空气质量变化,安全健康的生活环境便不能得到有效的保障。
所以,有必要设计一种便携式的用于室内空气质量监测的设备,通过检测设备显示的空气质量的级别高低使用户对室内空气质量有一个定性和定量的了解,为人们拥有一个舒适健康的生活环境提供保障。
二.国内外空气质量检测研究现状在空气质量监测方面,国外做的比较好的有:美国Interscan科技有限公司生产的4000型空气质量分析仪,英国PPM公司生产的PPM-400甲醛检测仪;国内的有:邯郸派瑞气体设备有限公司研制的“派瑞”系列空气健康表,江西南昌贝谷科技股份有限公司生产的“甲保御”牌室内环境污染标定仪等。
但是,目前国内的产品较之国外的产品在功能的完备度,检测精度以及用户体验等方面还有一定的差距,国外产品的功能比较完备,测量精度高,系统交互界面相对人性化,因此价格比较高。
夏普灰尘传感器原理
夏普灰尘传感器原理夏普灰尘传感器是一种常用于空气质量监测的传感器,可以通过测量空气中的灰尘浓度,判断空气的污染程度。
它是基于光学原理工作的,通过测量光的散射来间接测量空气中的灰尘颗粒数量。
夏普灰尘传感器的原理是利用散射光的特性来测量灰尘浓度。
当光线照射到灰尘粒子上时,由于灰尘粒子的形状和大小不同,光线会发生不同程度的散射。
传感器中的激光二极管发射出一束单色激光,该激光经过准直透镜和散射板,形成一束平行光。
当光线遇到空气中的灰尘粒子时,部分光线会被散射到散射板上的光敏电阻。
散射到散射板上的光线,会被光敏电阻转化为电信号。
夏普灰尘传感器采用了光敏电阻的电阻值与光强成反比的原理。
当光敏电阻接收到较少的光线时,电阻值较高,电流较小;当光敏电阻接收到较多的光线时,电阻值较低,电流较大。
通过测量光敏电阻的电流大小,就可以得到空气中灰尘的浓度。
为了避免其他因素干扰,夏普灰尘传感器采用了光路双光子法。
传感器中设置两个光敏二极管,其中一个光敏二极管用来检测散射光的强度,另一个光敏二极管用来检测透射光的强度。
透射光是指光线通过空气中没有灰尘的部分,达到另一侧光敏二极管上。
通过对比散射光和透射光的强度差异,可以消除其他因素对灰尘浓度测量的影响,提高测量的准确性。
夏普灰尘传感器还通过在光路中加入一个专用滤光片来选择测量特定粒径的灰尘颗粒。
这个滤光片只允许特定波长的光线通过,其他波长的光线则会被滤除。
通过选择适当的滤光片,可以使传感器只测量某一特定粒径的灰尘颗粒,排除其他尺寸颗粒的干扰。
综上所述,夏普灰尘传感器是通过测量光线的散射来间接测量空气中的灰尘浓度。
传感器采用了散射光和透射光之间的差异,以及滤光片的选择,来消除其他因素对测量结果的影响。
这种原理使得夏普灰尘传感器在空气质量监测领域具有较高的准确性和可靠性。
夏普GP2Y1010AU0F_粉尘传感器参考程序
夏普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 capacitorSensor Pin Arduino Pin1Vled–>5V (150ohmresistor)2LED-GND–>GND3LED–>Digital pin 24S-GND–>GND5Vo–>Analog pin 06Vcc–>5VThe 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 sensordigitalWrite(ledPower,LOW); // power on the LED delayMicroseconds(delayTime);dustVal=analogRead(dustPin); // read the dust value via pin 5 on the sensordelayMicroseconds(delayTime2);digitalWrite(ledPower,HIGH); // turn the LED off delayMicroseconds(offTime);delay(3000);Serial.println(dustVal);}。
灰尘传感器 GP2Y1010AU
灰尘传感器GP2Y1010AU
型号:GP2Y1010AU
主要特点:
日本夏普公司灰尘传感器GP2Y1010AU,体积小巧,灵敏度高,可以用来测量0.8微米以上的微小粒子,可用于室内环境中烟气、粉尘、花粉等浓度的检测。
此款产品不但可以检测出单位体积粒子的绝对个数,而且内置气流发生器,可以自行吸入外部空气。
灰尘传感器GP2Y1010AU安装保养方便,使用寿命长,精度高,稳定性好。
应用领域:
1、空气净化器和空气清新机;
2、空调;
3、空气质量监控仪;
4、空调等相关产品。
主要参数:
灵敏度:0.5V/(0.1mg/m3)
输出电压:0.9V(TYP)
消耗电流:11mA
工作温度:-10~65℃
存储温度:-20~80℃。
空气粉尘浓度检测器电路设计与软件编程
空气粉尘浓度检测器电路设计与软件编程作者:李冉朱思清王翊钱国明来源:《科技视界》2016年第12期【摘要】本设计以ATmega382p单片机为控制中心,由GP2Y1010AU0F光学空气质量传感器测量空气粉尘浓度,通过单片机内置的10位A/D转换将模拟的电压信号转换成数字信号,得到粉尘浓度值,并由LCD1602显示屏显示出来。
同时,设置浓度预警值并同测量值一起显示在显示屏上。
当测量浓度超过预警值时,仪器就会报警。
【关键词】粉尘;单片机;传感器;A/D转换【Abstract】Adopts ATmega382p microcomputer as the control center of the design, uses GP2Y1010AU0F optical air quality sensor measuring air dust concentration, then through the 10 bit A/D conversion built in the microcomputer converting the analog voltage signal into digital signal,so that dust concentration can gained and finally showed out by the LCD1602. At the same time, set the warning value of the concentration and showed together with the measured value. When the measured concentration exceeds the warning value, the instrument will alarm.【Key words】Dust; Microcomputer; Sensor; A/D Conversion0 引言随着人类工业和经济的快速发展,我们的环境污染越来越严重。
基于单片和GP2Y1010AUOF的空气粉尘浓度检测仪的设计研究的毕业论文
基于单片机和GP2Y1010AUOF的空气粉尘浓度检测仪的设计研究的毕业论文目录1绪论 (1)1.1前言 (1)1.2研究背景 (1)1.3研究现状 (2)1.4研究内容: (3)1.5拟采用的研究思路与方法 (4)2粉尘浓度检测仪的硬件原理 (5)2.1粉尘浓度检测仪的功能和技术指标 (5)2.1.1所设计的系统的功能 (5)2.1.2系统的主要技术指标 (5)2.2粉尘的检测原理 (5)2.3系统硬件设计框图 (6). 2.4 软件程序框图 (7)2.5工作原理 (8)3 粉尘测试仪硬件设计 (9)3.1单片机部分 (9)3.1.1系统CPU器件选择 (9)3.1.2 单片机引脚分配及连接 (12)3.2 信号采集电路 (13)3.2.2 A/D转换电路 (18)3.2.3 ADC0809的主要特性 (18)3.2.4 ADC0809 芯片的引脚图及引脚功能 (19)3.2.5 ADC0809对输入通道选择 (20)3.2.6 ADC0809数据采集时序图 (20)3.2.7 ADC0809与AT89S52 单片机的接口设计 (21)3.2.8 74LS74 (21)3.2.9 74LS373 (23)3.2.10 74LS02介绍 (24)3.2.11 74LS04介绍 (25)3.3 数码管显示部分 (26)3.3.1 LED数码管概述 (26)3.3.2 LED数码管动态显示方式 (27)3.3.3 显示接口设计 (29)3.4 键盘电路设计 (30)3.5浓度参考值设定的设计 (31)3.6 报警电路设计(蜂鸣器) (32)3.7 看门狗部分的设计 (33)3.8定时/计数器使用步骤 (34)3.9 定时计数初值的计算 (34)4 系统设计 (35)4.1工作过程 (35)4.2 ADC0809数据采集及输出控制信号时序 (36)4.3键盘扫描程序流程图 (36)4.4数码管显示流程图 (37)4.5看门狗程序流程图 (38)5 结论 (39)致谢 (40)参考文献 (41)附录 (42)1绪论1.1前言随着中国经济的进步,经过人们的不懈努力,我们国民的生活大大的提高了。
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)。
空气质量检测传感器的使用方法
空气质量检测传感器的使用方法空气质量是我们生活中非常重要的一个环境指标,了解空气中各种有害物质的浓度对我们的健康至关重要。
传感器技术的发展使得空气质量检测变得更加简单和可靠。
本文将介绍空气质量检测传感器的使用方法,帮助你了解如何正确使用这样的设备。
首先,了解空气质量检测传感器的原理非常重要。
空气质量检测传感器是一种能够感知空气中特定有害物质浓度的设备,如二氧化碳、甲醛、苯等。
传感器通常是由一个探测元件和一个测量电路组成的。
探测元件负责感知空气中有害物质的浓度,测量电路则负责将这些信号转化为人们可以理解的数据。
接下来,了解传感器的种类和功能是非常重要的。
根据需要检测的有害物质种类不同,空气质量检测传感器有多种类型。
例如,有些传感器可以检测一种特定的有害物质,而其他传感器可以同时检测多种有害物质。
选择适合自己需要的传感器是确保准确检测空气质量的关键。
在开始使用空气质量检测传感器之前,确保传感器正常工作是非常重要的。
检查传感器的电池电量或电源接线是否正常,确保传感器所连接的设备或显示屏正常启动。
有些传感器还需要进行校准操作,确保其准确度和精度。
请确保按照厂家提供的说明书进行校准操作,以获得准确的测量数据。
使用空气质量检测传感器进行检测时,应选择一个合适的位置。
传感器应该放置在空气流通的区域,避免直接阳光照射、暖气、空调等可能影响测量结果的因素。
应将传感器置于离地面一定高度的位置,避免其他物体的阻挡对测量结果造成干扰。
为了获得更准确的测量结果,应尽量避免测量时的人员活动,例如走动或晃动传感器。
进行测量之前,确保传感器已经预热。
预热时间根据传感器的类型和厂家的要求而定,一般在几分钟到几十分钟之间。
在预热期间,传感器会自动调整并稳定测量结果。
进行空气质量检测时,应密切关注传感器所提供的数据。
一般来说,数据会以数值或图形的形式显示在传感器的屏幕上。
要确保读数的准确性,应该注意传感器的测量单位,并熟悉各种有害物质的安全标准。
夏普GP2Y1051AU0F灰尘传感器规格书说明书
修改记录表 Model no.
日期Ref.
页码内容备注
确认&批准
批准核对核对制定
2014.07.01 - 制定
参考特性数据,测试条件参见“※1”
输
出
电
压
(
V
)
埃濃度(mg/㎥)
3.1 产品外观
GP1051AU0F
公司简介
深圳盛世物联科技有限公司(Shenzhen Sense IoT Technology Co.,Ltd)专业代理推广国际知名品牌环境传感器及半导体元器件产品,是一家由多位环境科学领域的资深人士联合创建的集技术开发与代理分销为一体的高新技术企业。
面向物联传感应用,公司长期致力于室内环境空气品质及有害气体监控产品的技术开发,并提供相关配套的传感器、IC、模块、设备以及行业应用方案支持,技术应用涉及温湿度传感、压力传感、气体传感、加速度传感等监测领域,产品涵盖Freescale、TI、Sharp、GE(Amphenol)安费诺、Silicon Labs、PLX、Micron、Sensirion、SenseAir、ST、City、Honeywell、Measurement(Humirel)精量等国际知名品牌,服务客户遍及石油化工、电力电子、汽车智能、空气净化、楼宇暖通、医药监测、食品安全、现代农业等众多终端。
盛世物联拥有一支经验丰富的专业技术/营销团队,以快速响应您的需求,并一如既往的为您提供最先进的产品技术、最优化的解决方案、最快捷的物流服务和最具竞争力的产品价格服务。
盛世追梦,物联你我!感谢亲一直以来的大力支持,祝商祺!。
灰尘传感器GP2Y1010AU0F使用说明1
1.4 代码说明: 由于参考代码过多,在此对于常见的代码不予讲解,下面对于核心代码进行说明。 430 单片机特点:16 位处理器,低功耗,8M 的主系统时钟决定单指令周期为 0.125us,内 部集成众多外设,包括 12 位 ADC,定时器 A,定时器 B。强调一点是,由于此传感器要求 采样时序较为精确,因此像 430 这种中端的微处理器或者更高端的处理器比较适合开发此传 感器,也就是说指令的处理速度越快越好。 430 单片机带动传感器工作一次的时间大概为 1.5s,工作期间不间断提供输入脉冲,大概到 1s 左右,此时传感器的工作已经稳定,因此可以开始采样了,连续采样 4 次,然后将数据 取平均值,这就是一次工作的整个流程。这样的设计思路既可以保证传感器的读值稳定性, 又可以做到低功耗。 输入信号由定时器 A 产生,P1.2(TA1)输出,ADC 采样时序的控制由定时器 B 控制,使用 片内 12 位的 ADC 进行采样,采样的参考电压是系统电压 3.2V(做法比较粗糙),采样后直 接转成模拟信号的表达形式,最后输出的是电压值,对于电压转换到 PM2.5 的值,在 1.5 节 有简单说明。
5
官方直营淘宝店铺:/item.htm?spm=a1z09.5.0.0.4mLru6&id=25584528001
Curr_Volt=caltmp>>12; ptr[0]=Curr_Volt/100;//Hex->DEC 变换,百位 t1=Curr_Volt-(ptr[0]*100); ptr[1]=t1/10;//十位 ptr[2]=t1-(ptr[1]*10);//各位 }
430 的 P1.2 作为脉冲的输入脚,为传感器提供输入信号 传感器的引脚按照 datasheet 中典型电路来接,R1、C1 分别为 150Ω和 220uF 的电解电
夏普SHARP灰尘颗粒传感器GP2Y1010AU0F
GP2Y1010AU0F11807-0430-980© SHARP CorporationGP2Y1010AU0FCompact 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 dustby 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.。
基于STM32单片机的便携式空气净化器设计
www�ele169�com | 3电子科技0 引言近年来国内雾霾现象日益严重,国内多地受雾霾持续困扰,室内外空气中的微粒、细菌、病毒和其他有害物质对人体健康构成危害,特别是对长期工作或生活在恶劣环境下的人[1]。
本文设计出一种多功能便捷式空气净化器,在检测空气质量的同时还可以利用过滤层及负离子发生器改善人体吸入空气的质量,通过物联网芯片将实时的空气质量传送给服务器进行分析。
本设计可根据环境选取风量调速模式,具有能耗低,维护简单和可随身携带等优点。
1 系统整体设计本设计基于STM32单片机,由负离子发生器、微风扇、空气过滤装置等系统组成。
微风扇使空气流动,流动的空气经过装在风口的负离子发生器,将空气不断电离,产生大量负离子,形成负离子气流,依次通过机内的粗滤棉、活性炭滤芯、PM2.5试纸后将各种污染物过滤或吸附,达到清洁净化空气的目的。
图1 净化空气流程在雾霾环境下,传感器感知周围空气,通过液晶显示屏显示当前未净化空气的PM2.5值、温度值和湿度值。
通过风扇的作用,空气先流过负离子发生器,将空气中带电的大颗粒吸附到铁丝过滤网上,通过粗滤棉进行第一层过滤,活性炭网进行第二层过滤,PM2.5滤纸过滤小微粒,再通过负离子发生器净化空气,使人体可以呼吸到洁净空气。
此外,本系统搭配不同类型出风口也可作为车载净化器使用。
2 系统硬件组成■2.1 系统主控模块本设计选用STM32单片机作为数据处理模块,其对数据的处理速度快,能实时采样PM2.5传感器、温湿度传感器检测的数据,精确计算出粉尘浓度、温湿度,把实时数据传输给OLED 显示屏,具有性价比高,功耗低等特点。
■2.2 PM2.5检测模块本设计采用夏普PM2.5粉灰尘传感器GP2Y1010AU0F检测模块,利用光学空气质量传感器感应空气中的尘埃粒子。
内部的红外线发光二极管和光电晶体管,使其能够探测到空气中尘埃反射光,通过检测经过空气中灰尘折射过后的光线来判断灰尘的含量。
PM2.5自启净化器
电子技术• Electronic Technology78 •电子技术与软件工程 Electronic Technology & Software Engineering【关键词】PM2.5 自启动 GP2Y1010AU0F 定时1 引言随着社会的发展,生活越来越好,但是由于社会的快速发展,空气污染日益加重。
室内也存在PM2.5高或灰尘大的情况,那么PM2.5自启净化器主要是通过灰尘传感器对室内PM2.5的检测,并显示PM2.5污染程度,再由单片机控制自动开启净化装置,对PM2.5进行过滤,降低室内PM2.5的浓度。
与以往普通的净化装置不同的是,PM2.5检测净化器具有定时功能,可以设置定时开启与关闭,给生活提供更大的便捷。
2 工作原理本设计主要是通过GP2Y1010AU0F 灰尘传感器来检测到室内的PM2.5,并且通过灰尘传感器把检测结果传送到单片机,经过判断后在LCD1602显示出来,最小系统根据判断结果来控制继电器的启动与关闭,同时可以设置定时开启与关闭的功能,也可以设置自动功能,在PM2.5的浓度降低并且2分钟内不反弹则会自动关闭。
3 结构功能设计本次设计的PM2.5自启净化器的功能主要有三个,第一:对空气中的PM2.5进行检测;第二:根据室内空气中PM2.5和灰尘污染程度进行判断,并自动启动净化装置;第三:进行定时启动和关闭功能,使人们在离开后忘记关闭而达到节约能源的目的。
PM2.5自启净化器的主要结构如图1所示。
3.1 PM2.5检测模块PM2.5检测功能的实现,主要是通过PM2.5自启净化器文/雷晓艳 孙玉轩 陈维宇 张娇娇本文设计的PM2.5自启净化器通过GP2Y1010AU0F 灰尘传感器检测到PM2.5的浓度,最小系统根据判断结果来控制继电器作为自启动的开关。
DS1302定时,可以避免人们离开后忘记关闭,可以在人们进入室内之前定时开启,提前净化空气。
摘 要GP2Y1010AU0F 灰尘传感器模块来检测到空气中出现的粉尘出现在检测范围内时(检测范围0-1000ug/m 3),由于这些粉尘而散射的光射入光接收元件作为电压输出。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
使用夏普GP2Y1010AU0F灰尘传感器检测空气质量
夏普灰尘传感器价格较便宜,能检测出室内空气中的灰尘和烟尘含量.
检测原理
其原理如下图,传感器中心有个洞可以让空气自由流过,定向发射LED光,通过检测经过空气中灰尘折射过后的光线来判断灰尘的含量。
电路图
因为数据是通过pin 5的电压模拟信号输出的,而树莓派的引脚不支持模拟信号直接读取(需要增加数模转换芯片),所以先用Arduino来实验。
Arduino 代码
根据电路图,把Arduino和传感器连接起来:
1.Sharp pin 1 (V-LED) => 5V 串联1个150欧姆的电阻(最好在电阻一侧和GND之间再串联一个
220uf的电容)
2.Sharp pin 2 (LED-GND) => GND
3.Sharp pin 3 (LED) => Arduino PIN 2 (开关LED)
4.Sharp pin 4 (S-GND) => GND
5.Sharp pin 5 (Vo) => Arduino A0 pin (空气质量数据通过电压模拟信号输出)
6.Sharp pin 6 (Vcc) => 5V
1./*
2.Interface to Sharp GP2Y1010AU0F Particle Sensor
3.Program by Christopher Nafis
4.Written April 2012
5.
6./pic//datasheets/Sensors/gp2y1010au_e.pdf
7./pic//?p=479
8.
9.Sharp pin 1 (V-LED) => 5V (connected to 150ohm resister)
10.Sharp pin 2 (LED-GND) => Arduino GND pin
11.Sharp pin 3 (LED) => Arduino pin 2
12.Sharp pin 4 (S-GND) => Arduino GND pin
13.Sharp pin 5 (Vo) => Arduino A0 pin
14.Sharp pin 6 (Vcc) => 5V
15.*/
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 LED
47. delayMicroseconds(delayTime);
48. dustVal=analogRead(dustPin);// read the dust value
49. ppm=ppm+dustVal;
50. delayMicroseconds(delayTime2);
51. digitalWrite(ledPower,HIGH);// turn the LED off
52. 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连接好后,可以连续打印出传感器的输出电压值。
输出电压大小和灰尘含量的曲线入下图:
通过电压的波形还可以判断是烟还是尘呢…。