Interfacing LDR with Arduino

Photo Resistor (LDR) 

A Light Dependent Resistor (LDR) is also called a Photoresistor or a cadmium sulfide cell .it is also called a photoconductor. An LDR is a component that has a variable resistance that changes with the light intensity that falls upon it. this allows them to be used in light sensing circuits  

There are many applications for Light Dependent Resistors. these include 

Lighting switch 

the most obvious application for an LDR is to automatically turn on light at a certain light level. An example of this could be an automatic street light or a garden light system

Camera shutter control 

LDRs can be used to control the shutter speed on a camera. the LDR would be used to measure the light intensity which then adjusts the camera shutter speed to the appropriate level 



the zig-zag structure on the LDR is cadmium sulfide track and two dots are metal film contacts


How To Use LDR with Arduino :


Circuit Diagram :





Arduino Program for Above Circuit :

 int ldr=A0;//Set A0(Analog Input) for LDR.  
 int value=0;  
 void setup() {  
 Serial.begin(9600);  
 pinMode(3,OUTPUT);  
 }  
 void loop() {  
 value=analogRead(ldr);//Reads the Value of LDR(light).  
 Serial.println("LDR value is :");//Prints the value of LDR to Serial Monitor.  
 Serial.println(value);  
 if(value<300)  
  {  
   digitalWrite(3,HIGH);//Makes the LED glow in Dark.  
  }  
  else  
  {  
   digitalWrite(3,LOW);//Turns the LED OFF in Light.  
  }  
 }  

Comments

Popular posts from this blog

interfacing fingerprint sensor with arduino