基于单片机的教室灯光自动控制系统的研究 下载本文

西南科技大学高等教育自学考试论文

基于单片机控制的教室灯光自动控制器

的研究

摘要

本研究针对教室灯光的控制方法,尤其是教室灯光的智能控制方面的发展现状,分析了教室灯光智能控制的原理和实现方法,提出了基于单片机的教室灯光智能控制 系统的设计思路,并在此基础上开发了智能控制系统的硬件装置和相应软件。

该系统以AT89C2051单片机作为控制装置的智能部件,采用热释红外人体传感器检测人体的存在,采用TLC549构成的电路检测环境光的强度;根据教室合理开灯的条件,系统通过对人体的存在信号和环境光信号的识别和智能判断,完成对教室照明回路的智能控制,避免了教室用电的大量浪费。系统还具有多种报警功能;同时还采用了软/硬件的“看门狗”技术等抗干扰措旅。单片机软件采用汇编语言编制,采用模块化结构设计、条理清晰、通用性好,便于改进和扩充。该系统具有体积小,控制方便,可靠性高,专用性强,性价比合理等优点,可以满足各类大、中专院校教室灯光控制的要求,很大程度的达到节能目的。

关键词 红外传感器;单片机; 热释电

I

西南科技大学高等教育自学考试论文

Based on single-chip microcomputer control classroom light automatic

controller

ABSTRACT

Based on the method of controlling the lamplight, especially in the light of the status quo of the development of intelligent control are analyzed, the lamplight of intelligent control principle and realization method, is proposed based on single-chip classroom light intelligent control system design, and on the basis of the intelligent control system is developed and the corresponding software, hardware device. This system to control device of AT89C2051 single chip microcomputer as intelligent parts, using thermal infrared detection sensor measuring interpretation of human body, using light activated triode circuit testing environment of light intensity, According to the condition of lights, rational system of human existence by ambient light signals and the recognition and intelligent signal to the classroom, lighting circuit intelligent control, avoid the waste of a classroom. System also has many alarm functions, Also in soft/hardware in the watch-dog technique etc. Single-chip microcomputer software anti-interference measures adopted assembly language, modular structure design, good clear, generality, and to improve and expand. This system has the advantages of small size, high reliability and easy control, the price is reasonable, strong specificity etc, can satisfy all kinds of big, secondary colleges classroom light control requirements, to a great degree of energy-saving objective.

Keywords infrared sensors ,SCM ,pyroelectric

II

西南科技大学高等教育自学考试论文

目 录

摘 要 ............................................................. I 目 录 ............................................................. 1 第1章 引言 ........................................................ 3

1.1 本课题研究的意义 ............................................ 3 1.2 国内外教室灯光控制器研究的现状及其存在的问题 ................ 3 1.3 本课题研究的内容和目标 ...................................... 4

1.3.1 研究内容 .............................................. 4 1.3.2 研究目标 .............................................. 4 1.4 本课题拟解决的关键问题 ..................................... 4 第2章 教室灯光控制器简介及控制方案的分析 .......................... 5

2.1 教室灯光控制器简介 .......................................... 5 2.2 系统控制方案的分析 .......................................... 5 第3章 系统控制模块的硬件设计 ...................................... 5

3.1 控制模块的硬件构成 .......................................... 6 3.2 控制系统的主要硬件电路 ...................................... 6

3.2.1 系统主控电路 .......................................... 6 3.2.2 在线编程模块电路 ...................................... 7 3.2.3 系统供电电路 .......................................... 8 3.2.4 数据采集电路 .......................................... 9 3.2.5 日光强度检测模块电路 ................................. 11 3.2.6 热释电红外人体检测模块电路 ........................... 11 3.2.7 系统时钟电路 ......................................... 15 3.2.8 系统看门狗电路 ....................................... 16 3.2.9 继电器驱动接口电路 ................................... 18 3.2.10 遥控键盘管理模块电路 ................................ 19 3.2.11 超时报警电路 ........................................ 21 3.2.12 系统供电电路 ........................................ 22

第4章 控制模块软件设计与开发 ..................................... 23

1

西南科技大学高等教育自学考试论文

4.1 系统监控主程序模块 ......................................... 23

4.1.1系统自检初始化 ........................................ 25 4.1.2定时中断处理 .......................................... 26 4.1.3 多任务操作系统的构建 ................................. 26 4.2 数据采集模块 ............................................... 26

4.2.1 存在传感器的优缺点 ................................... 27 4.2.2 数据采集软件设计的实现 ............................... 28 4.2.3 人体存在传感器的抗干扰措施 ........................... 28 4.2.4 人体存在传感器的安装要求 ............................. 28 4.3 时钟模块 ................................................... 28

4.3.1 数据输入输出 ......................................... 29 4.3.2 时钟内部寄存器的使用 ................................. 30 4.3.3 时钟自检初始化 ....................................... 31 4.3.4 时钟程序设计 ......................................... 33 4.4 显示驱动模块 ............................................... 33

4.4.1 ULN2803驱动器的应用 .................................. 33 4.4.2 显示程序设计 ......................................... 34

4.5 系统键功能 ................................................ 34

4.5.1 遥控键盘 ............................................. 36 4.5.2 键功能处理程序 ....................................... 36

第5章 系统调试运行及问题分析 ..................................... 37

5.1 单片机系统调试方法及步骤 ................................... 38 5.2 出现的主要问题及分析解决 ................................... 39 结论与建议 ........................................................ 39

结论 ........................................................... 39 建议 ........................................................... 39 致 谢 .......................................................... 39 参考文献 .......................................................... 40 附录一 ............................................................ 41 附录二 ............................................................ 44

2