How to Build an Automatic Street Light Using LDR and Arduino (DIY Project)

Controlling LED using the LDR with Arduino UNO
0
0
4 min read


Learn to create an automatic street light system using LDR and Arduino. A complete DIY tutorial with circuit diagram, code, and project expansion ideas.


Introduction

What the Project Does

This project demonstrates how to automatically control street lighting using an Arduino micro controller and a Light Dependent Resistor (LDR). When ambient light drops below a specific threshold (like at dusk or during cloudy conditions), the Arduino turns ON the connected street light (represented by an LED or actual 230V lamp via relay). When the ambient light increases (like in daylight), it turns the light OFF.

Real-World Use Case

Automatic lighting systems based on light intensity are widely used in:

  • Street lighting in smart cities
  • Campus or pathway lighting
  • Energy-saving systems in industrial zones
  • Parking lots and garden lighting

Skill Level

Beginner to Intermediate

Expected Outcome

After completing this project, you will:

  • Understand how an LDR works
  • Learn to use analog inputs in Arduino
  • Automate control logic based on real-world conditions
  • Build an energy-efficient light control system

Components Required

QuantityPartDescriptionBuy Link
1Arduino UNO with CableMain microcontroller boardBuy on Elecsynergy
1LDR SensorLight Dependent Resistor for ambient light sensingBuy on Elecsynergy
110k Ohm ResistorPull-down resistor for LDR voltage dividerBuy on Elecsynergy
1LEDTo simulate the street lightBuy on Elecsynergy
1220 Ohm ResistorFor limiting current through LEDBuy on Elecsynergy
1BreadboardFor prototyping connectionsBuy on Elecsynergy
5Jumper Wires (M-M)For making connections on breadboardBuy on Elecsynergy
OptionalRelay ModuleFor controlling 230V AC lampBuy on Elecsynergy

Circuit Diagram + Explanation

Circuit Connections:

  • LDR one terminal β†’ 5V on Arduino
  • LDR other terminal β†’ A0 (Analog Pin) + 10k Resistor to GND (Voltage Divider)
  • LED Anode (long leg) β†’ Pin 13 on Arduino via 220Ξ© resistor
  • LED Cathode (short leg) β†’ GND

In this configuration, the voltage across the LDR varies with light intensity. This analog signal is read by Arduino’s ADC to decide when to turn the LED ON or OFF.

Visual Schematic:


Arduino Code – Line-by-Line

// Automatic Street Light using LDR and Arduino

const int ldrPin = A0;        // LDR connected to analog pin A0
const int ledPin = 13;        // LED connected to digital pin 13
int ldrValue = 0;             // To store the analog value from LDR
int threshold = 500;          // Light intensity threshold (tune as needed)

void setup() {
  pinMode(ledPin, OUTPUT);    // Set LED pin as output
  Serial.begin(9600);         // Begin serial communication
}

void loop() {
  ldrValue = analogRead(ldrPin); // Read the LDR value (0 to 1023)
  Serial.print("LDR Value: ");
  Serial.println(ldrValue);

  if (ldrValue < threshold) {
    digitalWrite(ledPin, HIGH);  // Turn ON LED (it's dark)
  } else {
    digitalWrite(ledPin, LOW);   // Turn OFF LED (it's bright)
  }

  delay(500); // Wait for 0.5 seconds
}

Working Explanation

The LDR forms a voltage divider circuit, where its resistance decreases with increased light. The Arduino reads the voltage across the LDR and determines whether the ambient light level is low or high. If the light level is below the threshold (set to 500), the LED simulates a street light turning ON.

You can tune the threshold value depending on your ambient environment. For more sophisticated lighting systems, you can dynamically calibrate the threshold or use additional sensors.

If you connect a relay instead of an LED, you can control high-voltage lights safely.


Demo / Output Preview

πŸ“Έ You’ll see:

  • Serial Monitor printing LDR values in real-time
  • LED turning ON when you cover the LDR (simulate night)
  • LED turning OFF in bright light

Troubleshooting & Tips

  • LED always ON or OFF?
    • Adjust threshold value
    • Ensure proper placement of LDR and resistor
  • LDR not responding?
    • Check analog pin connections
    • Make sure LDR is not faulty
  • Using a Relay?
    • Ensure flyback diode across coil
    • Drive the relay through a transistor for proper switching

Project Expansion Ideas

1. Multiple Street Lights

Control multiple LEDs (or relays) with multiple LDRs or based on zones.

2. Solar Power Integration

Add a solar charging module and battery backup to make the system sustainable.

3. IoT Monitoring

Log LDR data using ESP8266/ESP32 and upload to IoT dashboards.

4. Dusk to Dawn Timer

Include a Real-Time Clock (RTC) to override LDR with scheduled timings.

5. Motion-Based Activation

Integrate PIR sensor to activate only when movement is detected at night.

6. Adjustable Sensitivity via Potentiometer

Allow real-time adjustment of threshold using a variable resistor.


Conclusion

You’ve successfully built a Smart Automatic Street Light using LDR and Arduino. It’s one of the most practical beginner projects to introduce you to sensors, analog reading, conditional logic, and energy efficiency.

This foundational skill can be enhanced to control high-power lighting, interact with cloud platforms, or integrate into larger automation systems.

βœ… Challenge: Try controlling a real AC bulb with a relay and LDR, then monitor its status remotely using Wi-Fi.

Keep building, keep innovating, and share your success stories with the community!


πŸ›’ Buy the Complete Kit

Order from Elecsynergy


#ArduinoLDR #StreetLightProject #ArduinoAnalogSensor #SmartStreetLight #DIYAutomation #ArduinoUNO #Elecsynergy #InnovateYourself #HomeAutomation #LDRprojects

Leave a Reply