Street lighting is an essential part of modern infrastructure. It improves road visibility, supports pedestrian safety and helps reduce accidents during nighttime. However, conventional streetlights often operate at a fixed brightness or depend on manual switching. This can result in unnecessary electricity consumption, especially when roads are empty or sufficient natural light is available.
The Automatic Smart Street Light Controller Using ESP32 is an embedded systems project designed to automate streetlight operation using environmental sensors. The system uses an LDR (Light Dependent Resistor) to detect surrounding light intensity and a PIR (Passive Infrared) sensor to identify movement near the lighting area.
An ESP32 microcontroller processes sensor readings and controls the streetlight according to the programmed conditions. During daylight, the light remains switched off. At night, it can operate at a lower brightness level and increase illumination when movement is detected.
This adaptive approach demonstrates how embedded technology and sensor-based automation can improve energy management in smart street lighting systems.
Problem Statement
Traditional street lighting systems may consume electricity even when full illumination is unnecessary. Manual switching also requires human involvement and can lead to inefficient operation.
The proposed system addresses these challenges through automatic light detection and motion-based brightness adjustment. It aims to reduce unnecessary lighting while maintaining suitable illumination when movement is detected.
Objectives
Develop an automatic streetlight control system using an ESP32.
Detect daylight and darkness using an LDR sensor.
Identify nearby movement using a PIR sensor.
Adjust light brightness according to environmental conditions.
Reduce unnecessary power consumption through adaptive lighting.
Demonstrate embedded programming, sensor interfacing and output control.
Key Features & Benefits
Required Hardware and Software Components
Hardware Requirements
1. ESP32 Development Board
The ESP32 acts as the main controller. It reads sensor inputs, processes the programmed conditions and controls the lighting output.
2. LDR Sensor
The Light Dependent Resistor changes its resistance according to the amount of light falling on it. It is used to identify day and night conditions through an appropriate voltage-divider circuit.
3. PIR Motion Sensor
The PIR sensor detects changes in infrared radiation caused by moving people or objects within its detection area. It provides a digital signal to the ESP32.
4. LED Streetlight Model
An LED strip or suitable DC LED module can represent the streetlight in the prototype. Its brightness can be adjusted using a compatible driver and PWM control.
5. MOSFET Driver or Switching Module
A suitable logic-level MOSFET driver can control the DC LED load. The driver must be selected according to the LED voltage and current requirements.
6. Power Supply
A regulated power supply provides the required voltage for the ESP32, sensors and LED driver. Separate regulated supplies may be required depending on the prototype design.
7. Connecting Wires and Breadboard
These components are used to establish connections between the controller, sensors and output circuit during development.
Software Requirements
Arduino IDE
ESP32 board support package
Embedded C/C++ programming
ESP32 GPIO and ADC libraries
PWM control functions
Serial Monitor for testing and debugging
Suggested Pin Configuration
Component
ESP32 Connection
LDR voltage-divider output
GPIO 34
PIR sensor output
GPIO 27
LED driver control
GPIO 25
Sensor power
Suitable 3.3V or 5V supply, as specified
Ground
Common ground
The LDR should be connected through a suitable voltage-divider circuit. Check the sensor module's output voltage before connecting it to an ESP32 input.
Implementation Guide
Working Principle and Implementation
Working Principle
The automatic smart streetlight controller operates by continuously monitoring ambient light and movement.
The system follows these operating conditions:
Daytime Mode: When the LDR detects sufficient natural light, the controller switches off the streetlight.
Nighttime Standby Mode: When the surrounding light level falls below the configured threshold, the controller enables the streetlight at a lower brightness level.
Motion Detection Mode: When the PIR sensor detects movement during nighttime, the controller increases the LED brightness for a predefined duration.
Return to Standby Mode: If no further movement is detected, the brightness returns to the lower standby level after the programmed delay.
This method provides automatic operation without requiring manual switching.
Algorithm
Start the ESP32 controller.
Configure the LDR, PIR and LED control pins.
Read the ambient light sensor value.
Compare the reading with the configured night threshold.
If sufficient daylight is detected, switch off the LED.
If darkness is detected, check the PIR sensor.
If movement is detected, increase LED brightness.
If no movement is detected, maintain lower standby brightness.
Repeat the process continuously.
Testing Procedure
Upload the program to the ESP32 board.
Check the LDR readings under bright and dark conditions.
Adjust the night threshold based on the sensor readings.
Test the PIR sensor by moving in front of it.
Verify that the LED switches off during daylight.
Confirm that the LED operates at standby brightness during darkness.
Check whether detected movement increases brightness.
Verify that the LED returns to standby brightness after the motion hold period.
Technical Specifications
Advantages and Applications
Advantages
1. Automatic Operation: The system controls streetlight operation based on environmental conditions without requiring manual switching.
2. Energy Management: Adaptive brightness can reduce unnecessary lighting compared with continuously operating at full brightness.
3. Motion-Based Illumination: The PIR sensor enables increased brightness when movement is detected during nighttime.
4. Embedded System Integration: The project provides practical experience with ESP32 programming, sensor interfacing and PWM output control.
5. Expandable Architecture: Additional features such as wireless monitoring, fault alerts and centralized control can be integrated in future versions.
6. Cost-Effective Prototype: The basic demonstration can be developed using commonly available embedded components.
Applications
Smart city street lighting demonstrations
Residential road lighting prototypes
Campus and college pathways
Parking area illumination
Garden and outdoor lighting
Industrial premises and internal roadways
Energy-efficient lighting research projects
Conclusion & Next Steps
Future Scope, Challenges and Conclusion
Future Scope
The project can be enhanced with additional embedded and IoT technologies to support more advanced streetlight management.
1. IoT-Based Monitoring: ESP32 Wi-Fi connectivity can be used to send sensor readings and lighting status to a web dashboard.
2. Remote Configuration: Authorized users can change brightness levels, motion hold time and operating thresholds through a connected interface.
3. Fault Detection: Additional current or voltage sensing circuits can help identify abnormal LED load conditions and generate maintenance alerts.
4. Solar-Powered Street Lighting: A suitable solar panel, battery and charge controller can be integrated to demonstrate renewable-energy-based lighting.
5. Multiple Streetlight Nodes: Several controllers can be connected to a centralized monitoring platform for a smart streetlight network.
6. Adaptive Scheduling: A real-time clock or network time source can be added to support scheduled operation alongside sensor-based control.
Challenges
LDR readings can vary depending on sensor placement and environmental conditions.
PIR sensors may not detect every type of movement or moving object.
Brightness thresholds and motion timing require practical calibration.
Outdoor installations require weatherproof enclosures and reliable power protection.
Large LED loads need appropriately rated switching and driver circuits.
Conclusion
The Automatic Smart Street Light Controller Using ESP32 demonstrates how embedded systems can automate outdoor lighting through sensor-based decision-making. By combining an LDR sensor for ambient light detection with a PIR sensor for motion detection, the prototype can switch lighting according to daylight conditions and adjust brightness based on movement.
The project is useful for students exploring embedded systems, ESP32 development, sensor interfacing, PWM control and smart city applications. It also provides a foundation for future improvements involving IoT monitoring, solar power and centralized lighting management.
For a practical demonstration, the prototype should be tested with a low-voltage DC LED load before considering any larger installation. Real streetlight deployment requires properly rated electrical equipment, protection systems and qualified installation.