PinLab › Components › Photoresistor (LDR)
no polarity

Photoresistor (LDR)

light sensor

A resistor that changes its resistance with light: ~1 MΩ in the dark, ~1 kΩ in sunlight. Use it to make an automatic night light.

Open the course →

How it works

By itself the ESP32 cannot read resistance, only voltage. So the LDR goes into a voltage divider with a fixed 10 kΩ resistor: 3V3 → LDR → (measuring point) → 10 kΩ → GND. In light the LDR has low resistance → the voltage at the measuring point is high; in the dark → low. The ESP32 reads it with analogRead().

Pins and wiring

PinWhat it isWhere it connects / why
End 1No polarity→ 3V3.
End 2No polarity→ ADC pin (e.g. GPIO 35) AND to the 10 kΩ resistor to GND.

Specifications

Resistance light~1 – 10 kΩ
Resistance dark~0.5 – 1 MΩ
Response time~20–30 ms
Max voltage150 V
Partner resistor10 kΩ

Tips and typical mistakes