Design scheme of intelligent lighting control system based on 51 series single chip microcomputer
In today's rapidly developing society, the massive consumption of electric energy has made it a scarce resource. How to save energy and reduce consumption has become a hot spot in the research of lighting systems in recent years. At present, most of the lighting systems of teaching buildings and student dormitories in my country's universities are controlled by a timing method. Although the control is simple and easy to implement, there are many problems at the same time: when the flow of people at night is small, all the lamps are lit will cause a lot of waste of electricity; In addition, the timing lighting method makes it impossible to adjust the working status of the lighting system flexibly, which brings safety hazards, especially during thunderstorms and haze weather. The intelligent lighting control system designed in this article can set the lighting mode and lighting time according to the different functional requirements of different areas of the school, and realize the dynamic and intelligent management of the lighting system.
1 System hardware module
The design of this system is based on the 51 series single-chip microcomputer and consists of 7 hardware modules, which are control, timing, light control, sound control, buttons, display, and lighting. Among them, the light control and sound control modules realize the collection and judgment of the external light and sound signals; the timing control of the lighting time of the lighting system; the control module uses the STC89C52 single-chip microcomputer to control the lighting circuit according to the external light, sound and timing signals to switch different working states To adapt to external demands. The lighting system architecture is shown in Figure 1.
1.1 Control module
This article uses STC89C52 single-chip microcomputer with 8-bit CPU and programmable Flash in the system. It is a low-power, high-performance microcontroller. In the design of this article, the control module receives the time of the timing module and the light and sound signals of the external environment, and controls the working status of the lighting lamp by judging the lighting level to realize the intelligent dynamic management of the lighting system.
1.2 Input module
1.2.1 Timing module
The timing module uses the DS1302 chip to provide date and time information to the entire system. It not only has low power consumption and high performance, but also has the function of power-down and time-keeping. It will not stop timing even when the microcontroller is powered off. At the same time, it is convenient for the system to judge whether the set night time is reached.
1.2.2 Light control module
The photoresistor is used in the light control module to collect the light signal, and the LM393 comparator is used to judge the intensity of the light signal. Figure 2 is a light control circuit. The non-inverting input and the inverting input of the comparator are connected with potentiometers. Adjust the potentiometer without natural light to keep the potentials of the two input ends consistent. At this time, the comparator will output low power. Flat signal. When the photoresistor is irradiated by natural light, its resistance value will be greatly reduced, so that the potential of the non-inverting input terminal of the comparator increases, and the comparator outputs a high level signal. Through the output signal of the comparator to the P1.4 port of the single-chip microcomputer, the single-chip microcomputer can determine whether the external light intensity reaches the threshold intensity, thereby controlling the change of the working state of the lighting module.
1.2.3 Voice control module
The voice control module adopts an electret microphone (replaced by R6 resistor in Figure 3) to collect acoustic signals. It is a kind of condenser microphone with high sensitivity. The sound signal intensity is judged using LM393, the principle is the same as that of the light control circuit, and the signal is output to the P1.3 port of the microcontroller, as shown in Figure 3.
1.3 Output module
1.3.1 Display module
As shown in Figure 4, the display circuit uses LCD1602 to display the current date and time. The LCD1602 can display two lines with 16 characters per line. The additional potentiometer can adjust the contrast of the LCD at any time.
1.3.2 Lighting module
As shown in Figure 4, the lighting module uses 2 rows of 8 LED lights to simulate 3 working states of the lighting lamp: off, interval on, and full on. When working in an off or full-on state, all 8 LED lights are off or on; when it is necessary to light up at intervals, 2 rows of LED lights light up in one row, providing relatively low intensity lighting.
2 System software design
The intelligent lighting system combines time, light, and sound to judge changes in the external environment, and sets 3 working states for the lights to provide different lighting intensities, namely full on, interval on and off. The system running process is shown in Figure 5.
In the control of the working state of the lighting lamp, the setting time for the dormitory building is 18:00 to 6:00 the next day, and the setting time for the teaching building is 18:00 to 24:00, which is called night mode. During the set time, the lighting Work in the interval light state, providing basic lighting at night. If the sound intensity collected by the sound control module is greater than the threshold intensity at this time, it means that the teaching building or dormitory has a large flow of people. The lighting module will switch to the full-bright state to provide high-intensity lighting. After the sound signal disappears, it will continue Delay 5 s and then resume the working state of interval light to ensure the lighting demand for night activities.
Outside of the set time, if there is a thunderstorm or haze weather, the lighting system will collect and judge the natural light intensity of the outside world. Even if it is not in the night mode, a certain amount of lighting is required. Therefore, when the light intensity collected by the light control module is less than When the threshold intensity is set, the lighting module will work in the interval bright state to ensure the basic lighting of the teaching building or dormitory; through the collection and judgment of the sound signal, if the flow of people is large, the lighting module will switch to full brightness again status.
3 System test
According to the functional requirements of the system, test the working state of the system under all conditions (the preset setting time is 18:00 to 6:00). The test circuit is shown in Figure 6.
When the set time is not reached and the light intensity> the threshold, the LED light goes out;
When the set time is not reached, the light intensity is less than the threshold, and the sound intensity is less than the threshold, the LED lights will turn on at intervals;
When the set time is not reached, the light intensity <threshold, sound intensity> threshold, the LED lights are all on;
When the set time is reached and the sound intensity is less than the threshold, the LED lights will turn on at intervals;
When the set time is reached and the sound intensity> threshold, the LED lights are all on.
It can be seen that the system switches the working state according to the requirements under various conditions, which meets the design requirements.