第五章 系统调试
住芯片,即可发现LED显示的前两位温度也迅速升高,验证了DS18B20能在系统板上工作。由于DS18B20为3个引脚,因此在调试过程中因注意各个引脚的对应位置,以免其接反而使芯片不能正常工作甚至烧毁芯片。
5.2.3 电动机调速电路部分调试
系统本部分的设计中重在软件设计,因为外围的驱动电路只是将送来的PWM信号放大从而驱动电机转动。系统软件设置在P3.1口输出是电机转动的PWM占空比,当环境温度高于设置温度时,电机开始转动,若此时用高于环境温度的热源靠近芯片DS18B20时,发现电机的转速在升高,并越来越快,当达到一定值时,发现电机的转速不再升高;将热源远离芯片DS18B20时,发现电机的转速开始下降,转速达到一定值时,若将环境温度升高到环境温度以上,发现电机又停止了转动。系统采用的直流电机为12V的额定电压,而驱动电路在采用单片机电源时的输出电压最高不过5V,因此在调试过程中只采用了5V的直流电机来调试,且得到了可观的控制效果。
5.3 系统功能
5.3.1 系统实现的功能
本系统能够实现单片机系统检测环境温度的变化,然后根据环境温度变化来控制风扇直流电机输入占空比的变化,从而产生不同的转动速度,也可根据按键调节不同设置温度,再由环境温度与设置温度的差值来控制电机。当环境温度低于设置温度时,电机停止转动;当环境温度高于设置温度时,单片机对应输出口输出不同占空比的PWM信号,控制电机开始转动,并随着环境温度与设置温度的差值的增加电机的转速逐渐升高。系统还能动态的显示当前温度与设置温度,并能通过按键调节当前的设置温度。
5.3.2 系统功能分析
系统总体上由五部分组成,即按键与复位电路、数码管显示电路、温度检测电路、电机驱动电路。首先考虑的是温度检测电路,该部分是整个系统的首要部
28
琼州学院本科毕业论文 (设计)
分,首先要检测到环境温度,才能用单片机来判断温度的高低,然后通过单片机控制直流风扇电机的转速;其次是电机驱动电路,该部分需要使用外围电路将单片输出的PWM信号转化为平均电压输出,根据不同的PWM波形得到不同的平均电压,从而控制电机的转速。电路的设计中采用了达林顿反向驱动器ULN2803,实现较好的控制效果;再次是数码管的动态显示电路,该部分的功能实现对环境温度和设置温度的显示,其中DS18B20采集环境温度,按键实现不同设置温度的调整,实现了对环境温度和设置温度的及时连续显示。
29
第六章 结束语
第六章 结束语
本次设计的系统从硬件设计和软件编写到Proteus仿真,再到用单片机开发板的调试,直到最后的电路板焊接,每一个过程都使用到大学里学到的知识,整个过程把大学里的知识系统的串在了一起。本系统以单片机为控制核心,以温度传感器DS18B20检测环境温度,实现了根据环境温度变化调节不同的风扇电机转速,在一定范围内能实现转速的连续调节,LED数码管能连续稳定的显示环境温度与设置温度,并能通过两个独立的按键调节不同的设置温度,从而改变环境温度与设置温度的差值,进而改变电机转速。实现了基于单片机的温控风扇的设计。
本系统的设计可推广到各种电动机的控制系统中,实现电动机的转速调节。在生产生活中,本系统可用于简单的日常风扇的智能控制,为生活带来便利;在工业生产中,可以改变不同的输入信号,实现对不同信号输入控制电机的转速,进而实现生产自动化,如在电力系统中可以根据不同的负荷达到不同的电压信号,再由电压信号调节不同的发动机转速,进而调节发电量,实现电力自动化调节。综上所述,本系统的设计在我们的日常生产和生活中将有着重要的意义。
30
琼州学院本科毕业论文 (设计)
参考文献
[1] 林立,张俊亮,曹旭东,刘德军.单片机原理及应用[M].电子工业出版社,2009. [2] 徐瑞华.单片机原理与接口技术[M].2008.
[3] 李学龙.使用单片机控制的智能遥控风扇[J].电子电路制作,2003,9:13-15. [4] 郭天祥.新概念51单片机C语言教程[M].电子工业出版社,2009. [5] 胡全.51单片机的数码管动态显示技术[J].信息技术,2009,13:25-26. [6] 王会明.智能电风扇控制器的研制[J].电子与自动化,1998,5(4):25-26. [7] 孙号.Proteus软件在设计电子电路中的应用[J].仪表技术,2009,8:74-75. [8] 李刚.总线数字温度传感器DS18B20原理及应用[J],现代电子技术, 2005,
28(21):77-99.
[9] Ylai,Y,Wang.Three dimensional nonlinear analysis for temperature characterist of ventilated embankment in permafrost regions[J].Gold Regions Science and Technology,2004,38(2):165-184.
[10] Cheng Guodong.Linearity engineering in permafrost areas[J].Journal of Glac- iology and Geocryology(in Chinese),2001,23(3):213-17.
31
琼州学院本科毕业论文 (设计)
附 录
Introduction and application of Protues software
Single chip microcomputer in many of the products are widely used, whether 51series, AVR, or PIC series, they each have their own characteristics, the learner is also increasing year by year, but in the study of the development process, we often do after the plan test expenditure is usually very big, especially for some students or for beginners to this they may become a barrier to learning. We use Proteus software since greatly saves the time and cost of development. In particular, this software will be used in the development of SCM is a good choice. Here we mainly talk about the Proteus software and Keil software integration and application.
Proteus is currently the best single-chip peripheral device simulation tool, it can simulate 51series, AVR, PIC and other commonly used MCU and peripheral circuits ( such as LCD, RAM, ROM, keyboard, motor, LED, AD / DA, part of SPI device, part of the IIC device ... ). This article is based on ProteusPRO6.7SP3 and KEIL uVision3 software. Of course, software simulation precision is limited, and may not all devices are found and corresponding simulation model, with a development board and the emulator is certainly the best choice, but for single-chip lovers, or simple development should be a good choice. Proteus and other single-chip simulation software is different, it not only can the simulation chip CPU work, also can the simulation chip peripheral circuit or chip in other working conditions of the circuit. The simulation and debugging, concern is not certain when the statement is executed chip registers and memory contents are changed, but from the point of view of project program and circuit directly to see the work process and the results. For this experiment, tell from some kind of meaning, is made up of experiment and engineering application of the contradiction and phenomenon.
Run the Proteus ISIS program, enter the software main interface. Before work, to set up under the View menu to capture the alignment and system under the graphical
32