(LDR) Light Dependent Resistor with Arduino

how to use light dependent resistor with arduino

 

A lot of interesting projects are made on LDR ( light dependent resistor ) using with Arduino. But the only thing is that you should have a basic idea of how its work. LDR ( light dependent resistor ) as the name says its a resistor that is totally depending on the light. It is also called Photoresistor because the light is in form of photons and ldr sensor changes its resistance when the light is change.

Here we learn

1) What is LDR?
2) How to use Light Dependent Resistor (LDR) with Arduino.
3) How to calibrate LDR.
4) How to program LDR with Arduino.


1) What is LDR 

Light-dependent resistor (LDR) is a type of resistor which changes its resistance with the change of intensity of light. It also called a photoresistor. It's a passive electronic device made of a semiconductor that absorbs electrons and gives enough energy to electrons that helps bound electrons to jump into the conduction region. The electrons in conduction region are free to conduct electricity which resulting in lowering resistance of LDR.  The resistance of photoresistor is very high on darkness, as high as 1MΩ. But when light falls on it resistance decreases as low as KΩ (10-20)kΩ, depending which model of photoresistor you are using.   

There are two methods using light to get output form LDR sensor.
        1) If the light is available then do something.
        2) If lights are not available then do something.

These two methods of controlling photosensor depend on your choice that how you treat your (LDR)   light dependent resistor or photoresistor.

For example, If you want to put the solar panel and track it with the light of SUN. Where the light of Sun is available. Our LDR should turn the face of the panel there. This is for when the light is the available situation.

Second is the simplest example of a house. Suppose you are living in a very big house and your house is in a strange area where you were feared to go out at night. There you can use LDR as if there are dark means if there is no sunlight or any other light. Your balcony or gates lights will turn ON automatically. This process is for when lights are not available.

You wonder if I told you that for both of the situations the programming is same for ( LDR ) light dependent resistor or photosensor.

Yes, that is the coolest part of using a light dependent resistor with Arduino. That's why it important to know how to use ldr and how it works.

2) How to use LDR with Arduino


1) One leg ldr to 5volt Arduino pin
2) The second leg ldr to resistor between (1k to 10k) to ground,
3) Between resistor and LDR pin goes Arduino analog pin.

There are two methods using light to get output form LDR sensor.
        1) If the light is available then do something.
        2) If lights are not available then do something.

These two methods of controlling photosensor depend on your choice that how you treat your (LDR)   light dependent resistor or photoresistor.

For example, If you want to put a solar panel and track it with the light of SUN. Where the light of Sun is available. Our LDR should turn the face of the panel there. This is for when the light is the available situation.

Second is the simplest example of a house. Suppose you are living in a very big house and your house is in a strange area where you were feared to go out at night. There you can use LDR as if there are dark means if there is no sunlight or any other light. Your balcony or gates lights will turn ON automatically. This process is for when lights are not available.

3) How to calibrate LDR

 Calibrate ldr using circuit diagram, the resistor attached with ldr we need to change its value between 10k to 1k and watch in serial monitor of arduino whats the difference in values when its darkness and light, choose maximum difference of value.

4) How to program LDR with Arduino

 int ledPin_number = 3;
int ldrPin_number = A0;
void setup() {
Serial.begin(9600);
pinMode(ledPin_number, OUTPUT);
pinMode(ldrPin_number, INPUT);
}
void loop() {
int ldrStatus = analogRead(ldrPin_number);
if (ldrStatus <=300) {
digitalWrite(ledPin_number, HIGH);
Serial.println("LDR is DARK, LED is ON");
}
else {
digitalWrite(ledPin_number, LOW);
Serial.println("LDR have light so led is off");
}
}

I hope it helps you. There will be much more tutorials so follow us for learning new and interesting projects.
                              THANKS


Share To:

Kevin smith

Post A Comment:

0 comments so far,add yours