I
大型粮库的温湿度检测及控制系统设计
摘要
粮仓管理中最重要的问题是监测粮堆中的温、湿度变化。国家为粮食储藏每年支付
很高的费用,主要是因为监测设备成本较高,管理方式不够先进。目前,粮库中的温湿度
检测,基本上是人工检测,劳动强度大,繁琐,由于检测报警不及时,造成库储粮食损失
的现象时有发生,因此设计并研制性能价格比较高的粮库温湿度自动检测系统迫在眉睫。
由于大型粮库分布广、储量大,粮库的管理和监测难度大,由每个粮仓中配置的传感器
将粮情数据发送给单片机,单片机将传感器的数据以数字的形式表示出来,清晰直观地
显示出仓内温湿度状况,实现粮仓管理自动化、智能化,同时也节省了大量人力和物力,
减轻了粮仓管理的工作强度,提高了粮库管理效率,使粮食管理得到了安全可靠的保障。
本设计为基于单片机的温湿度检测与控制系统,采用模块化、层次化设计。用新型的
智能温温度传感器 SHT10 主要实现对温度、湿度的检测,将温度湿度信号通过传感器进行
信号的采集并转换成数字信号,再运用单片机 AT89S52 进行数据的分析和处理,为显示和
报警电路提供信号,实现对温湿度的控制报警。报警系统根据设定报警的上下限值实现报
警功能,显示部分采用字符型 TC1602 液晶显示所测温湿度值。系统电路简单、集成度高、
工作稳定、调试方便、检测精度高,具有一定的实用价值。
关键词:温湿度;SHT10;单片机;AT89S52;检测;报警
II
DETECTION AND CONTROL SYSTEM
DESIGN OF LARGE GRAIN STORAGE
TEMPERATURE AND HUMIDITY
Abstract
Granary management in the most important issue is monitoring the temperature and
humidity changes in the grain heap. Countries to pay high fees each year for grain storage,
mainly because of the higher cost of monitoring equipment, management is not advanced
enough. Grain storage in temperature and humidity testing is basically a manual inspection,
labor-intensive, cumbersome and not timely detection and alarm, causing the food phenomenon
of the loss of library storage, so the design and development of the higher cost performance
granary temperature and humidity automatically detects the system is imminent. Because of the
large grain storage is widely distributed, large reserves of grain storage management and
monitoring is difficult, based on the design of grain storage grain situation detection system on
the computer management software, the configuration of the sensor from each granary Grain
data sent to the microcontroller, microcontroller to the sensor data in digital form, clear and
intuitive display cabin temperature and humidity conditions to achieve the granary management
automation, intelligent, but also save a lot of manpower and material resources, reduce the
intensity of the work of the granary management, improved the efficiency of grain storage
management, food management has been a safe and reliable protection.
The design for the microcontroller-based temperature and humidity detection and control
system, a modular, hierarchical design. New intelligent temperature and temperature sensor
SHT10 detection of temperature, humidity, temperature and humidity signal through the sensor
signal acquisition and converted into digital signals, and then use the MCU AT89S52 data
analysis and processing, display and alarm circuit signal, the control of temperature and humidity
alarm. The upper and lower limits set alarm, the alarm system alarm function, the display part of
the character TC1602 LCD temperature measurement of humidity values. System circuit is
simple, highly integrated, stable and convenient debugging, detection accuracy is high, has a
III
certain practical value.
Key words: temperature and humidity; SHT10; microcontroller; AT89S52 is;
detection; alarm
目录
摘要..................................................................................................................................................I
Abstract ...........................................................................................................................................II
1 绪论 .............................................................................................................................................1
1.1 选题背景 ..................................................................................................................................1
1.2 选题的现实意义 ......................................................................................................................1
1.3 设计内容 ..................................................................................................................................2
2 方案选择 .....................................................................................................................................3
3 系统的硬件设计 .........................................................................................................................4
3.1 系统的总体设计 ......................................................................................................................4
3.2 单片机选择与介绍 ..................................................................................................................4
3.3 温湿度传感器 ..........................................................................................................................7
3.3.1 接口定义 ...............................................................................................................................8
3.3.2 电路特性 ...............................................................................................................................9
3.3.3 传感器特点 .........................................................................................................................10
3.3.4 技术参数 .............................................................................................................................10
3.4 显示模块 ................................................................................................................................11
3.4.1 LCD1602 概述 .....................................................................................................................11
3.4.2 LCD1602 基本参数及引脚功能 .........................................................................................12
3.5 报警电路 ................................................................................................................................15
3.6 键盘设定模块 ........................................................................................................................16
3.7 稳压电路 ................................................................................................................................16
3.8 加热/加湿/通风/降温开关电路设计.....................................................................................17
4 软件设计 ...................................................................................................................................19
4.1 主程序模块 ............................................................................................................................19
4.2 SHT10 初始化流程.................................................................................................................20
4.3 LCD 初始模块 ........................................................................................................................21
5 Keil C 软件概述........................................................................................................................22
结论 ...............................................................................................................................................24
参考文献 .......................................................................................................................................25
附录 A 电路图 .............................................................................................................................26
附录 B 程序..................................................................................................................................28
致谢 ...............................................................................................................................................37
1
1 绪论
1.1 选题背景
随着时代的进步和发展,单片机控制无疑是人们追求的目标之一。单片机技术已经普
及到我们生活,工作,科研,各个领域,已经成为一种比较成熟的技术。温室、粮库等恒
温场所对于自动化的要求也越来越高,对室内温湿度的测量和设备的控制操作要用自动控
制系统来完成。我国是一个人口众多的大国, 科学储粮是保障人民粮食供应, 促进社会安
定的大事, 粮仓温度的监测在科学储粮中占有重要地位
[1]
。在大多数粮食存储企业, 目前仍
主要靠人工检测粮仓温度。由于粮库占地面积大,粮仓分散,仓内温度测试点多,因而人
工监测工作量大,效率低,检测周期长,容易漏检,而且测量器件损坏率高,测试精度难
以保证
[2]
。
控温储粮是使粮食在储藏期间保持一定的温度水平,达到安全储藏的目的。控温储粮
能保持粮食较好的品质,是目前比较先进的一种安全、经济、绿色的储粮技术,已成为当
今科学储粮技术发展的新方向。低温储藏使粮食品质提高,温度对微生物的生长、繁殖也
有影响,大多数菌种生长繁殖的适宜温度范围是 28℃-30℃,温度低于 15℃这些菌种的活
动的繁殖就会受到抑制,低于 12℃时害虫一般不能繁殖
[3]
。
当粮库温度在 20℃-35℃、相对湿度≥85%时,粮食就易发生霉变。当温度较高,空气
中相对湿度较低时,霉菌也能依附在物体表面繁殖生长。分析表明,我国江南 5~9 月有
利于发生霉变的频率为 34%,即夏季约有三分之一的时间,其温、湿度及空气中水汽含量
搭配得当,易导致库房内大部分仓储物品霉变,尤其在 7、8 俩月,温湿度条件有利于物
品发生霉变的频率达 60%以上,而在其它时段均在 20%以下。储粮害虫一般最适湿度在
70%-75%,如果粮堆内的空气相对湿度保持在 65%以内,保持与其平衡的水分,就可以抑
制粮食上几乎全部微生物的活动
[4]
。从储粮管理来说,湿度抑制微生物的生长比温度更有
意义。
1.2 选题的现实意义
2002 年 Sensiron 公司在世界上率先研制成功 SHT10 型智能化温度/温度传感器,体积
与火柴头相近。它们不仅能准确测量相对温度,还能测量温度和露点。测量相对温度的范
围是 0~100%,分辨力达 0.03%RH,最高精度为±2%RH。测量温度的范围是-40℃~
+123.8℃,分辨力为 0.01℃。测量露点的精度<±1℃。在测量湿度、温度时 A/D 转换器的
位数分别可达 12 位、14 位。利用降低分辨力的方法可以提高测量速率,减小芯片的功耗。
SHT11/15 的产品互换性好,响应速度快,抗干扰能力强,不需要外部组件,适配各种单片
机,可广泛用于医疗设备及温度、湿度调节系统中。
现在虽然单片机的品种繁多,各具特色,但仍以 MCS-51 为核心的单片机占主流,兼