INTERFACE LDR WITH ARDUINO UNO

INTERFACE LDR WITH ARDUINO UNO

Interface LDR with Arduino UNO


If you want your bike or car to pass through a tunnel. Then the headlight of the car or bike should be automatically turned on and when the car or bike comes out of the tunnel. Then the automatic headlight should go off. Because most of the tunnels are lacking due to lack of light. If the person is not visible. Then you can make the headlight of your car or bike automatic by applying this project.

  1. What is LDR?

LDR


The full name of LDR is Light Dependent Resistor and LDR is a variable resistor whose resistivity changes according to the intensity of the light falling on surface. LDR is a very famous sensor for electronics project like automatic street light, automatic solar tracker, weather reporting etc. 

How Does it Work?

When the intensity of a light starts increasing on the surface of LDR. Then the resistivity of LDR starts increasing then LDR blocks the current.So that current does not flow in the circuit and when the intensity of light starts decreasing on the surface of LDR then LDR the current starts to flow. So that the current flows in the circuit. This is how LDR works. LDR we can say a sensor. Whose work is to sense the light surrounding of us.

Application of LDR

  • Switch purposes
  • Brightness indicator
  • Auto brightness flash for camera
  • Street light
  • Security Alarm etc.

Component Required

  1. Arduino Uno With USB Cable
  2. LDR
  3. 1k,10k Resistor
  4. Led light
  5. Battery
  6. Jumper wire

Schematics Diagram

Schematics of LDR, led with Arduino Uno


Circuit Diagram

Circuit diagram of LDR with Arduino Uno


Interface LDR and Led with Arduino

Here firstly 9v dc power supply provided to Vin (Input voltage pin) of Arduino Uno. And 1st terminal of LDR is directly connected to 5v pin of Arduino and 2nd terminal of LDR is connected to 1st terminal of 10k resistor and 2nd terminal of 10k resistor is connected to GND pin of Arduino.  

Where the second terminal of the LDR is connected to the first terminal of the 10k resistor, a wire between them is connected to the analog pin of the Arduino.

And cathode terminal of led is connected to GND pin of Arduino and anode terminal of led is connected to 1st terminal of 1k resistor and 2nd terminal of 1k resistor is connected to digital pin D2 of Arduino.

 Code

int ldr = A0;
int led = 2;
int var ;

void setup()
{
Serial.begin(9600);
pinMode(ldr, INPUT);
pinMode(led, OUTPUT);
}

void loop()
{

var = analogRead(ldr);
Serial.print(LDR:=);
Serial.println(var);

if(var<=300)
{
digitalWrite(led, HIGH);
Serial.println("Dark, Turn ON Led");
}
else
{
digitalWrite(led, LOW);
Serial.println("Light, Turn OFF Led");
}

}

Post a Comment

0 Comments