Arduino Uno with Light Dependent Resistor (LDR) Module: Shedding Light on Light Sensing



, ,


The Light Dependent Resistor (LDR) module is an essential component for light sensing applications. In this guide, we’ll delve into how to connect and use an LDR module with an Arduino Uno to measure light levels accurately.


this is image of ldr sensor (module)

The LDR module works based on the principle of varying resistance in response to light intensity. It comprises an LDR that changes its resistance with changes in light levels. By measuring this resistance, we can determine the amount of light falling on the sensor. The Arduino Uno reads this resistance and converts it into a readable value, allowing us to monitor light levels.

Components Required

Before we get started, ensure you have the following components:

  1. Arduino Uno
  2. Light Dependent Resistor (LDR) Module
  3. Jumper Wires
  4. Breadboard (optional)


Connect the LDR module to the Arduino Uno as follows:

  1. Connect the module’s VCC (or +) pin to the 5V pin on the Arduino.
  2. Connect the module’s GND (or -) pin to any ground (GND) pin on the Arduino.
  3. Attach the module’s OUT (or S) pin to an analog pin on the Arduino, such as analog pin A0.


Below is a simple Arduino code to read light levels from the LDR module and display them in the Serial Monitor:

const int ldrPin = A0; // Define the analog pin connected to the LDR module

void setup() {



void loop() {

  int lightLevel = analogRead(ldrPin); // Read the analog value from the LDR module

  Serial.print("Light Level: ");


  delay(1000); // Delay for 1 second before the next reading



Using an LDR module with an Arduino Uno allows you to create projects that respond to light conditions. Whether it’s for automatic lighting control, sunlight tracking, or creating interactive installations, the LDR module provides a simple and effective way to sense light levels.


  1. Can I use an LDR module for detecting darkness or low light conditions?
  • Yes, LDR modules are commonly used to detect low light conditions. By monitoring the analog value, you can trigger actions when it falls below a certain threshold.
  1. What is the typical resistance range of an LDR in different light conditions?
  • LDRs can have a resistance range from several kilohms in bright light to several megohms in darkness.

Troubleshooting Q&A

  1. I’m getting constant readings regardless of the light conditions. What could be the issue?
  • Ensure that the LDR module is properly connected. Check the wiring and ensure there is no interference from other light sources.
  1. Why are my readings noisy and fluctuating even in stable light conditions?
  • LDRs can be sensitive to rapid changes in light. You can reduce noise by averaging multiple readings or using a simple low-pass filter in your code.

By following this guide, you can harness the capabilities of an LDR module and integrate light sensing into your Arduino Uno projects. Whether you’re creating smart lighting systems or experimenting with light-based interactions, the LDR module provides a versatile tool for your endeavors.

Leave a Reply

Your email address will not be published. Required fields are marked *

Explore our other blogs.

  • 8-bit vs. 32-bit Microcontrollers in Today’s Projects

  • Nintendo Sues Creators of Popular Switch Emulator Yuzu, Citing Piracy Concerns

  • Raspberry Pi CPU Temperature Range – Everything You Need to Know

  • image of tunnel

    Reverse Tunneling with Raspberry Pi: A Comprehensive Guide