Read Analog Values From LDR Using Arduino

by adithyapaip in Circuits > Arduino

18335 Views, 6 Favorites, 0 Comments

Read Analog Values From LDR Using Arduino

temp_1883845235.jpg
In this instructables we will play using ldr to get analog values...(light dependent resistor its more like solar cell in which resistance decreases as light falls on it)

Components Required

temp_-1090521063.jpg
temp_-2038354629.jpg
*Arduino Uno
*Pot(To increase or decrease the sensitivity of ldr)
*wires to connect to breadboard (if needed I pulled out some single strand wires from scratch)
*LDR

A photo resistor or light-dependent resistor(LDR) or photocell is a light-controlled variable resistor. The resistance of a photo resistor decreases with increasing incident light intensity; in other words, it exhibits photo conductivity. A photo resistor can be applied in light-sensitive detector circuits, and light- and dark-activated switching circuits.

Connecting Components

temp_2094814879.jpg
temp_-403651119.jpg
It works on voltage divider
so we connect pot in series with LDR and sensor value is taken across LDR in terms of voltage developed.... due to light intensity....

Coding

temp_-1049729285.jpg
void setup ()
{
Serial.begin(9600);
}
void loop()
{
int sensorvalue=analogRead(A0);
Serial.println(sensorvalue);
delay(1);
}

Upload

temp_395908791.jpg
temp_67789204.jpg
Above pics represents first when light is not falling on ldr(single digit)
secondly light is falling on ldr (two or three digit number)

Adding Led

1452715782917.jpg
In void loop statements can be added and led pin should be declared at void setup..
If (analogread>=600)
{
digitalWrite(13,HIGH);
}
else
{
digitalWrite(13,LOW);
}