设计简介:
项目名:温度控制
项目编号:mcuclub-dz-245
单片机类型:STC89C52
具体功能:
1、通过DS18B20测量温度值,当温度低于设置最小值,风扇停止,当温度在最小值和最大值之间,风扇低速转动,当温度大于设置最大值,风扇高速转动
2、通过超声波传感器监测距离,当切换到儿童模式时(红色LED灯亮),监测距离小于设置最小值,自动关闭风扇
3、通过按键设置各阈值、切换模式
4、通过4位数码管显示温度、挡位
总字数:14441
基于STC89C52的温度控制系统的设计
摘要 温度作为重要的物理量,与人们的生活密切相关。传统的温度控制系统存在反应慢、误差大、运行不稳定、控制精度不高等问题。为了解决相关问题,基于传感器和单片机的智能温度控制系统的开发迫在眉睫。
本文基于单片机技术,设计一款智能温度控制系统,该控制系统采用STC89C52单片机为主控芯片,采用DS18B20传感器对温度值进行测量,采用超声波传感器对实时距离值进行测量,采用按键进行阈值设置和模式切换,采用4位数码管显示温度和挡位。通过各模块相互配合,共同完成系统的设计和制作。
通过多次测试,本设计的系统能够长期稳定运行,并提供稳定可靠的数据,其操作界面简单明了,传感器种类丰富,网络兼容性强,开发成本低,可单独作为温度监测系统使用,也可与其他智能家居配套使用,具有较强的实用价值。
关键词 STC89C52单片机;温度采集;风扇;超声波;测控
Design of temperature control system based on STC89C52
Abstract As an important physical quantity, temperature is closely related to people’s life. The traditional temperature control system has some problems such as slow response, large error, unstable operation and low control accuracy. In order to solve the related problems, the development of intelligent temperature control system based on sensor and single chip microcomputer is urgent.
Based on single-chip microcomputer technology, this paper designs an intelligent temperature control system. The control system adopts STC89C52 single-chip microcomputer as the main control chip, DS18B20 sensor to measure the temperature value, ultrasonic sensor to measure the real-time distance value, key to set the threshold and switch the mode, and 4-digit digital tube to display the temperature and gear. Through the cooperation of each module, the design and production of the system are completed together.
Through many tests, the designed system can run stably for a long time, and provide stable and reliable data. Its operation interface is simple and clear, the sensor types are rich, the network compatibility is strong, the development cost is low, can be used as a temperature monitoring system alone, can also be used with other smart homes, and has strong practical value.
Key words STC89C52 MCU; Temperature acquisition; A fan; Ultrasonic wave; Measure and control
目 录
1绪论 1
1.1 选题背景及实际意义 1
1.2 国内外研究现状 1
1.3 本论文研究目标与框架 1
2系统设计方案 3
2.1 整体设计方案 3
2.2 主要元器件选择 3
2.2.1 主控芯片选择 3
2.2.2 显示方案选择 4
2.2.3 测温方案选择 4
3硬件设计 5
3.1 单片机最小系统 5
3.2 DS18B20温度检测模块电路 6
3.3 HC-SR04超声波避障模块电路 7
3.4 按键电路 9
3.5 直流电机驱动模块 10
3.6 LED灯模块电路 10
3.7 数码管模块电路 11
3.7.1 数码管的结构 11
3.7.2 数码管的显示方法: 11
4 软件设计 14
4.1 编程软件介绍 14
4.2 系统主流程设计 14
4.3 独立按键 15
4.4 温度检测模块子流程 16
4.5 直流电机-MX1508驱动模块子流程 17
4.6 数码管软件设计流程 18
4.7 超声波检测模块子流程 19
5仿真测试 1
5.1 总体仿真测试 1
5.2 仿真运行测试 1
5.3 参数设置仿真测试 3
6 实物测试 1
6.1 系统硬件调试 1
6.2 实物运行测试 1
6.3 参数设置实物测试 3
总 结 6
参考文献 7
致 谢 9
附录 10
附录1:原理图 10
附录3:PCB 11
附录3:主程序 12