Design of intelligent lighting control system based on STC89C52 microcontroller

Publisher:灵感驿站Latest update time:2023-06-25 Source: elecfansKeywords:STC89C52 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

At present, most of the lighting systems in teaching buildings and student dormitories in universities in my country are controlled by timing, which causes problems such as a large waste of electric energy and inflexible lighting modes. Based on the 51 microcontroller, this article realizes intelligent and dynamic control of the lighting system by setting time, sensing light and sound, and setting lighting status according to the different needs of teaching buildings and dormitories. The test results show that the system can change the lighting status under different conditions, adapt to the needs of different places, and achieve the purpose of intelligent control.


In today's society with rapid economic development, the massive consumption of electric energy has made it a scarce resource. How to save energy and reduce consumption has become a hot topic in lighting system research in recent years. At present, most of the lighting systems in teaching buildings and student dormitories in colleges and universities in my country are controlled by timing. Although the control is simple and easy to implement, there are many problems: at night when the flow of people is very small, lighting all the lamps will cause a lot of waste of electric energy; In addition, the timing lighting method makes it impossible to flexibly adjust the working status of the lighting system, especially during thunderstorms and haze weather, posing safety risks. 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 to achieve dynamic and intelligent management of the lighting system.


1 system hardware module

The design of this system is based on the 51 series microcontroller and consists of 7 hardware modules, namely control, timing, light control, voice control, buttons, display, and lighting. Among them, the light control and sound control modules realize the collection and judgment of external light and sound signals; the timing realizes the lighting time control of the lighting system; the control module uses STC89C52 single-chip microcomputer to control the lighting circuit and switch different working states according to the external light, sound and timing signals. to adapt to external needs. The lighting system architecture is shown in Figure 1.

1.1 Control module

This article uses STC89C52 microcontroller, which has an 8-bit CPU and in-system programmable Flash. 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 achieve intelligent and 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 timekeeping. It will not stop timing even when the microcontroller is powered off. At the same time, it also facilitates the system to judge whether the set night time has been 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 light signal intensity. Figure 2 shows the light control circuit. A potentiometer is connected to the non-inverting and inverting input terminals of the comparator. When there is no natural light, adjust the potentiometer to keep the potential of the two input terminals consistent. At this time, the comparator will output a low voltage. flat signal. When the photoresistor is illuminated by natural light, its resistance will be greatly reduced, causing the potential of the non-inverting input terminal of the comparator to increase and the comparator to output a high-level signal. By outputting the signal of the comparator to the P1.4 port of the microcontroller, the microcontroller can determine whether the external light intensity reaches the threshold intensity, thereby controlling the change of the working status of the lighting module.

1.2.3 Voice control module

The voice control module uses an electret microphone (replaced by R6 resistor in Figure 3) to collect acoustic signals. It is a type of condenser microphone with high sensitivity. The LM393 is used to judge the intensity of the acoustic signal. The principle is the same as that of the light control circuit. The final 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 liquid crystal to display the current date and time. The LCD1602 liquid crystal can display two lines, each line has 16 characters. An additional potentiometer can adjust the contrast of the LCD display 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 the three working states of the lighting: off, interval light and full light. When working in the off or fully bright state, all 8 LED lights are off or on; when interval lighting is required, 1 row of 2 LED lights will light up to provide relatively low-intensity lighting.


2 System software design

The intelligent lighting system combines time, light, and sound to determine changes in the external environment, and sets three working states for the lighting to provide different lighting intensities, namely full brightness, interval brightness, and extinguishing states. The system operation process is shown in Figure 5.

In the lighting working status control, the setting time for the dormitory building is from 18:00 to 6:00 the next day, and the setting time for the teaching building is from 18:00 to 24:00, which is called night mode. During the set time, the lighting Works in interval lighting state to provide 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 there is a large flow of people in the teaching building or dormitory. The lighting module will switch to the full brightness state to provide high-intensity lighting, and after the sound signal disappears, it will also Delay for 5 seconds and then resume the working state of interval lighting to ensure the lighting requirements for night activities.


Outside the set time, such as thunderstorms or haze weather, the lighting system collects and judges the natural light intensity from the outside world. Even if it is not in night mode, it still requires a certain amount of lighting. Therefore, when the light intensity collected by the light control module is less than At the threshold intensity, the lighting module will work in a state of interval lighting to ensure basic lighting in the teaching building or dormitory; through the collection and judgment of sound signals, if the flow of people is large, the lighting module will switch to full brightness again. state.


3 system test

According to the functional requirements of the system, the working status of the system under all circumstances (the preset setting time is 18:00~6:00) is tested. The test circuit is shown in Figure 6.


When the set time and light intensity threshold are not reached, the LED light goes out;

When the set time, light intensity When the set time and light intensity "Threshold, Sound Intensity" threshold have not been reached, the LED lights will all light up;

When the set time and sound intensity threshold are reached, the LED lights will light up at intervals;

When the set time and sound intensity threshold are reached, the LED lights will all light up.

It can be seen that this system switches working states as required under various circumstances and meets the design requirements.


4 Conclusion

Based on the lighting needs of university teaching buildings and student dormitories, this article designs an intelligent lighting system that can adaptively adjust the working status of the lighting system according to the setting time and changes in external ambient light and sound, and achieve dynamic management of the lighting system. This system can also be applied to lighting in public places. It has the characteristics of low cost, convenient operation, easy expansion of functions, etc., and can save electricity and energy to the maximum extent.


Keywords:STC89C52 Reference address:Design of intelligent lighting control system based on STC89C52 microcontroller

Previous article:Design and application of high-performance matrix switching system based on AD8108
Next article:What is a single-chip microcomputer_51 pre-study knowledge of single-chip microcomputer

Recommended ReadingLatest update time:2024-11-15 13:37

Practical Analysis of 8051 MCU (Taking STC89C52RC as an Example) | 03 - LED Flowing Light
1 Schematic It is not difficult to see from the picture that the entire P2 port is connected to the LED, and the entire P2 port needs to be driven when writing code. 2 Code #include "reg52.h" //This file defines some special function registers of the microcontroller #include intrins.h //Because we need to use t
[Microcontroller]
Practical Analysis of 8051 MCU (Taking STC89C52RC as an Example) | 03 - LED Flowing Light
STC89C52 MCU 12864 LCD display
///////////////////////////////////////////////////////////////////////   Function:  Display the Chinese characters you want to display on the LCD12864 on the experimental board, so as to achieve         the purpose of learning to operate 12864   Experimental board model: KBL-XYD-C52   Experiment name:  LCD12864 Ch
[Microcontroller]
STC89C52 microcontroller uses timer to flash LED light
#include reg52.h #include intrins.h #define uint unsigned int #define uchar unsigned char sbit LED1 = P1^0;//LED1 //Timer 1 initialization void timer1Init() { TR1 = 1; //Start timer 1 TMOD |= 0X10; //Timer 1 working mode 1, 16-bit timing mode TH1 = 0x4b; TL1 = 0xfd; //Timing 50ms } void main()//mai
[Microcontroller]
8051 MCU (STC89C52) uses timer interrupt mode to implement asynchronous timing of two countdown timers
Compared with the initial value setting of timer0 in single countdown timer, the triggering time interval of interrupt handler is changed to 5ms here, in order to give people a better visual experience (the flicker will be obviously felt if it is set to 10ms). #include STC89C5xRC.H   unsigned char code DIG_CODE = {
[Microcontroller]
8051 MCU (STC89C52) uses timer interrupt mode to implement asynchronous timing of two countdown timers
STC89C52 MCU drives digital tube dynamic display
///////////////////////////////////////////////////// ///////////////////////////   Function:  drive the digital tube on the development board to scroll and display 1, 2, 3, 4, 5, 6, and realize                         the dynamic display of the digital tube   . Experimental board model: BS-XYD-C52 Experiment   nam
[Microcontroller]
Design and implementation of passenger car safety system based on STC89C52 single chip microcomputer
In order to increase the safety of buses, a bus safety system based on STC89C52 single-chip microcomputer with anti-overload and anti-collision functions is proposed. By studying the ultrasonic ranging principle and pulse width modulation principle, the weight of the vehicle body and the distance of obstacles are moni
[Microcontroller]
Design and implementation of passenger car safety system based on STC89C52 single chip microcomputer
STC89C52 MCU DC motor debugging
///////////////////////////////////////////////////// ///////////////////////// Function: Configure timer 1 to generate an interrupt every 1 millisecond. By counting the number of interrupts,         the 0th pin of the defined P2 port generates a PWM with a duty cycle of 70%, which is used to drive the DC         mo
[Microcontroller]
STC89C52RC serial port baud rate program
1. The complete code is as follows: C #include#define uchar unsigned char #define uint unsigned int void send(uchar state) { SBUF=state; while(TI==0); TI=0; } void SCON_init(void) { TMOD=0x20;//6T mode, 11.05992@115200 SCON=0x50; PCON=0x80; TL1=0xFF; TH1=0xFF; TR1=1; /*SCON=0x50;//Timer 2 mode, 11.0592@115200 TH2=0xFF
[Microcontroller]
Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号