. Automatic Street Light Using Arduino & LDR ~ SmartElectronicsDIY

Automatic Street Light Using Arduino & LDR

 Project Objective


To automatically turn ON the light at night and turn OFF during daytime using an LDR sensor and Arduino Uno.



 Components Required (Part Name)

No. Component Name

1 Arduino Uno

2 LDR (Light Dependent Resistor)

3 10kΩ Resistor

4 LED

5 220Ω Resistor

6 Breadboard

7 Jumper Wires

8 USB Cable

🔌 Circuit Connections

 LDR Connection


One leg of LDR → 5V


Other leg of LDR → A0 (Arduino)


10kΩ resistor from A0 → GND


 LED Connection


LED Anode (+) → Digital Pin 9 (via 220Ω resistor)


LED Cathode (–) → GND


 Working Principle


LDR resistance changes with light.


Daylight → High light → LED OFF


Night → Low light → LED ON


Arduino reads LDR value from analog pin A0 and controls LED.






 Arduino Code (Full & Simple)

int ldrPin = A0;    // LDR connected to A0

int ledPin = 9;     // LED connected to D9

int ldrValue = 0;


void setup() {

  pinMode(ledPin, OUTPUT);

  Serial.begin(9600);

}


void loop() {

  ldrValue = analogRead(ldrPin);

  Serial.println(ldrValue);


  if (ldrValue < 500) {   // Night condition

    digitalWrite(ledPin, HIGH);

  } else {                // Day condition

    digitalWrite(ledPin, LOW);

  }


  delay(500);

}


 Applications


Street lights


Garden lights


Automatic room lighting


Energy saving systems









0 comments:

Post a Comment