Interfacing Photoresistor (LDR) Sensor with Arduino


In this tutorial, we are Interfacing Photoresistor (LDR) Sensor with Arduino, Light-dependent resistors, commonly known as Photoresistors or LDRs (Light Dependent Resistors), are versatile components that can detect changes in light intensity. In this comprehensive guide, we will explore the working principle and features of the Photoresistor (LDR). Additionally, we will learn how to interface it with an Arduino UNO to create a simple light sensing system. By the end of this tutorial, you will have the knowledge and skills to integrate the LDR into your projects, enabling them to respond to changes in ambient light. So, let’s illuminate our understanding of Photoresistors and embark on this enlightening journey of light sensing with Arduino!

Hardware Required

You will require the following Hardware Components for Interfacing Photoresistor (LDR) Sensor with Arduino.

Components#Buy From Amazon
Arduino UNO1Buy Now
Photoresistor (LDR)1Buy Now
9v DC Adapter (Optional)1Buy Now
Resistor 100KΩ1Buy Now
Jumper Wires3Buy Now
Breadboard1Buy Now

What is the Module?

The Photoresistor, or LDR, is a type of resistor whose resistance changes based on the intensity of incident light. It consists of a semiconductor material that exhibits higher resistance in the dark and lower resistance when exposed to light. The resistance of the LDR varies logarithmically with the light intensity, making it suitable for a wide range of applications. When connected to an analog input of the Arduino UNO through a series resistor (such as 100KΩ), the voltage across the LDR changes, allowing us to measure the light level with the Arduino.



Pin Configuration

Pin NamePin Type
VCCPower Supply – 5V
OUTAnalog output


  1. Resistance Range: The resistance of the LDR typically ranges from several kilohms to several megohms, depending on the light intensity.
  2. Response Time: The LDR exhibits a relatively fast response time, enabling real-time light sensing applications.
  3. Operating Voltage: The LDR operates within the voltage range suitable for Arduino, making it compatible with microcontroller-based projects.
  4. Compact Size: The small size of the LDR allows for easy integration into various circuits and projects.


  1. Non-Contact Light Sensing: The LDR provides non-contact light sensing capabilities, making it suitable for applications where physical contact is not desirable.
  2. Wide Applications: The LDR finds applications in light-controlled systems, ambient light sensing, and DIY projects, among others.
  3. Cost-Effective: The affordability of the LDR makes it accessible to hobbyists and professionals alike.

Circuit Diagram

The following circuit shows you the connection of the Interfacing Photoresistor (LDR) Sensor with Arduino Please make the connection carefully


Circuit Connections

GND1st Pin
A0OUT2nd Pin

Installing Arduino IDE Software

First, you will require to Download the updated version of Arduino IDE Software and Install it on your PC or laptop. if you Learn How to install the Arduino step-by-step guide then click on how to install Arduino Button given Blow


//For more Projects:

#define LDR A0 //Initialize LDR sensor pin.

void setup() {
  //Begin the Serial Monitor at 9600 Baud

void loop() {
  int value = analogRead(LDR);  //Store sensor value to variable
  Serial.println(value);        //Print the value to serial

Output Result

The analog value of LDR will be displayed on the Serial Monitor.



  1. Light-Controlled Switching: The LDR can be used to control lights in indoor or outdoor environments, automatically turning them on or off based on the ambient light level.
  2. Sunlight Tracking: In solar panels or solar-powered systems, the LDR can help track the position of the sun for optimal solar energy collection.
  3. Security Systems: The LDR can be incorporated into security systems to detect changes in ambient light, triggering alarms or surveillance systems.
  4. Smart Lighting: In home automation, the LDR can be utilized to adjust the brightness of lights based on the natural light available.
  5. Plant Growth Monitoring: The LDR can be applied in gardening or hydroponic systems to monitor natural light levels for optimal plant growth.


You have now illuminated your knowledge of the Photoresistor (LDR) and its applications in light sensing projects. By interfacing the LDR with Arduino UNO, you can create light-controlled systems, smart lighting solutions, and more. The LDR’s responsiveness to changes in light intensity makes it a valuable component in various DIY projects and practical applications. Armed with this knowledge, you are now equipped to harness the power of light sensing with the Photoresistor (LDR) and Arduino UNO. So, light up your creativity and explore the endless possibilities of light-based projects with the Photoresistor (LDR)!

Leave a Comment