Overview
This project deals with a new and unique way to save human resources and save electricity across the world, using these street lights we can save a huge amount of electricity and the problem of turning the street lights ON and OFF will also be solved.
In this project we have used a Photoresistor Sensor and an LED here the sensor senses the the dark as the photo resistor sensor can sense dark and light. On sensing the dark the LED will glow automatically without any switch.
Hardware required
- Arduino Uno R3
- Photoresistor
- Resistor
- LED
- BreadBoard
- Jumper Wires
Schematic Diagram
Fig 1. Circuit Diagram
Arduino Code :
const int ledPin = 9; // led pin to 9
const int ldrPin = A0; // ldr pin to A0
void setup() {
Serial.begin(9600);
pinMode(ledPin, OUTPUT); // led pin as output
pinMode(ldrPin, INPUT); // ldr pin as input
}
void loop() {
int ldrStatus = analogRead(ldrPin);
if (ldrStatus <=300) { // LDR value less than 300 is dark
digitalWrite(ledPin, HIGH); // LED on
}
else {
digitalWrite(ledPin, LOW); // LED off
}
}
Precautions
- Connections should be done properly.
- Arduino is case Sensitive so code accordingly.
- Give different colors to the wires.