【编者按】网学网自动化PLC相关毕业设计频道为大家收集整理了“基于单片机的照明控制系统设计“提供大家参考,希望对大家有所帮助!
论文编号:ZD1114 论文字数:14613,页数:42
摘要
随着楼宇智能化的发展与成熟,节能成为一种趋势,照明控制系统的越来越普及。同时随着电子技术的飞速发展,微型计算机作为嵌入式控制系统的主体与核心,代替了传统控制系统的常规电子线路,基于单片机的控制系统已广泛应用于智能楼宇。
本文阐述了照明控制方式设计原理及其实现。设计过程中,以实现照明控制为主线,分别设计硬件和软件,最终完成照明控制的目标。该照明控制系统的主控制器、节点控制器分别是以MSP430单片机与AT89S52单片机为核心,实现了通信、控制与显示等功能。文中详细地描述了控制电路的设计过程,包括:RS485通信电路、照明灯控制电路和过零检测电路等。对于软件设计主要有上位机、主控制器、节点控制器的通信程序设计以及灯光控制程序设计、CRC校验程序设计等。
本照明控制系统的特点:上位机程序通过232通信方式给主控制器发送指令,主控制器通过485通信方式控制多个节点控制器调节光照的亮度;通信中采用Modbus协议,并且为了保证传输数据的可靠性,在数据包中加了CRC校验;用户也可以在主控制器上设置,对节点控制器进行控制,进而调节光照亮度;用户可以直接在节点控制器上设置,从而控制光照亮度;用户可以根据节点控制器中的人体检测模块,使系统能做到人在灯亮,人离灯熄;主控制器通过AD采样,获取外界光强,根据外界环境,智能地控制光强;系统通过主控制器定时控制白炽灯。以上各种功能相互配合,最终实现真正的照明节能控制。
已完成的设计中,各控制器间的通信良好;主控制器可以控制单个或全部节点控制器上白炽灯的亮度;上位机可以通过主控制器控制节点控制器;节点控制器能够自动做到人在灯亮,人离灯熄。但还存在一些不足的地方:主控制器在采样外界光强时,程序会出错;节点控制器上电容易死机。
关键词: 485 通信;Modbus;CRC校验;照明控制
ABSTRACT
Saving energy is becoming a trend with the development of intelligent buildings, and the light controlling system is becoming more and more popular. At the same time, the micro-computer control system as the main and core of control system with the development of electronics , it replaces the traditional electronic circuit , and the control system which based on micro-computer had used in the field of intelligent buildings.
This Thesis Describes the design’s principle of the light controlling Method and also describes how the control system runs . In the process of designing , the complying controlling light as the main line , designed the Hardware and the software separately , and finish the goal of controlling light finally . The main controller and slave controller of the control system makes the MSP430 micro-computer and AT89S52 micro-computer as cores . The system can do many jobs, such as communication, controlling and display. The paper describes the designing process of the circuit at length, including: RS485 communication circuit, control circuit of lighting, watchdog circuit, etc. The designing of software mainly includes the several programming, such as PC communication, lamplight controlling, CRC checking.
The functions of the system is: PC program sends commands by 232 communication ,and the host controller controls the brightness of many lights; The control system uses Modbus agreement and adds CRC checking in order to snsuring the accuracy of information ; Users can set commands in the main controller and control the slave controller; Users also can set commands in the slave controller and control the brightness of the light directly. The control system can open the light when there is someone near the light and can close the light when there is nobody near the light automatically by human body detecting module ; The main controller can catch the information of environment outside by AD sampling and controlling the brightness of the light .Based on the function above Mentioned ,the control system can save energy when controlling the brightness of the light .
In the part of finishing project , the Communicating among all kinds of controllers is favorable ; The main controller can control single or all node controllers ; PC can control node controllers through the main controller ; The node controller can open the light when there is someone near the light and can close the light when there is nobody near the light automatically . But the control system also has some deficiency : such as the Program will make mistake when catch the Information about Light intensity of Environment ;The node controller makes mistake easily when given power.
Keywords: RS485 communication; Modbus; CRC checking; Control light
目录
摘要 I
ABSTRACT II
第1章 绪论 1
1.1 课题背景与意义 1
1.2 照明控制技术 1
1.3 本论文的主要工作 2
1.4 本章小结 2
第2章 系统组成、原理和功能 3
2.1 系统设计要点 3
2.2 控制系统的组成 3
2.3 系统功能 5
2.4 系统性能指标及技术要求 5
2.5 本章小结 5
第3章 硬件设计 6
3.1 硬件设计及电路原理图 6
3.1.1 节点控制器硬件电路设计 6
3.1.2 主控制器硬件电路设计 15
3.2 电源板焊接调试总结 24
3.2.1 焊接说明 24
3.3 本章小结 25
第4章 软件设计 26
4.1 节点控制器软件设计 26
4.1.1 程序文件及功能说明 26
4.1.2 程序流程框图 26
4.1.3 Modbus协议 27
4.1.4 CRC校验 27
4.2 主控制器软件设计 28
4.2.1 程序文件及功能说明 28
4.2.2 程序流程框图 29
4.2.3 菜单设置 30
4.3 上位机软件设计 31
4.3.1 上位机设计软件VC 6.0 31
4.3.2 上位机软件 32
4.4 本章小结 33
第5章 系统测试 34
第6章 结论 35
致谢 36
参考文献 37