How to Build an Automatic Street Light Using Arduino and LDR

Introduction

An automatic street light is an electronics project that automatically switches an LED ON when the surrounding light becomes dark and switches it OFF when sufficient light is available.

In this project, we will use an Arduino UNO, an LDR Sensor, a resistor and an LED to build a simple automatic lighting system.

The LDR detects the surrounding light intensity, while the Arduino reads the sensor value and controls the LED according to the detected light level.

This project is suitable for beginners who want to learn about sensors, analog input, Arduino programming and automatic control systems.

How Does an Automatic Street Light Work?

The main component used to detect light is an LDR (Light Dependent Resistor).

The resistance of an LDR changes according to the amount of light falling on its surface.

  • In bright light → LDR resistance decreases.
  • In darkness → LDR resistance increases.

The Arduino reads the voltage generated by the LDR circuit through an analog input.

When the detected light level falls below the programmed threshold, Arduino switches the LED ON.

When sufficient light is detected, Arduino switches the LED OFF.

Basic working flow

Light → LDR → Arduino → LED

Block Diagram

       LIGHT INTENSITY
              ↓
         ┌─────────┐
         │   LDR              │
         │ SENSOR         │
         └────┬────┘
                      ↓
         ┌─────────┐
         │ Arduino         │
         │   UNO             │
         └────┬────┘
                      ↓
         ┌─────────┐
         │   LED              │
         └─────────┘

Hardware Requirements

Component Quantity Purpose
Arduino UNO R3 1 Main controller
LDR 1 Detects light intensity
10KΩ Resistor 1 Voltage divider
LED 1 Light output
Breadboard 1 Circuit assembly
Jumper Wires As required Circuit connections
USB Cable 1 Programming Arduino

 

Component Specifications

Specification Details
Microcontroller ATmega328P
Operating Voltage 5V
Digital I/O Pins 14
Analog Input Pins 6
Flash Memory 32 KB
Programming Interface USB

 

LDR

Specification Details
Type Light Dependent Resistor
Function Light detection
Output Variable resistance
Application Light sensing

 

LED

Specification Details
Component LED
Function Visual output
Typical Forward Voltage Depends on LED color/type
Application Indicators and lighting

 

Circuit Connections

Connect the components as follows:

  1. Connect one terminal of the LDR to 5V.
  2. Connect the other terminal of the LDR to Arduino A0.
  3. Connect a 10KΩ resistor between A0 and GND.
  4. Connect the LED anode to Arduino digital pin D9 through a suitable current-limiting resistor.
  5. Connect the LED cathode to GND.
  6. Connect the Arduino to your computer using a USB cable.

 Arduino Code

const int ldrPin = A0;
const int ledPin = 9;

int ldrValue = 0;

void setup() {
  pinMode(ledPin, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  ldrValue = analogRead(ldrPin);

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

  if (ldrValue < 500) {
    digitalWrite(ledPin, HIGH);
  } else {
    digitalWrite(ledPin, LOW);
  }

  delay(200);
}

Applications

This basic automatic light circuit can be used as a learning platform for:

  • Automatic night lamps
  • Garden lighting
  • Street-light prototypes
  • Smart-home projects
  • Light-sensitive systems
  • Arduino learning projects
  • IoT automation projects

Conclusion

The Arduino-based automatic street light is a simple project for understanding LDR sensors, analog inputs and automatic control.

By combining an LDR with Arduino, the system can detect changes in ambient light and automatically control an LED.

The same basic concept can be expanded into more advanced automation and IoT projects.