Saturday, 25 July 2026

Smart Automatic Street Light System Using Microcontroller

Smart Automatic Street Light System Using Microcontroller

1. Project Title

Microcontroller-Based Smart Automatic Street Light Control System Using LDR and PIR Sensor


2. Project Aim

The aim of this project is to design and develop an automatic street light system that controls street lights intelligently according to ambient light conditions and human/vehicle movement.

The system automatically:

  • Turns the street light ON at night.
  • Turns the street light OFF during daytime.
  • Detects movement using a PIR sensor.
  • Operates the light at full brightness when movement is detected.
  • Reduces brightness or turns the light OFF when no movement is detected.
  • Helps to save electrical energy.

3. Project Abstract

The Smart Automatic Street Light System is a microcontroller-based energy-saving system designed to control street lights automatically without manual operation. The system uses an LDR (Light Dependent Resistor) to detect the intensity of surrounding light and a PIR motion sensor to detect the movement of people or vehicles.

During the daytime, the LDR detects sufficient sunlight and the microcontroller keeps the street light switched OFF. During the night, when the light intensity decreases, the microcontroller automatically activates the street light. When motion is detected by the PIR sensor, the street light can operate at full brightness. When no motion is detected for a specific period, the system can reduce the brightness or switch the light OFF.

An Arduino Uno microcontroller is used as the main control unit. The system improves energy efficiency, reduces electricity consumption, and provides automatic and intelligent street lighting.


4. Block Diagram

                 ┌────────────────────┐
                 │   Sunlight / Dark  │
                 └─────────┬──────────┘
                           │
                           ▼
                    ┌──────────────┐
                    │ LDR Sensor   │
                    └──────┬───────┘
                           │
                           ▼
                    ┌──────────────┐
                    │              │
                    │              │
                    │   Arduino    │
                    │     Uno      │
                    │              │
                    └──────┬───────┘
                           ▲
                           │
                    ┌──────┴───────┐
                    │              │
                    │ PIR Sensor   │
                    │ Motion Detect│
                    │              │
                    └──────────────┘
                           │
                           ▼
                    ┌──────────────┐
                    │ MOSFET /     │
                    │ Relay Driver │
                    └──────┬───────┘
                           │
                           ▼
                    ┌──────────────┐
                    │ LED Street   │
                    │ Light        │
                    └──────────────┘

             ┌──────────────────────┐
             │ 5V DC Power Supply   │
             └──────────┬───────────┘
                        │
                        ▼
                    Arduino Uno


5. Components Required

No. Component Quantity Purpose
1 Arduino Uno 1 Main microcontroller
2 LDR Sensor 1 Detects day and night
3 10 kΩ Resistor 1 LDR voltage divider
4 PIR Motion Sensor HC-SR501 1 Detects human/vehicle movement
5 LED Street Light / High-Power LED 1 Lighting output
6 Logic-Level MOSFET, e.g. IRLZ44N 1 Controls high-power LED
7 220 Ω Resistor 1 LED protection, if required
8 5 V Power Supply 1 Powers Arduino and sensors
9 External LED Power Supply 1 Powers high-power street LED
10 Breadboard 1 Prototype circuit
11 Jumper Wires As required Connections
12 Arduino USB Cable 1 Programming

Optional Components

  • LCD 16×2 display
  • OLED display
  • RTC module
  • ESP8266/ESP32 for IoT monitoring
  • Solar panel
  • Battery
  • Rain sensor
  • Ultrasonic sensor

6. System Working Principle

The project works in the following sequence:

Daytime

  1. The LDR receives strong sunlight.
  2. The LDR output value indicates bright conditions.
  3. Arduino detects daytime.
  4. The street light remains OFF.
Bright Light → LDR Detects Day → Arduino → Street Light OFF


Nighttime Without Movement

  1. The LDR detects darkness.
  2. Arduino turns the street light ON.
  3. If no motion is detected by the PIR sensor, the light can operate at reduced brightness.
Darkness → LDR Detects Night → Arduino
                         ↓
                  No Movement
                         ↓
                 Low Brightness


Nighttime With Movement

  1. The LDR detects darkness.
  2. The PIR sensor detects a person or vehicle.
  3. Arduino receives the motion signal.
  4. The street light operates at full brightness.
Darkness + Motion Detected
             ↓
         Arduino
             ↓
      Full Brightness


7. Schematic Diagram

Basic Connection Diagram

                    +5V
                     │
                     │
                 ┌───┴───┐
                 │  LDR  │
                 └───┬───┘
                     │
                     ├────────────── A0
                     │
                 ┌───┴───┐
                 │ 10kΩ  │
                 │Resistor│
                 └───┬───┘
                     │
                    GND


       PIR SENSOR HC-SR501

       VCC ─────────────── 5V
       GND ─────────────── GND
       OUT ─────────────── D2


       ARDUINO UNO

       D9 ──────────────── Gate
                              │
                              ▼
                         ┌────────┐
                         │ MOSFET │
                         └───┬────┘
                             │
                             │ Drain
                             ▼
                       LED STREET LIGHT
                             │
                             │
                            GND

       MOSFET Source ─────── GND


8. Arduino Pin Connection Table

Component Component Pin Arduino Pin
LDR Voltage Divider Output A0
LDR VCC 5V
LDR Resistor Other side GND
PIR Sensor VCC 5V
PIR Sensor GND GND
PIR Sensor OUT D2
MOSFET Gate Gate D9
MOSFET Source Source GND
LED Street Light Positive External +V
LED Street Light Negative MOSFET Drain

Important

For a high-power LED street light, do not power the LED directly from an Arduino GPIO pin. Use a suitable:

  • MOSFET driver
  • LED driver circuit
  • External power supply

9. Step-by-Step Construction

Step 1: Prepare the Arduino Uno

Connect the Arduino Uno to your computer using the USB cable.

The Arduino will be the main controller that receives:

  • LDR sensor input
  • PIR sensor input

and controls:

  • Street light output

Step 2: Connect the LDR Sensor

The LDR is used to detect light intensity.

Connection

5V ─── LDR ───┬─── A0
              │
             10kΩ
              │
             GND

The junction between the LDR and the 10 kΩ resistor is connected to:

Arduino A0

Function

  • Bright light → one range of analog values
  • Darkness → another range of analog values

The Arduino reads the value using:

analogRead(A0);


Step 3: Connect the PIR Sensor

The PIR sensor detects movement.

Connections

PIR VCC  → Arduino 5V
PIR GND  → Arduino GND
PIR OUT  → Arduino Digital Pin 2

The PIR output will be:

HIGH → Motion detected
LOW  → No motion


Step 4: Connect the MOSFET

The MOSFET works as an electronic switch.

Connections

Arduino D9 → MOSFET Gate
MOSFET Source → GND
MOSFET Drain → LED Negative
LED Positive → External Power Supply Positive

A common ground must be connected:

Arduino GND ─── External Power Supply GND


Step 5: Connect the Street Light

For a simple demonstration, you can use an LED.

For a real street light, use a suitable high-power LED module with an appropriate driver.

Basic Concept

External +V
    │
    ▼
LED Street Light
    │
    ▼
MOSFET Drain
    │
MOSFET Source
    │
   GND


10. Control Logic

The control algorithm is:

START
  │
  ▼
Read LDR Value
  │
  ▼
Is it Daytime?
 ┌───────────────┐
 │               │
YES             NO
 │               │
 ▼               ▼
Light OFF    Read PIR Sensor
                  │
                  ▼
          Is Motion Detected?
             ┌────────┴────────┐
             │                 │
            YES               NO
             │                 │
             ▼                 ▼
       Full Brightness    Low Brightness
             │                 │
             └────────┬────────┘
                      │
                      ▼
                  Repeat


11. Example Arduino Program

// Smart Automatic Street Light System
// Arduino Uno + LDR + PIR + MOSFET

const int LDR_PIN = A0;
const int PIR_PIN = 2;
const int LIGHT_PIN = 9;

int ldrValue;
int pirState;

int darknessThreshold = 500;

void setup() {
  pinMode(PIR_PIN, INPUT);
  pinMode(LIGHT_PIN, OUTPUT);

  Serial.begin(9600);

  analogWrite(LIGHT_PIN, 0);
}

void loop() {

  // Read LDR value
  ldrValue = analogRead(LDR_PIN);

  // Read PIR motion sensor
  pirState = digitalRead(PIR_PIN);

  Serial.print("LDR Value: ");
  Serial.print(ldrValue);

  Serial.print(" | PIR: ");
  Serial.println(pirState);

  // Night condition
  if (ldrValue < darknessThreshold) {

    // Motion detected
    if (pirState == HIGH) {
      analogWrite(LIGHT_PIN, 255);
      Serial.println("Night + Motion: Full Brightness");
    }

    // No motion
    else {
      analogWrite(LIGHT_PIN, 80);
      Serial.println("Night + No Motion: Low Brightness");
    }
  }

  // Day condition
  else {
    analogWrite(LIGHT_PIN, 0);
    Serial.println("Daytime: Light OFF");
  }

  delay(500);
}


12. How the Program Works

LDR Reading

ldrValue = analogRead(LDR_PIN);

This reads the light intensity from the LDR circuit.


PIR Reading

pirState = digitalRead(PIR_PIN);

This checks whether motion is detected.


Night Detection

if (ldrValue < darknessThreshold)

The Arduino checks whether the environment is dark.

The value:

darknessThreshold = 500;

may need to be adjusted according to your LDR circuit.


Full Brightness

analogWrite(LIGHT_PIN, 255);

This produces maximum PWM output.


Low Brightness

analogWrite(LIGHT_PIN, 80);

This reduces the brightness.


Light OFF

analogWrite(LIGHT_PIN, 0);

This switches the street light OFF.


13. Testing Procedure

Test 1: Daylight Test

  1. Place the LDR under bright light.
  2. Open the Serial Monitor.
  3. Check the LDR value.
  4. The street light should turn OFF.

Test 2: Darkness Test

  1. Cover the LDR with your hand.
  2. Check the LDR value.
  3. The system should detect night.
  4. The street light should turn ON at low brightness.

Test 3: Motion Test

  1. Keep the LDR covered.
  2. Move in front of the PIR sensor.
  3. The PIR output becomes HIGH.
  4. The street light should turn to full brightness.

14. Advantages

  • Automatic operation
  • Saves electrical energy
  • Reduces manual control
  • Uses low-cost components
  • Easy to expand
  • Improves street-light efficiency
  • Can be powered using solar energy
  • Suitable for smart-city applications

15. Applications

  • Roads and highways
  • Residential streets
  • College and school campuses
  • Parking areas
  • Industrial areas
  • Rural roads
  • Smart-city infrastructure
  • Solar street-light systems

16. Future Enhancements

The project can be upgraded with:

IoT Monitoring

Use ESP32 to monitor:

  • Light status
  • Power consumption
  • Fault conditions

Solar Power

Add:

Solar Panel → Charge Controller → Battery → LED Street Light

Fault Detection

The system can detect:

  • LED failure
  • Overcurrent
  • Low battery
  • Cable failure

Automatic Brightness Control

Use PWM to control the LED brightness based on:

  • Ambient light
  • Motion
  • Time of day

17. Final Project Summary

LDR SENSOR
     │
     ▼
Detect Day/Night
     │
     ▼
   ARDUINO UNO
     ▲
     │
PIR MOTION SENSOR
     │
     ▼
Detect Movement
     │
     ▼
MOSFET DRIVER
     │
     ▼
LED STREET LIGHT

Final System Operation

Daytime → Light OFF

Night + No Motion → Low Brightness

Night + Motion Detected → Full Brightness

This is a strong Microcontroller Systems course project because it demonstrates sensor interfacing, analog input, digital input, PWM output, transistor/MOSFET switching, and embedded control logic in one practical application.

No comments:

Post a Comment