Translate

Arduino Automatic Street Light using LDR

 1. Introduction

High energy consumption is a global challenge. Manual street lighting often leads to electricity wastage when lights remain on during the day. This project demonstrates an Automatic Street Light System that uses a Light Dependent Resistor (LDR) to sense ambient light and an Arduino to trigger a relay, switching the high-voltage bulb on only when it gets dark.

2. Components

  • Arduino Uno (The brain)

  • LDR (Photoresistor)

  • 5V Relay Module (The high-voltage switch)

  • 10K Ohm Resistor (For the voltage divider)

  • AC Bulb and Holder

  • Jumper Wires & Breadboard

3. Circuit and Connections

Pinout Diagram of Arduino Uno R3

Pinout Diagram of Single Channel Relay Module

Circuit Diagram

By using a Relay Module, we skip the complex transistor-diode-resistor sub-circuit.

Low Voltage Side (Control):

  • LDR: One pin to 5V, the other to Arduino A0.

  • 10K Resistor: One pin to Arduino A0, the other to GND.

  • Relay Module: * VCC to Arduino 5V

    • GND to Arduino GND

    • IN to Arduino Pin 13

High Voltage Side (Load):

  • Connect the Live AC wire to the COM (Common) terminal of the relay.

  • Connect the NO (Normally Open) terminal of the relay to one terminal of the Bulb.

  • The remaining Neutral AC wire goes directly to the other terminal of the bulb.

4. Circuit Working

The LDR’s resistance changes based on light intensity. In the dark, its resistance is very high, causing the voltage at pin A0 to drop. The Arduino monitors this analog voltage. When it falls below a set threshold, the Arduino sends a signal to the Relay Module. The relay then "clicks" shut, completing the high-voltage AC circuit and turning the bulb on.

5. Code

C++
const int ldrPin = A0;     // LDR sensor input
const int relayPin = 13;   // Relay module signal input
const int threshold = 500; // Adjust based on environment

void setup() {
  pinMode(relayPin, OUTPUT);
  // Most relay modules are Active Low
  digitalWrite(relayPin, HIGH); 
  Serial.begin(9600);
}

void loop() {
  int lightValue = analogRead(ldrPin);
  Serial.println(lightValue);

  if (lightValue < threshold) {
    digitalWrite(relayPin, LOW);  // Turn relay ON (Active Low)
  } else {
    digitalWrite(relayPin, HIGH); // Turn relay OFF
  }
  delay(200);
}

6. Code Working

  • analogRead(ldrPin): Converts the light intensity into a value between 0 and 1023.

  • Threshold Logic: The if statement compares the current light to our threshold.

  • Active Low Trigger: Most relay modules trigger when the signal is LOW. We set it HIGH by default to keep the light off during the day.

7. Tips

  • Calibration: Use the Serial Monitor to see your LDR values in different light conditions to find your perfect threshold.

  • Safety First: Always insulate AC connections. Use a project box to keep the high-voltage side away from the Arduino.

  • Avoid Flickering: Add a small delay() or a hysteresis range in the code to prevent the light from flickering at dusk.

8. Uses

  • Smart Cities: Automated street lighting to save municipal power.

  • Home Automation: Security lights that turn on when you're away.

  • Garden Lighting: Decorative lights that activate at sunset.

9. Conclusion

Building an automatic street light with an Arduino and a relay module is a rewarding entry-level project. It teaches the fundamentals of sensors, microcontrollers, and safely interfacing with high-voltage electronics. This simple automation can significantly reduce energy footprints.

തുടക്കക്കാർക്കായി ഇലക്ട്രോണിക്സ് ലളിതമായി പഠിക്കാം.

Empowering students in Kerala with hands-on technical skills.