Arduino LDR Light Dependent Resistor Guide

photoresistorwiring01

A Photoresistor or Light-Dependent Resistor (LDR) is a light-controlled variable resistor. The resistance of a Photoresistor decreases with increasing incident light intensity.

Requirements
Arduino Uno / Duemilanove / Nano
LDR / Photoresistor : Dealextreme
– resistor (+-10k) : Dealextreme

Wiring : 

photoresistorwiring01

The resistor should be about 10K  to protect your Arduino.

Spoiler title

We can read the value of the Photoresistor by measuring the voltage with one of the analog pins on your Arduino.  However we need a divider resistor to protect your Arduino.

arduino_photoresistor_wiring

On breadboard :

duamilanoveldr

Arduino Nano

arduinonanophotoresistorwiring

on a breadboard :

photoresistorwiringnano01

Test program

This program will put out the LDR value to the “Serial Monitor” :

int LDR = A0;

void setup()
{
    Serial.begin(9600);
}

void loop()
{
   Serial.println(analogRead(LDR));
   delay(50);
}

When programmed, open the “Serial Monitor” under Tools:

arduinoserialmonitor

You will now get a continuous stream of the value of your Light Dependent Resistor.

arduinoserialmonitor1

By covering your Photoresistor the value should drop, when shining light on the Photoresistor the value should raise.

Leave a Reply