Introduction: Smart Streetlight System
It is a common sight of a streetlight or lamppost lit up even during day time (which I feel is of no use), so what if we make these streetlights smart enough that they can be automatically be controlled by the amount of sunlight that falls over them? I’ll show you how.
Step 1: Introduction
It is a common sight of a streetlight or lamppost lit up even during day time (which I feel is of no use), so what if we make these streetlights smart enough that they can be automatically be controlled by the amount of sunlight that falls over them? I’ll show you how.
Step 2: Materials Required
Materials –
Hardware-
1 Arduino Uno Board
1 breadboard
1 LED(White)
1 LDR (Light Dependent Resistor)
1 1kOhm Resister (upon wish)
Jumper wires
Software-
Download Arduino ide from Arduino.cc. Install and Run it on your computer. Arduino Ide Works on syntactical principles of C/C++.
Step 3: Schematics or Circuit Diagram
LDR- One end of LDR is connected along with one end of Resistor with an Arduino pin(pin A0). The other end of LDR as well as Resistor is given Ground.
LED- One end is connected to an Arduino Pin(pin 5) wheres other end is given Ground
Step 4: Code
Int a=A0; // One terminal of LDR is connected to pin A0
Int B=5; // LED is connected to pin 5
Int p=0; //threshold value
void setup()
{
pinMode(a,INPUT);
pinMode(b,OUTPUT);
Serial.Begin(9600);
}
void loop()
{
p=analogRead(a);
If(p<20 )
{
digitalWrite(b,LOW);
}
Else if (p>16)
{
digitalWrite(b,HIGH);
}
}
NOTE-we would be using some threshold values. Threshold values for a particular LDR depend upon the resistor that you combine along with the circuit upon which the maximum and minimum values of an LDR can be determined upon testing.
Step 5: Working
Working of this module is simple. LDR detects the amount of sunlight
(light in this case) falling on its surface. It converts it into an analog value which is fed into variable p. Now threshold value is set. If p is greater than 20, it means that sunlight is bright, so the LED shouldn’t glow. If the amount is less than 16, it would mean that the amount of sunlight falling on the surface is less (evening) so it would automatically glow up.