BASICS OF LDR SENSOR

WHAT IS LDR SENSOR

Hello Friend,

            I am Cyberautics, and today we learn about the Light Dependent Resistors(LDR) sensor, and how it works with arduino.We use arduino uno but you can use any arduino model.

WHAT IS LDR SENSOR

A Light Dependent Resistor (LDR) is also called a photoresistor or a cadmium sulfide (CdS) cell. ... It is basically a photocell that works on the principle of photoconductivity. The passive component is basically a resistor whose resistance value decreases when the intensity of light decreases.

COMPONENTS

  1. Arduino Uno
  2. LDR sesnsor
  3. Resistor(220 ohm)
  4. Jumper Wires
  5. Breadboard/ PCB

DIAGRAM




CODE

//make a connection as per diagram 

#define sensorpin A0 //declare a input analog pin
int sensorvalue=0; // we take it 0 for Prebent the garbage values
void setup() {
  Serial.begin(9600);
}

void loop() {
 sensorvalue=analogRead(sensorpin); //take a values from sensorpin A0
 Serial.println(sensorvalue); // we print the value which is get from sensor
 delay(100);
}

EXPLANATION


connect components as per diagram and upload the code in arduino board using cord from pc/laptop/mobile, click on serial monitor and monitor the output value it will looking this image.




We can see as per the code and its output , the LDR sensor is a analog sensor because it's value is reach to all finite value not only 0 and 1 , ldr sensor fatch the analog value of light intensity either natural(sun light) as well as artificial light(mobile flash light or any other) .

Its value is rapidly increase as per increases the value of light intensity and decreases as per decreases the light intensity.

you can analyze the minor changes in the output of LDR sensor in serial monitor it just because of variation in light intensity. 

Comments

Post a Comment