MyRoboPathOpen Robotics Lab
All cheatsheets
SensorsQUICK REFERENCE

LDR / Photoresistor

Build a light-sensitive divider and turn ADC readings into thresholds.

Analog sensingMyRoboPath / Robotics field notes
Download PDF

01Voltage divider

Wiring
VCC → LDR → ADC node → 10 kohm resistor → GND.
Behavior
More light usually lowers LDR resistance, raising voltage with this arrangement.
Formula
Vout = VCC × Rfixed / (RLDR + Rfixed).
Reverse
Swap LDR and resistor to make brighter light produce a lower reading.

02Choose & calibrate

Resistor
10 kohm is a starting point; match it to LDR resistance near your target brightness.
Sampling
Average several ADC readings; measure dark and bright values in place.
Threshold
Add hysteresis: different turn-on and turn-off thresholds prevent flicker.

03ADC rules

Voltage
Power the divider from an ADC-safe rail. Uno usually 5 V; Pico 3.3 V.
Meaning
Raw ADC values are relative brightness, not lux without characterization.

Datasheets & further reading

SparkFun: voltage, current & resistance