Preview build — page text is a draft awaiting human review. Code badges come from real compiles. The flasher is real but not yet hardware-tested; the Playground is still a preview.

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.

Analog

Community draft — report a mistake

CategorySensor
InterfaceAnalog
Voltage3.3–5 V
Typical price₹40

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

PinWhat it does
VCC3.3–5 V supply
GNDGround
DODigital output from the LM393 comparator — LOW or HIGH when light crosses the threshold set by the blue pot
AOAnalog voltage that changes with light — read with analogRead()

Use it with

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.

↑↓ to move · Enter to open