Ordered before 2 pm on working days = shipped the same day 30-day reflection period 1-year warranty

Wiring diagram and code example

How to connect the Light-sensitive LDR sensor module to an Arduino UNO or ESP32, with an example sketch you can upload straight away.

LDR Light Sensor Reading with Arduino Uno

This project measures ambient light levels using an LDR light sensor module connected to the Arduino Uno analog input A0. The Arduino reads the analog voltage, maps the light intensity, and prints the raw reading to the Serial Monitor. Covering the sensor will change the reading in real time.

Wiring diagram: Light-sensitive LDR sensor module on an Arduino UNO
Wiring diagram · Click to enlarge
Connection table: Light-sensitive LDR sensor module on an Arduino UNO
Connection table · Click to enlarge
LDR_Light_Sensor_Reading_with_Arduino_Un.ino · compiled and verified
/*
 * ==================================================================
 *  Generated by Codey.online  —  https://www.codey.online
 * ==================================================================
 *  Project   : LDR Light Sensor Reading with Arduino Uno
 *  Board     : Arduino UNO (arduino:avr:uno)
 *  Parts     : LDR Light Sensor Module
 *  Libraries : none (built-in)
 *
 *  Codey Online is an AI-powered browser IDE for Arduino and ESP32.
 *  Describe your project and Codey writes the code, draws the wiring
 *  diagram and uploads it to your board, straight from the browser.
 *  This code is free to use, modify and share, without warranty.
 * ==================================================================
 */

const int ldrPin = A0;
const int ledPin = 13;

void setup() {
  Serial.begin(115200);
  pinMode(ledPin, OUTPUT);
  Serial.println(F("LDR Light Sensor Initialized"));
}

void loop() {
  int rawValue = analogRead(ldrPin);
  float voltage = rawValue * (5.0 / 1023.0);

  Serial.print(F("Raw: "));
  Serial.print(rawValue);
  Serial.print(F(" | Voltage: "));
  Serial.print(voltage, 2);
  Serial.print(F(" V | Status: "));

  // Turn on built-in LED if light level drops below threshold
  if (rawValue < 400) {
    digitalWrite(ledPin, HIGH);
    Serial.println(F("Dark (LED ON)"));
  } else {
    digitalWrite(ledPin, LOW);
    Serial.println(F("Bright (LED OFF)"));
  }

  delay(300);
}

Wiring diagram and example code generated by Codey.online — https://www.codey.online

ESP32 LDR Light Sensor Reading

This project demonstrates reading ambient light levels using an LDR light sensor module connected to the ESP32. The module outputs an analog voltage proportional to light intensity, which is read via GPIO 34. Open the Serial Monitor at 115200 baud to view real-time light readings.

Wiring diagram: Light-sensitive LDR sensor module on an ESP32 DevKit V1
Wiring diagram · Click to enlarge
Connection table: Light-sensitive LDR sensor module on an ESP32 DevKit V1
Connection table · Click to enlarge
ESP32_LDR_Light_Sensor_Reading.ino · compiled and verified
/*
 * ==================================================================
 *  Generated by Codey.online  —  https://www.codey.online
 * ==================================================================
 *  Project   : ESP32 LDR Light Sensor Reading
 *  Board     : ESP32 DEVKIT V1 (esp32:esp32:esp32doit-devkit-v1)
 *  Parts     : LDR Light Sensor Module
 *  Libraries : none (built-in)
 *
 *  Codey Online is an AI-powered browser IDE for Arduino and ESP32.
 *  Describe your project and Codey writes the code, draws the wiring
 *  diagram and uploads it to your board, straight from the browser.
 *  This code is free to use, modify and share, without warranty.
 * ==================================================================
 */

// LDR Light Sensor Demo for ESP32
const int LDR_PIN = 34;

void setup() {
  Serial.begin(115200);
  delay(1000);
  Serial.println("ESP32 LDR Light Sensor Demo");
}

void loop() {
  // Read the analog value (0 - 4095 on ESP32 12-bit ADC)
  int rawValue = analogRead(LDR_PIN);

  // Convert to approximate percentage
  float percentage = (rawValue / 4095.0) * 100.0;

  Serial.print("Raw ADC: ");
  Serial.print(rawValue);
  Serial.print(" | Light Level: ");
  Serial.print(percentage, 1);
  Serial.println("%");

  delay(500);
}

Wiring diagram and example code generated by Codey.online — https://www.codey.online

Light-sensitive LDR sensor module

LDR is the abbreviation for Light Dependent Resistor. An LDR is a photoresistor, that is, a resistor that changes its resistance in response to changes in the light level to which it is exposed. When more light falls on the LDR, the resistance decreases, and when there is less light, the resistance increases. This property makes the LDR suitable for applications such as light-sensitive circuits and automation.

Can be used for both Arduino and ESP32, ESP8266, Rapberry Pi, Pi Pico, and also in circuits without a microcontroller.

  • Light-sensitive sensor
  • Responsive to light
  • Arduino and ESP
  • Without microcontroller

Why choose this product?

  • Resistance adapts – Responds to changes in light level.
  • More light, less resistance – Decreases when more light falls on it.
  • Less light, higher resistance – Increases when there is less light.
  • Widely applicable – Usable with or without a microcontroller.
Specifications
Suitable forArduino, ESP32, ESP8266, Raspberry Pi, Pi Pico
TypeLDR

Frequently bought together

Total: € 12,43

Reviews

No reviews yet.

Write a review
Your rating

Shipping & returns

Shipping

Based on your location; if this is wrong, choose your country.

Unfortunately we do not ship to this country (US).

All about shipping

Returns

Not satisfied? You have 30 days after delivery to return the product.

All about returns