Automatic street light control is used to control the street lights(Turn on and off based on the light). Here we make use of LDR (Light Dependent Resistor) and LED(Light Emitting diode) and Arduino.
Hard Ware Components Required:- LDR
- LED
- 4.7k Resistor
- Bread Board
- Connecting wires
- Arduino
LDR is used to detect the light, Arduino is used to on/off the Light. For LDR Basics and Principles Please go through the below link. http://www.electrical4u.com/light-dependent-resist...
For LED interfacing Please follow the below link. https://www.instructables.com/id/LED-blinking-using...
Hardware Connections:- Arduino 3rd pin connected to LED +ve
- Arduino GND connected to LED -ve through 4.7k
- Arduino +5v is connected to LDR One End
- Arduino A0 pin is connected to LDR other end
- Arduino GND is connected to LDR other end with 4.7k
- Arduino
#include<SoftwareSerial.h>
int sensorPin=A0;
int sensorValue = 0;
int led = 3;
void setup() {
pinMode(led, OUTPUT);
Serial.begin(9600);
// put your setup code here, to run once:
}
void loop() {
Serial.println("Welcome to LDR tutorial");
sensorValue = analogRead(sensorPin);
Serial.println(sensorValue);
if(sensorValue < 100)
{
Serial.println("LED light on");
digitalWrite(led,HIGH);
delay(1000);
}
digitalWrite(led,LOW);
delay(sensorValue);
// put your main code here, to run repeatedly:
}
Step 2: ResultsResults are displayed on the serial window.
When there is low amount of light the light automatically glows and when there is sufficient amount of light it automatically turns off the light.
Here based on our room condition the threshold value we took is 100 for the LDR sensor.
When we place a hand on LDR(Not allowing any light on LDR) arduino automatically turns on the LED.
When we remove our hand on LDR. Arduino automatically Turns Off LED.
Comments