LDR Voltage Divider Calculator for DIY Electronics

Calculate the series resistor value for a light-dependent resistor voltage divider

Ad placeholder (leaderboard)

A light-dependent resistor (LDR, or photocell) changes resistance with light, but a microcontroller can only read voltage. A voltage divider converts that resistance change into a readable voltage. This tool picks the fixed resistor that gives you the widest, most sensitive voltage swing across your light range.

How it works

An LDR varies enormously — often from about 1 kΩ in bright light to 1 MΩ in darkness. Pair it with a fixed resistor R to form a divider. The output voltage depends on which leg each component occupies.

With the LDR on the bottom leg (pin to ground):

V_out = V_supply * R_ldr / (R_fixed + R_ldr)

The voltage swing is largest when the fixed resistor sits at the geometric mean of the LDR extremes:

R_fixed = sqrt(R_bright * R_dark)

For a GL5528 (1 kΩ to 1 MΩ) that is sqrt(1000 * 1000000) ≈ 31.6 kΩ, so a common 33 kΩ resistor is ideal.

Why the geometric mean

If you used a value near either extreme, the divider would saturate at one end of the range and the output would barely move across most light levels. The geometric mean centres the transition so the output voltage moves smoothly and the analog-to-digital converter sees the full usable range.

Tips

  • Round to the nearest E12 value (10 k, 12 k, 15 k, 18 k, 22 k, 33 k…). The exact value is not critical.
  • For an outdoor sensor that mostly distinguishes day from night, bias the resistor toward the dark resistance so the threshold sits near twilight.
  • Add a small capacitor (100 nF) across the analog pin to ground to filter flicker from mains-powered lighting.

All calculations run locally in your browser.

Ad placeholder (rectangle)