1、单位代码 01 学 号 100102057 分 类 号 TP23 密 级 文 献 翻 译基于 C8051F350 的智能压力传感器的设计院 ( 系 ) 名 称 信 息 工 程 学 院专 业 名 称 电 子 信 息 工 程 学 生 姓 名指 导 教 师2014 年 3 月 30 日黄河科技学院毕业设计(文献翻译) 第 0 页一种室内浇花系统的设计Kai CHEN(陈凯) ,Hong JIN(金红)(山东省科学和技术大学,信息科学与工程学院,青岛环亚金属制品 266510,中国)摘 要本文以兰花为例,设计一种针对兰花的自动浇水系统。系统采用宏晶单片机公司的增强型单片机 STC12C5A60S2,外
2、接 M AX232 串口通信电路,DHT11 温湿度检测电路,12864 液晶显示电路,继电器控制电路,无线传输电路、存储电路、电机驱动电路和蜂鸣器电路等,实现了自动检测空气温湿度和土壤温湿度并自动浇水。关键词:自动浇花;温湿度检测;单片机;PWM黄河科技学院毕业设计(文献翻译) 第 1 页1 引言现代的生活中,人们都喜欢在办公室和家里养殖花卉,然而有许多花草对周围的环境要求比较高,需要人们的精心照顾。由于生活节奏的加快,很多人都忽略对花草的照顾,如果能找到一种在干燥时可以自动给花草浇水的装置,就可以解决这个问题。已有的浇水器是定时浇灌花草的,不能根据土壤的湿度和空气的温湿度及花草的生活习性来
3、进行浇水,是一种非智能的浇水系统,不利于花草的生长。当前,传感器技术与单片机技术发展迅速,其应用逐步由工业、军事等领域向其他领域渗透,与我们的日常生活联系越来越紧密。而且智能家居概念也越来越受到了人们的推崇,因此,电子智能型的自动浇花系统有着很好的发展和应用前景。2 系统构成硬件实现2.1 整体思想本系统由数据采集电路、MCU 中央处理器、水泵驱动控制电路和无线发射接收电路组成。该系统主要由发射模块和接受模块组成。发射模块包括:空气温湿度采集模块,土壤温湿度采集模块,MCU 处理模块,按键控制模块, MOS 管驱动电路,继电器控制电路,无线发射模块。接收模块包括:无线接收模块,MCU 处理模块
4、,LCD 显示模块,报警电路,MAX232 电平转换电路。2.2 单片机的功能单片机是自动浇花系统核心部件,一方面它要接收来自土壤湿度经过 AD 转换的数字信号和温度传感器的输出信号,另一方面要对这两个信号预设值的上下限的值进行对比,可控制外围电路的相应工作,同时检测查询是否有按键按下,并把这些信息通过无线模块发送出去。负责接收的模块中的单片机接收到这些信息后通过无线模块显示在液晶屏上。因为考虑到检测土壤湿度时用到了 AD 和 PW M 功能,所以考虑到用宏晶公司的 STC12C5A60S2 代替传统的 STC89C51。STC12C5A60S2 单片机是 STC 公司生产的八位 8051 内
5、核单片机。黄河科技学院毕业设计(文献翻译) 第 2 页2.3 空气温湿度采集模块的硬件设计DHT11 数字温湿度传感器是采用单总线的集成测温湿度器件,传感器里有一个电阻式测湿组件和一个 NTC 测温组件,测量温度的范围是 050,测量湿度的范围是 20% 90,可以满足本次设计的要求。与单片机连接原理如图 2.1 所示。图 2.1DHT11 电路路图2.4 土壤温湿度采集模块的硬件设计土壤本身可以看成是一种湿度传感器,土壤越潮湿,导电能力越强,阻值越小,所以现在对土壤湿度的测量间接转换成了对电阻的测量。将待测电阻与一恒流二极管串联,如图 2.2,将测量值接入 AD,STC12C5A60S2 里
6、面集成有 8 路的 AD,RX 的值为 RX=V(out)/IH。黄河科技学院毕业设计(文献翻译) 第 3 页图 2.2 测土壤温湿度的电路图2.5 水泵驱动电路及 PWM 控制IRF3205 具有耐压值高、电流大、导通电阻小的特点,利用 IRF3205 来驱动水泵,通过 PW M 控制,当场效应管导通,电机转,水泵开始抽水。STC12C5A60S2 有 2路 PW M 可使用。本设计使用的一路 PW M,接在 P1.3,STC12C5A60S2 集成了两路可编程计数器阵列(PCA )模块,PCA 里面的 16 位定时器(第八位 CL 和高八位 CH)CH ,CL 每隔一段时间加 ,当 CL
7、小于EPCnL,CCAPnL 时,输出为低,反之则为高。当 CL 的值由 00 到 FF 时,CL 发生溢出为 0, EPCnL ,CCAPnL里的值自动加载到EPCnL,CCAPnL ,从而实现了无干扰跟新 PWM。3 软件设计软件设计主要实现:采集相关的信息后送给单片机,单片机对信息进行处理,产生相应的控制,并将这些信息通过发射模块发射出去,接收端通过液晶显示。系统发射部图 3.1 发射部分流程图黄河科技学院毕业设计(文献翻译) 第 4 页分的主要流程为:系统初始化(包括单片机、温湿度传感器和无线模块的初始化) 。初始化后,开始对系统进行设定,设置其温湿度上下限。如图 3.1 所示。设置完
8、毕后,采集空气中的温湿度及土壤的湿度,如果土壤的湿度低于设置的下限值就控制 PWM 输出给花浇水,如果空气中的温度持续高于设置的上限值,或者是空气中的湿度持续低于设定的下限值就闭合继电器,超声波增湿器持续喷雾 3S。无线模块负责将这些信息(温湿度、上下限值)发射出去。3.1 试验与测试本系统通过空气温湿度传感器采集空气中的温湿度,通过测土壤中电阻大小测量土壤的湿度。在土壤比较干燥时,就通过 PWM 控制给土壤浇水,不同的土壤湿度对应着不同 PWM 控制值。在空气持续干燥两小时时,控制超声波增湿器工作,在兰花上方喷雾 4 秒,给空气增湿。电路中加入了按键电路,用来改变温湿度的上下限的设置值,同时
9、加入了 24C02 的存储芯片,可以存储下这些设置值。因为有多个采集量,测试时使用控制变量法,首先调整湿度设置值,使得当时湿度值大于设置的湿度值,为方便调试,将程序中的持续 2 小时,先改成 2 分钟,设置的空气最高温度改为 25C,用电烙铁靠近温湿度传感器 DHT11,DHT11 的测得温度为 35C,高于设置的温度最高值,两分钟后听见继电器闭合的碰撞声,接着超声波增湿器开始工作,同时小电风扇也开始黄河科技学院毕业设计(文献翻译) 第 5 页图 3.2 实物测试图工作,将雾气扩散开,4S 继电器断开,与程序编写的期望现象一致。同理,测试出空气湿度检测及控制继电器部分也是正常工作的,实物测试图
10、如 3.2 所示。参考文献1高金展,2004 年“ 微弱信号检测”锁相放大器,P.154-196,相关指导,第 239 页 275.清华大学出版社,北京.2JR 曹刘,H.,2002 年重装修人工神经网络遍及感觉机械的设计,应用电解容量型压力.自动化系统集成仪器, (8):14-16.3Y.C.Sun,Y.L.Iu,Q.H.Memg,等,2000.提示自动海连欣电动势桥压力传感器零点输出信号电漂移特性.电子交易,11:39-42.4A.D.Whalen,1971.在纽约和伦敦:学术出版社的信号检测.5J.H.LIU.智能传感器结构等的“ 西安电子科技大学图书相关,第 206-209 页.6Y.
11、M.Gong,2006。智能压力传感器数据补偿处理和无线传输 .河北科技大学论文.72004 年 G.Peng W.J.Ni.C 语言函数混合编程的相对误差 .运河 Harbor.sup.11:128-130.8M.Zh.Zhou N.Chu,根据能量传播的 FELING 机数据融合网络的动态状态计算方式的一种控制,2007 年。中国期刊仪器科学,28(1):172-175.9A.D.Adrian K.Rainer,2002.一个简单的基于单片机的数字锁相放大器为低级别的光学信号的检测.第一届 IEEE 国际电子设计工作坊出发.测试和应用(DEL-TA02) ,基督城,Neweal.黄河科技学
12、院毕业设计(文献翻译) 第 6 页附:英文原文A kind of interior design of the water the flowersKai CHEN(陈凯),Hong JIN( 金红)(Guangxi guilin university of technology institute of information science and engineering, guilin in guangxi 541000)AbstractOrchid, for example, this paper designed an automatic watering system for orc
13、hids. System adopts macro chip microcontroller enhanced MCU STC12C5A60S2, external circuit, serial communication M AX232 DHT11 temperature and humidity detection circuit, 12864 liquid crystal display circuit, relay control circuit, wireless transmission circuit, storage circuit, motor drive circuit
14、and buzzer circuit, etc., has realized the automatic detection and soil temperature and humidity and air temperature and humidity automatic watering.Keywords: Temperature and humidity detection; Single chip microcomputer; PWM1 IntroductionIn modern life, people like to breed flowers in the office an
15、d home, but there are many flowers and plants on the surrounding environment demand is higher, need to carefully take care of people. Due to the accelerating rhythm of life, a lot of people ignore to take care of flowers and plants, if you can find a dry device can automatic watering flowers and pla
16、nts, can solve this problem. Existing water is regularly watered the flowers and plants, not according to the soil humidity and the temperature and humidity of the air and the life of flowers and plants for water, water is a kind of intelligent system, is not conducive to the growth of plants. Curre
17、ntly, sensor technology and single-chip microcomputer technology has 黄河科技学院毕业设计(文献翻译) 第 7 页developed rapidly, its application gradually penetration by the industrial, military and other fields to other areas, in touch with our daily life more and more tight .2 The system is hardware implementation2.
18、1The whole ideaThis system consists of data acquisition circuit, the MCU central processing unit (CPU), water pump of the drive control circuit and wireless transmitting receiving circuit. The system is mainly composed of emission module and receiving module. Acquisition module launch module include
19、s: air temperature and humidity, soil temperature and humidity acquisition module, MCU processing module, the key control module, MOS tube driving circuit, relay control circuit, wireless transmitting module. Receiving module includes: wireless receiving module, MCU processing module, LCD display mo
20、dule, alarm circuit, MAX232 level conversion circuit. The automatic watering system system block diagram as shown.2.2The function of the single chip microcomputerSingle-chip microcomputer automatic watering system is the core part, on the one hand, it will receive from soil moisture after AD transfo
21、rm of digital signal and the temperature sensor output signal, on the other hand to the default values of the two signal, comparing the value of the upper and lower control peripheral circuit of the corresponding work, while detecting the query whether there is a button press, and put these informat
22、ion through wireless module to send out. Responsible for receiving module of the single chip microcomputer to receive these information through wireless module display on the LCD screen. Because of considering the detection of soil moisture in the AD and PW M function, so considering the use macrocr
23、ystalline company to replace the conventional STC12C5A60S2 STC89C51. STC12C5A60S2 MCU on STC company is a production of eight kernel single-chip microcomputer 8051.黄河科技学院毕业设计(文献翻译) 第 8 页2.3Air temperature and humidity acquisition module of hardware designDHT11 digital temperature and humidity sensor
24、 is a single bus integrated temperature and humidity measuring devices, the sensor has a resistive humidity measurement component and a NTC temperature measurement component, the measuring temperature range is 0 to 50 , humidity measuring range is 20% 90%, and can meet the requirements of the design
25、. Connected to the single chip microcomputer principle as shown in figure 2.1:Figure 2.1 DHT11 circuit road map2.4 The hardware design of soil temperature and humidity acquisition moduleSoil itself can be seen as a humidity sensor, the moist soil, conductive ability stronger, the smaller the value,
26、so now the measurement of soil moisture indirectly transformed into for resistance measurements.黄河科技学院毕业设计(文献翻译) 第 9 页Figure 2.2 the circuit diagram of soil temperature and humidity measurementResistance under test with a constant current diode series, as shown in figure 1-3, to access the AD measur
27、ements, eight STC12C5A60S2 inside integrated AD, the value of RX is RX = V (out)/IH.2.5 Water pump drive circuit and PWM controlIRF3205 has the pressure value is high, the current characteristics of large and small conduction resistance using IRF3205 to drive the pumps, controlled by PW M, conductio
28、n effect tube on the spot, motor, pump start pumping. PW STC12C5A60S2 have 2 road M can be used. This design USES the PW M, all the way across the P1.3, STC12C5A60S2 integrates two lines of the programmable counter array (PCA) module, the inside of the PCA 16-bit timer (8 CL and high eight CH) CH, C
29、L every once in a while to add 1, when CL is less than EPCnL CCAPnL, the output is low, the opposite is high. When the value of CL from 00 to FF, CL overflow is 0, the value in the EPCnL CCAPnL automatically loaded into the EPCnL CCAPnL, so as to realize without interference with new PWM.3 The softw
30、are designSoftware design the main implementation: after collecting relevant information to MCU, MCU to deal with information, to produce the corresponding control, and the information through the launch module, the receiving end through the liquid crystal display (LCD). 黄河科技学院毕业设计(文献翻译) 第 10 页Emiss
31、ion part of the main process is: system initialization, including single chip microcomputer, temperature and humidity sensors and the wireless module initialization). After the initialization, began to set of system, set up the temperature and humidity on the floor.figure 2.3 Launch part flow chart
32、Set up after the acquisition of temperature and humidity and soil moisture in the air, if the lower limit of soil humidity is below the set will give the flowers some water control PWM output, if the upper limit of the air temperature is higher than the set, or the humidity in the air for below the
33、lower limit is set by closing relay, ultrasonic humidifier continues to spray 3 s. Wireless module is responsible for the information (temperature and humidity, upper and lower limit).3.1 The test and the testThis system is through the air temperature and humidity sensors to collect the temperature
34、and humidity in the air, through measuring the resistance size measurement of soil moisture in the soil. In dry soil, by PWM control to water and soil of different soil humidity corresponds to the different PWM control values. In continuous air dry for two 黄河科技学院毕业设计(文献翻译) 第 11 页hours, the control u
35、ltrasonic humidifier, spray 4 seconds over the orchid, to air humidification. Figure 3.1 physical testingAdded a key circuit, which is used to change the setting of temperature and humidity of the upper and lower value, at the same time joined the 24 our fleet of memory chips, can be stored under th
36、e set values. Because there are multiple collection capacity, the test using the control variable method, first adjust the humidity setting, make the humidity value is greater than the set value of humidity, in order to facilitate debugging, will the program last for 2 hours.From:A kind of interior design of the water the flowersIEEE Tram,2003,,4(2):263-272.