Abstract
This article details a design scheme for an intelligent street light control system based on the 51 microcontroller. The system integrates functions such as a light sensor, human infrared sensing module, real-time clock, and LCD display to achieve automated control and energy management of street lights. The article includes complete hardware design principles, software architecture, key code implementations (with detailed comments), and system test results, providing practical reference solutions for embedded system developers and IoT enthusiasts.

51 microcontroller intelligent street light control system circuit diagram, including minimum system, sensor module, and display module.
1. System Overview
The intelligent street light control system is centered around the STC89C51 microcontroller (compatible with AT89S51/52, AT89C51/52), combined with various sensors and actuators to form an embedded application system (multi-functional intelligent street light control system based on the 51 microcontroller). The system has the following main features:
-
Dual Mode Control: Supports switching between automatic and manual control modes. In automatic mode, it intelligently adjusts based on ambient light and human activity; in manual mode, direct control is available via buttons.
-
Multi-Sensor Fusion: Utilizes a photoresistor to detect ambient brightness, an infrared pyroelectric sensor to detect human activity, and a DS1302 clock chip to provide an accurate time reference.
-
Energy Optimization: Implements brightness level control through PWM dimming technology, automatically reducing brightness (by about 50%) after midnight to save energy.
-
Status Monitoring: The LCD1602 display shows real-time system time, light intensity, and operating mode, facilitating status monitoring and parameter settings.
2. Hardware Design
2.1 System Architecture
The system hardware architecture consists of six major modules (intelligent street light system based on 51 microcontroller for light intensity detection):
- Main Control Module: STC89C51 minimum system (including 11.0592MHz crystal oscillator, reset circuit)
- Sensor Module: Photoresistor + ADC0832 analog-to-digital converter, HC-SR501 human infrared sensor
- Display Module: LCD1602 liquid crystal display
- Clock Module: DS1302 real-time clock chip (with backup battery)
- Actuation Module: Relay driver circuit, LED street light simulation load
- Interaction Module: 4×4 matrix keyboard for parameter settings

The system hardware block diagram shows the connection relationships between the microcontroller and various modules.
2.2 Key Circuit Design
Light Detection Circuit uses a GL5528 photoresistor and a 10kΩ resistor to form a voltage divider circuit. The output signal is converted to a digital value by the ADC0832. When the ambient illuminance falls below a set threshold (default 15lux), it triggers the condition to turn on the light (2158, 51 microcontroller human sensing detection light control design).
Human Sensing Module uses the HC-SR501, whose output signal is directly connected to the microcontroller’s INT0 pin. It generates an interrupt when human activity is detected, waking the street light from sleep mode.
LED Driver Circuit uses a TIP122 Darlington transistor to construct a constant current source, ensuring the LED operates at a stable current of 350mA±5%, combined with PWM for stepless dimming (intelligent street light control system based on microcontroller).
3. Software Design and Implementation
3.1 Main Program Flow
The system software adopts a state machine design pattern, with the main program loop structure as follows:
void main() { System_Init(); // System initialization while(1) { Key_Scan(); // Key scanning Mode_Handle(); // Mode handling Sensor_Update();// Sensor updating Display_Refresh();// Display refreshing }}
3.2 Core Code Implementation
Light Intensity Detection and Processing:
/* Read light data from ADC0832 channel 0 */unsigned char GetLightIntensity() { unsigned char i, dat1=0, dat2=0; AD_CLK = 0; AD_CS = 0; // Enable ADC0832 // Channel selection timing AD_DIO = 1; _nop_(); AD_CLK = 1; _nop_(); AD_CLK = 0; // Start bit AD_DIO = 1; _nop_(); AD_CLK = 1; _nop_(); AD_CLK = 0; // Select single-ended mode AD_DIO = 0; _nop_(); AD_CLK = 1; _nop_(); AD_CLK = 0; // Select channel 0 // Read data for(i=0; i<8; i++) { AD_CLK = 1; _nop_(); AD_CLK = 0; _nop_(); dat1 <<= 1; if(AD_DIO) dat1 |= 0x01; } AD_CS = 1; // Disable ADC0832 return dat1; // Return light value in the range of 0-255}
PWM Dimming Control:
/* Timer 0 interrupt service function – generates PWM signal */void Timer0_ISR() interrupt 1
{ static unsigned char pwm_count = 0; TH0 = 0xFC; TL0 = 0x66; // Reload timer value (1ms) pwm_count++; if(pwm_count >= 100) pwm_count = 0; if(pwm_count < light_duty) // light_duty is the duty cycle (0-100) LED_PWM = 1; // Output high level else LED_PWM = 0; // Output low level}
Human Sensing Processing:
/* External interrupt 0 service function – human detection */void EX0_ISR() interrupt 0 { if(Human_Sensor == 1) { // Detect high level signal human_flag = 1; // Set human detection flag no_move_timer = 0; // Reset still timer if(auto_mode && light_low) LED_On(); // Turn on light in automatic mode }}
4. System Function Testing
Through actual testing (intelligent street light system based on 51 microcontroller Proteus simulation), the system achieved the following performance indicators:
- Light Response: Detection error <±5% in the range of 10-20,000lux, response time <100ms
- Human Sensing: Detection distance 3-5 meters, detection angle ≤120°, adjustable delay off time (default 10s)
- Time Control: Clock error <±1 minute/month, can set 2 groups of timing periods (e.g., fully on from 19:00-24:00, half on from 24:00-6:00)
- Energy Saving Effect: Compared to traditional street lights, energy saving rate can reach 40-60%

System working status display interface, including time, light intensity, and mode indication.
5. Application Expansion and Optimization Suggestions
-
IoT Integration: Connect to the cloud platform via ESP8266 WiFi module for remote monitoring and management (238 – intelligent street light control system based on 51 microcontroller)
-
Solar Power Supply: Add MPPT solar controller and lithium battery to build an off-grid green lighting system.
-
Network Control: Use RS485 bus to connect multiple nodes into a network for regional linkage control.
-
Fault Diagnosis: Add current detection circuit to monitor LED status in real-time and report faults.
Conclusion
This intelligent street light control system designed in this article, centered around the 51 microcontroller, achieves intelligent and energy-efficient operation of street lights through multi-sensor data fusion and optimized control algorithms. The system hardware cost is less than 50 yuan, with approximately 800 lines of code, demonstrating high practical value and promotion prospects. The complete source code and detailed comments provided can serve as a reference template for embedded development, easily adaptable for actual engineering projects.