LDR Resistor Calculator
Choose the right fixed resistor for an LDR (photoresistor) voltage divider and see what an Arduino Uno or ESP32 will read from darkness to daylight. Based on the GL5528 resistance curve.
Which resistor goes with my LDR?
An LDR is read through a voltage divider: the LDR plus a fixed resistor. The divider is most sensitive where the fixed resistor equals the LDR's resistance, so pick the light level your project has to judge, and this calculator suggests the resistor and shows what your board will read from darkness to daylight.
10 lux · LDR ≈ 10 kΩ at this light
LDR details (optional)
GL5528: 8–20 kΩ at 10 lux, gamma about 0.7. Measure yours with a multimeter for the best result.
Suggested fixed resistor
10 kΩ
- At 10 lux, A0
- 2.50 V
- analogRead()
- 512
- Change when light doubles
- 123 counts
- Max divider current
- 0.50 mA
| Light | LDR | Voltage | analogRead |
|---|---|---|---|
| Darkness (1 lx) | 50.1 kΩ | 0.83 V | 170 |
| Dusk (10 lx) | 10 kΩ | 2.50 V | 512 |
| Indoor (300 lx) | 925 Ω | 4.58 V | 936 |
| Daylight (5,000 lx) | 129 Ω | 4.94 V | 1010 |
Formula: R_LDR = R10 × (lux ÷ 10)−γ (max 1 MΩ). With the LDR on the supply side, V = Vsupply × R_fixed ÷ (R_fixed + R_LDR). Best sensitivity when R_fixed ≈ R_LDR at your light level. Real LDRs vary by up to 2×, so treat readings as a starting point and fine-tune thresholds on the bench.
How this calculator works
Use the interactive tool above, then review the formula, expected inputs and assumptions below to interpret the result correctly.
Formula and method
R_LDR = R10 × (lux ÷ 10)^−γ, capped at 1 MΩ. With the LDR on the supply side, Vout = Vsupply × R_fixed ÷ (R_fixed + R_LDR). Sensitivity is highest when R_fixed equals R_LDR at the light level you care about.
Worked examples
Night light that switches at dusk
At 10 lux a GL5528 is about 10 kΩ, so a 10 kΩ fixed resistor puts the Uno's A0 at 2.5 V (reading about 511) right where the switch happens, and the reading moves by about 120 counts when the light doubles.
Detecting real darkness
At 1 lux the LDR is about 50 kΩ. With a 10 kΩ fixed resistor the reading is only about 170 and changes slowly; a 47 kΩ resistor moves the dark readings to mid-range so night and late dusk are easy to tell apart.
Bright light for a solar tracker
In daylight (5,000 lux) the LDR drops to roughly 130 Ω. A 10 kΩ resistor pins the reading near the top of the range; a 120–150 Ω resistor brings it back to the middle so small changes in sunlight show up.
Inputs
- Board (supply voltage and ADC) — Unit: Uno 5 V / ESP32 3.3 V
- Light level to judge — Unit: lux
- Fixed resistor — Unit: Ω
- LDR resistance at 10 lux — Unit: kΩ
- Gamma (slope)
What the result means
- Suggested fixed resistor — Unit: Ω (E12)
- Voltage and reading at the chosen light — Unit: V, counts or mV
- Change in reading when the light doubles — Unit: counts
- Readings in darkness, dusk, indoor and daylight — Unit: V and counts
Practical tips and common mistakes
- Average 8–16 readings: mains lamps flicker at 100 or 120 Hz.
- Use two thresholds (hysteresis) when switching a light or relay, so it doesn't flicker at the switch point.
- If you need real lux values rather than dark/light decisions, use a BH1750 instead of an LDR.
Assumptions and limitations
- LDRs vary by up to 2× from part to part; measure yours at your target light for the best result.
- The model follows the GL5528 datasheet curve (8–20 kΩ at 10 lux, gamma about 0.7).
- Keep the divider at 3.3 V on an ESP32: its analog pins must not see more than 3.3 V.
More Electronics