How to make an automatic Street light project using LDR with Arduino

In this project, we are going to build an automatic Street light which remains off in day light but turns on during night. This automatic street light controller project is made using an LDR(Light Dependent Resistor) with Arduino“How to make an automatic Street light project using LDR with Arduino”

Note : To know more about LDR, visit this page

 

What is an Automatic Street light ?

You must have seen these self controlled lights on the side of a road.We do not have to manually turn on and off these street lights as they turn on and off all by itself according to the intensity of surrounding’s light.

So this project is all about building a small version of such Automatic street light project using LDR and Arduino.

 

Components needed for this Automatic Street Light:

1. LDR

2. Arduino UNO

3. SPDT Relay 12volt

4. Bulb

5. BC547 Transistor

6. 1o Kohm potentiometer

7. Connecting wires

 

CIRCUIT DIAGRAM:

Automatic Street Light Project using LDR with Arduino Circuit
Automatic Street Light using LDR with Arduino Circuit

 

 

Arduino Code of Automatic Street Light Controller :

 

int x; //corresponding digital value at LDR’s terminal connected to pin10

void setup() {

pinMode(10,INPUT);// LDR is connected to this pin

pinMode(8,OUTPUT);// Base of the transistor is connected to this pin through a 1k ohm resistor

Serial.begin(9600);

}

void loop() {

x=digitalRead(10);
Serial.println(x);
delay(1000);

if(x==0)
{
digitalWrite(8,HIGH);// if digital value is 0 i.e, Dark, Bulb turns ON
}
else
{
digitalWrite(8,LOW);//if digital value is 1 i.e, Daylight, Bulb turns OFF
}

}

 

 

 

DOWNLOAD THIS CODE

 

**Explanation of the code is in comments itself.

 

Working of Automatic Street Light Project Using LDR with Arduino Arduino:

Case 1: When Light is low

Light Intensity falling on LDR is less
Light Intensity falling on LDR is less

1. When intensity of light that falls on the LDR is less, Resistance of the LDR is high and this causes More voltage drop across LDR. This implies that less voltage drop is obtained across potentiometer’s terminal connected to input pin 10 and Ground. And hence 0 is obtained on Serial Monitor in this case.

2. As written in program, when this happens i.e, x==0, Digital pin 8 should be high or 1.

3. Since this pin is connected to the base of the BC547 transistor through a 1k ohm resistor, it is turned on.

4. As soon as this happens, current starts flowing through Vin pin of Arduino to actuating coil of Relay to collector and then emitter of transistor to the Gnd finally.

5. Due to this flow of current through relay, Normally open contact becomes closed and current starts flowing through the Bulb.

 

Case 2: When Light is High

Light Intensity falling on LDR is More
Light Intensity falling on LDR is More

1. When the intensity of light that falls on the LDR is more, Resistance of the LDR is less and this causes less voltage drop across LDR. This implies that more voltage drop is obtained across potentiometer’s terminal connected to input pin 10 and Ground. And hence 1 is obtained on Serial Monitor in this case.

2. As written in the program, when this happens i.e, x==1, Digital pin 8 should be LOW or 0.

3. Since this pin is connected to the base of the BC547 transistor through a 1k ohm resistor, it remains off.

4. As soon as this happens, current stops flowing through Vin pin of Arduino to the Gnd finally.

5. Due to this, Normally open contact remains as it is and current does not flow through the Bulb.

 

 

No Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: