Hello,
In this article, we are going to learn about the LDR sensor and its interfacing with Arduino.

Hardware Required

Software Required


 

  • A light-dependent resistor is also known as LDR, is used to detect the intensity of a light that is incident on it. A light-dependent resistor is responsive to light. As the intensity of the light changes the resistance of the LDR also changes dramatically.
  • The resistance of an LDR is several megaohms in darkness and a few ohms in the light. This property of LDRs can be used in a wide variety of applications.  

Construction of LDR

  • The design of an LDR is made using any semiconductor materials to enhance their light-sensitivity properties. The most common material used for making LDRs is cadmium sulfide (CdS). Although this material has been banned in several regions due to environmental reasons. 
  • These resistors do not have a PN junction even though they are semiconductors. This differentiates them from other LDRs like phototransistors or photodiodes.
  • The construction of LDR includes a semi-conductor which is a light-sensitive material. This material is placed over an insulating substrate like ceramic.
  • The semiconductor material is placed in a zig-zag way. This is done to get the required power and resistance.

  • The most commonly used LDR symbols in circuit diagrams are shown below:

  • The LDR material does not have any free electrons. It consists of few free electrons when it is not exposed to light. When the light is incident on LDR material, the energy received from the light is enough to break the covalent bonds. This results in many free electrons forming. The free electrons and holes have energy which helps them jump from the valence band to the conduction band. This is how current is generated. The resistivity of LDR decreases as the intensity of incident light increases. So the current increase with the increase in the intensity of light. This is shown in the graph below. 

Working principle of LDR

  • LDR Sensor is a light-dependent resistor. So as the intensity of light changes, the resistance of the sensor also changes. 
  • This change is seen in the zig-zag material which is the semi-conductor. 
  • When light falls on the surface, the resistivity of the material changes, and hence the conductivity of the material also changes. This generates a current as of the intensity of light changes. 

Advantages of LDR

LDR sensor has many advantages

  • High sensitivity.
  • Easy to use.
  • Very economical.
  • Connection diagrams are simple.
  • The light-dark resistance is very high. 
  • Low power requirement.

Disadvantages of LDR

Some of the disadvantages of LDR sensors are

  • Hysteresis effect results in the loss of current.
  • The response is very slow in stable material.

Applications of LDR 

LDR Sensors have a wide variety of applications

  • Burglar alarm circuit
  • Alarm clock
  • Used to count objects in conveyor belts
  • Automatic street lighting
  • Used in cameras

Interfacing with Arduino 

  • The positive terminal of LDR is connected to 5V and the negative terminal is connected to the analog pin A0.
  • The positive terminal of the LED is connected to the digital pin 13 and the negative pin is connected to the GND.

Arduino Code

const int ledPin = 13;

const int ldrPin = A0;

void setup() {

Serial.begin(9600);

pinMode(ledPin, OUTPUT);

pinMode(ldrPin, INPUT);

}

void loop() {

int ldr = analogRead(ldrPin);

if (ldr <= 30) {

digitalWrite(ledPin, HIGH);

Serial.print("Its Night Time, Turn on the LED : ");

Serial.println(ldr);

} else {

digitalWrite(ledPin, LOW);

Serial.print("Its daytime, Turn off the LED : ");

Serial.println(ldr);

}
Serial.println(ldr);
}
  • Upload the code to the Arduino board.
  • I hope you learned something about LDR sensors from this article. And I hope that you enjoyed it.