基于CAN的粮仓温湿度监控系统的设计72673.docx
《基于CAN的粮仓温湿度监控系统的设计72673.docx》由会员分享,可在线阅读,更多相关《基于CAN的粮仓温湿度监控系统的设计72673.docx(94页珍藏版)》请在冰点文库上搜索。
![基于CAN的粮仓温湿度监控系统的设计72673.docx](https://file1.bingdoc.com/fileroot1/2023-6/19/57cc3039-8139-4dbc-afe6-48f83f911ed0/57cc3039-8139-4dbc-afe6-48f83f911ed01.gif)
基于CAN的粮仓温湿度监控系统的设计72673
毕业论文(设计)
基于单片机的粮仓温湿度监控系统的设计
系别自动化工程系
专业名称自动化班级学号5060509学生姓名卫一恒
指导教师刘云静老师
2010年06月16日
东北大学秦皇岛分校毕业设计(论文)第I页
基于单片机的粮仓温湿度监控系统的设计
摘要
在粮食的储藏的过程中,由于粮仓温湿度异常而造成粮食变质,带来的经济损失是惊人的。
目前我国许多粮食仓储单位采用测温仪器与人工抄录、管理相结合的传统方法,消耗了大量的人力和财力,并且效果不佳,发霉变质等现象大量存在。
因此设计智能粮仓温湿度监控系统,提高了工作效率,实现粮仓温湿度的实时监控,是仓储单位亟待解决的重要问题。
在实际的生产过程中,温湿度监控问题是一个很复杂的问题。
本文通过全面分析温湿度监控问题的特点以及国内外研究发展状况,提出了一种温湿度监控系统的设计方法。
该系统采用单片机自动检测粮仓温湿度信息,并通过CAN总线与上位机进行通信,来解决粮仓内温度和湿度的实时检测和可靠控制的问题。
进而根据问题的特殊性,在检测、存储和控制实现上,都做了改进,使问题可以在一个可行的时间范围内得到解决。
在仿真和模拟试验中,验证了该系统的可行性,分析了该系统在解决实际问题时的不足,并提出了改进的办法。
每个粮仓设有一个智能节点,该节点以STC89C52单片机为核心,主要完成粮仓内温湿度的采集,处理,显示并做出判断实现超限报警和无差控制,还通过CAN总线传至上位机有关信息。
上位机通过接收智能节点传来的信息,了解各粮仓温湿度情况,并且能根据各智能节点地址,设定任何一个粮仓温湿度的报警阈值,从而解决了多个粮仓的温湿度监控问题。
最后,对论文工作进行了总结,并说明了进一步开发和研究的方向。
关键词:
粮仓,温湿度控制,CAN总线
TheDesignofBarn‟sTemperatureandHumidityMonitor
SystembasedonSCM
Author:
WeiYiHeng
Tutor:
LiuYunJing
Abstract
Intheprocessofgrainstorage,graindeterioratesduetotheabnormalofthebarn‟stemperatureandhumidity,andtheeconomiclosseswhichbroughtaboutareamazing.Atpresentmanygrainstorageunitsinourcountryusethetraditionalmethodswhichiscombinedofthermometerdevice,artificialtranscriptionandartificialmanagement,consumingalotofmanpowerandfinancialresources,andtheresultsarepoor,thephenomenaofmildewingandmetamorphismexistsinlargequantities.Therefore,designingthetemperatureandhumiditymonitorsystemonbarn,improvingefficiencyandachievingreal-timemonitoringofbarn‟stemperatureandhumidity,isanimportantproblemdemandingpromptsolutionbystorageunits.
Intheactualproductionprocess,themonitoringoftemperatureandhumidity‟sisaverycomplexissue.Inthispaper,amethodofdesigningthebarn‟stemperatureandhumiditymonitorsystemafterfullyanalysisthecharacteristicsoftemperatureandhumiditymonitorissuesanddomesticandtheresearchanddevelopmentstatusbothathomeandabroad.Thesystemusesmicrocomputertodetectthetemperatureandhumidityinformationautomatic,communicatewiththehostcomputerbytheCANbusandsolvetheproblemoftemperatureandhumidity‟sreal-timedetectionandreliablecontrolinthebarn.Thenaccordingtothespecificityofproblem,animprovementismadeondetection,storageandcontrol‟srealizing,whichsolvestheproblemreasonablyinrelativelyshorttime.Inthesimulation,thefeasibilityofthesystemisverified,theshortageofthissystemwhenprocessingactualproblemisalsoanalyzedandthenewimprovementisraised.
Eachbarnhasanintelligentnode,whichisbasedonSTC89C52microcontrollermainlycompletethecollectionandprocessingoftemperatureandhumidityinsidethebarn,and
displayandmakejudgmentsontheover-limitalarmandNodifferencecontrol.ItalsodelivertherelevantinformationtoPCbytheCANbus.Hostcomputerfindouteachbarn‟stemperaturesandhumiditythroughtheinformationcomingfromintelligentnodes,andsettemperatureandhumidityalarmthresholdineverybanbasedduetoeveryintelligentnode‟saddress,andthereforetheproblemonMultiplebarn‟stemperatureandhumiditymonitorhasbeensolved.
Intheend,theworkinthispaperissummarizedandthefurtherstepofthisresearchisclarified.
KeyWords:
barn,temperatureandhumiditycontrol,CAN-bus
1绪论............................................................................................................................1
1.1背景.......................................................................................................................1
1.2国内外研究现状与发展趋势...............................................................................3
1.3设计的目的及意义...............................................................................................4
1.4设计的主要工作...................................................................................................5
1.5本文的研究内容...................................................................................................5
2方案选择与总体设计................................................................................................6
2.1温湿度的相关概念...............................................................................................6
2.2温湿度的测量方法...............................................................................................8
2.3温湿度传感器的选取...........................................................................................9
2.4系统总体设计.....................................................................................................10
3系统硬件设计..........................................................................................................15
3.1STC89C52简介..................................................................................................15
3.2数据采集电路.....................................................................................................16
3.2.1DHT21性能说明.........................................................................................17
3.2.2DHT21引脚介绍.........................................................................................18
3.2.3DHT21数据格式.........................................................................................18
3.2.4DHT21时序.................................................................................................18
3.3键盘输入电路.....................................................................................................20
3.4LCD显示电路....................................................................................................21
3.4.1电路概述......................................................................................................21
3.4.2LCD1602引脚.............................................................................................21
3.4.3LCD1602控制器.........................................................................................21
3.4.4LCD1602基本操作.....................................................................................22
3.5实时时钟电路.....................................................................................................23
3.5.1电路及芯片概述..........................................................................................23
3.5.2DS1302引脚................................................................................................23
3.5.3DS1302寄存器............................................................................................24
3.5.4DS1302控制字............................................................................................24
3.5.5DS1302时序................................................................................................25
3.6掉电保护电路.....................................................................................................26
3.7CAN总线通信....................................................................................................28
3.7.1CAN总线概述.............................................................................................28
3.7.2CAN控制器MCP2515...............................................................................29
3.7.3CAN收发器TJA1050.................................................................................31
3.7.4光电隔离器6N137......................................................................................32
3.7.5上位机与CAN的连接................................................................................33
3.7.6下位机与CAN的连接................................................................................34
3.8输出控制电路.....................................................................................................35
3.9声光报警电路.....................................................................................................35
3.10系统电源电路...................................................................................................36
4系统软件设计..........................................................................................................37
4.1温湿度设置.........................................................................................................37
4.2数据的采集与处理.............................................................................................37
4.3PWM控制算法..................................................................................................38
4.4系统通信程序.....................................................................................................39
4.5人机界面设计.....................................................................................................40
4.5.1主要内容概述..............................................................................................40
4.5.2系统首页......................................................................................................42
4.5.3MDI窗体首页.............................................................................................42
4.5.4实时数据窗口..............................................................................................43
4.5.5历史数据查询窗口......................................................................................43
4.5.6标值设定窗口..............................................................................................44
4.5.7系统数据库..................................................................................................44
5系统的抗干扰问题..................................................................................................45
5.1干扰因素.............................................................................................................45
5.2硬件抗干扰措施.................................................................................................45
5.2.1合理选择元器件..............