LDR light sensor module
Photoresistor (LDR) module pinout, reading AO with analogRead, the DO threshold pot, and wiring on 3.3 V boards without exceeding the ADC.
Community draft — report a mistake
3.3 V or 5 V? AO swings up to VCC. On ESP32 and Pico, power the module from 3.3 V so AO never exceeds the ADC's 3.3 V limit; on Uno use 5 V.
An LDR (light-dependent resistor) drops from megaohms in the dark to a few hundred ohms in bright light. The module puts it in a voltage divider, so AO gives a voltage that tracks light level, and an LM393 comparator turns that into a clean DO signal at a threshold you set with the blue pot.
It’s perfect for automatic street lights, night lamps and curtain openers — anything that only needs “dark or bright”. It isn’t calibrated in lux; for real lux values use a BH1750.
4-pin modules have VCC, GND, DO and AO. 3-pin modules drop AO and only give the comparator output.
Prices are indicative (Oct 2026) and vary by seller.
Pinout
| Pin | What it does |
|---|---|
VCC | 3.3–5 V supply |
GND | Ground |
DO | Digital output from the LM393 comparator — LOW or HIGH when light crosses the threshold set by the blue pot |
AO | Analog voltage that changes with light — read with analogRead() |
Use it with
- LDR light sensor module with Arduino Nano Arduino C++
- LDR light sensor module with Arduino Uno R3 Arduino C++
- LDR light sensor module with ESP32-C3 SuperMini Arduino C++
- LDR light sensor module with ESP32 DevKit V1 Arduino C++
- LDR light sensor module with NodeMCU ESP8266 Arduino C++
- LDR light sensor module with Raspberry Pi Pico W MicroPython
Common errors
AO reading barely changes
Some 3-pin modules have no AO pin at all — only DO. Also check you read the right ADC pin (ESP32: use ADC1, GPIO 32–39, when Wi-Fi is on).
DO flickers at dusk
The comparator chatters near its threshold. Add hysteresis in code: switch on below one value and off above a higher one.
Reading is “backwards”
Depending on the module, AO rises or falls with light. Check with a torch and invert in code.