Design and Implementation of Intelligent Control System for Campus Lighting Based on Arduino Documen

Mondo Technology Updated on 2024-01-30

With the rapid development of electronic technology, single-chip microcomputer-based control systems are widely used in industry, agriculture, electric power, electronics, intelligent buildings and other industries. As the main body and core of the embedded control system, the microcomputer replaces the traditional electronic circuit of the traditional control system. The development and maturity of building intelligence have also laid a solid foundation for the promotion and application of MCU-based lighting control systems.

The Arduino based indoor lighting control system and its principle were introduced, and an effective energy-saving control method was proposed. The system uses mature sensing technology and computer control technology to control the indoor lighting of school classrooms with multiple parameters.

System design includes hardware design and software design. The main controller and sub-controller of the lighting control system are based on Arduino respectively to realize the functions of communication, signal acquisition, control, display and so on. Photostabilizers are used to make the light source have an automatic adjustment function. The design process of the control circuit is described in detail, including: optical signal sampling circuit, human body signal acquisition circuit, keyboard and LED display circuit, RS485 communication circuit, lighting control circuit, watchdog circuit and signal processing circuit. The software design mainly includes wired communication programming of the main controller and sub-controller, as well as lighting control, timing control, keyboard scanning and LED display programming.

During the working process, the optical signal sampling circuit collects information such as light intensity, human body signal acquisition circuit, whether the room is occupied, working hours, etc., and sends signals to the microcontroller. The microcontroller switches the lighting device through the control circuit according to the information to realize lighting control and achieve the purpose of energy saving.

Keywords: intelligent control, main controller, sub-controller, single-chip microcomputer, timing control;

Directory. Abstract 1

abstract 1

1 Introduction 2

1.1 Background 2

1.2 Development and Status Quo of Intelligent Lighting Control System 2

1.3 System Design 3

2 Hardware circuit design and implementation 6

2.1 System Hardware Overview 6

2.2 Introduction to CPU Performance 6

2.3 Main controller circuit design 7

2.Circuit design for a 4-point controller 8

2.5 Design of RS485 communication circuit 9

2.6 Optical Signal Sampling Circuit 11

2.7 DS12887 Clock Chip Interface Circuit Design 15

2.8 Output drive circuit design 18

3 System software design and implementation 21

3.1 Human-Computer Interaction Programming 21

3.2 Lighting start-stop control program design 23

3.3 Lighting Control Programming 26

3.4 RS485 Communication Programming 28

Summary 31Acknowledgments 32

Ref. 33

System software design and implementation.

The software design is divided into three parts: main programming, sub-programming, and interrupt programming. Software is the soul of a computer system. Without software, a computer cannot perform to its full potential. That's where software plays in computers. In computer control systems, software is also very important. In lighting control systems, the functions of hardware devices are defined by software. For example, the system controls distributed lighting fixtures, the serial communication program completes the control function, the keypad function is defined by software, and the LED digital display is programmed. You'll find that software is an important part of the control system.

Human-computer interaction programming.

The human-computer interaction program design of the system is mainly to solve the problem of key scanning and information display, so that the operator can flexibly control the system. The keypad is used to enter instructions, and the LEDs are used to display the status of the microcontroller. This is a relatively simple form of human-computer interaction.

The keyboard of this system is 4 4 using matrix keyboard, which is composed of row lines and column lines. These keys are located at the intersection of row and column lines. The row and column structure of 4 forms a keyboard with 16 keys. Obviously, if the number of keys is higher, the matrix keyboard saves more IO ports compared to a standalone keyboard.

The scanning speed is very fast, and people always press the keys within a certain amount of time, so as long as the microcontroller is waiting for input, this keyboard scanner basically does not let go of the key signal. Because most people get jittery when they press a key, the jitter signal when scanning the keyboard can cause an erroneous signal. It is not possible to scan the data or re-enter it multiple times. Therefore, a program to eliminate jitter is required. The microcontroller does not respond to a portion of the relevant jitter signal, but only to the key signal that is actually present once. This makes it possible to implement a jitter removal procedure. If a pulsed signal is detected, it is not immediately considered as a key, but after a delay. If there is a signal in 3 detections, a key operation is considered to have occurred. Choosing a delay is very important. Jitter removal is too fast. Too slow will cause the keyboard to become inflexible and miss more key signals. Figure 3-2 shows the flow chart of the keyboard scanner.

In addition to the basic numeric keys (0-9), the system defines the other keys as 6 command keys: on, off, value-added, depreciated, timer, and confirm. The basic functions of key control include:

1) Enter the address of the subcontroller and the time setting of the timing function through the number key and the confirmation button.

2) Use the key switch to control the start and stop of the lighting unit.

3) Use the value increase and value decrease keys to control the brightness of the lighting fixture.

4) The timing button is used to set the timing control of the lighting fixture.

The system realizes the function through the software method, that is, defines the command keys such as on, off, added value, depreciation, timing, confirmation, etc., obtains the key value of the corresponding command key through the keyboard scanning program, and then executes the corresponding sub-program to realize the required control function.

The system uses a 4-position common anode 7-stage digital tube. The anode (positive pole of the diode) of the 8 light-emitting diodes (the positive pole of the diode) is connected to the common anode digital tube. Typically, the common anode is connected to a high level (usually connected to the power supply) and the other pins are connected to the output of some of the drive circuits. When the output terminal of a part of the drive circuit is low, the field connected to the terminal is connected and illuminated, and various numbers and characters can be displayed according to the combination of the light-emitting field. In this case, the segment drive circuit needs to absorb the on-current of the rated section, and determine the corresponding current-limiting resistance according to the external power supply and the on-current of the rated section. The current limiting resistor here is 100.

The 7447 chip selected here is a converter from BCD code to SEG7 segment code, and 74LS138 is the address decoder. The digital tube is turned on by the 74LS138 and is based on the SEG7 segment** data transmitted from the 7447. When not enabled, the digital tube retains the original display data. Figure 3-3 shows the flowchart of the LED digital display program.

References. 1] Ma Shuhua, Wang Fengwen, Zhang Meijin, Single-chip microcomputer principle and connection technology mBeijing. Beijing University of Posts and Telecommunications Press, 2007

2] Jia Zhengsong, Design of Intelligent Lighting Control System Based on Microcontroller, J Modern Electronic Technology, 2009, (17)::p 105-107

3] Sun Hanfang, Xu Aiqing. Principle and application of single-chip microcomputer mBeijing: Beihang University Press. 1996

4] Chen Xinzhong. Design of single-chip microcomputer multi-machine communication software based on RS485 bus JModern electronics. 2002.(3)p8-10

5] Fan Yu, Cheng Quan. Long-distance multi-machine master-slave communication technology based on RS485 bus JIndustrial control computers. 2006. 19(7) p71~73

6] Sun Xuemei, Fan Jiuchen. Application of real-time clock chip in microcontroller system JJournal of Shenyang Institute of Education. 2005.7(2) p132~134

7] Hu Hancai. The principle of single-chip microcomputer and its connection technology mBeijing: Tsinghua University Press. 1st edition, 1996. p266-268.

8] Department of Automation, Tsinghua University. Intelligent information processing and intelligent control mHangzhou: Zhejiang Science and Technology Press. 1998,12.

Related Pages