This part has a page of its own, with a note on using it and a circuit to try: the part page.
LDR (light-dependent resistor)
A light-dependent resistor, the GL5528 style: a two-legged resistor whose value depends on how much light is falling on it. Aliases: photoresistor, photocell.
There is no supply pin and no output pin. It is a resistor whose value swings from hundreds of ohms in sunlight to tens of kilohms in a room to a megohm or more in the dark, which is why every sketch puts it in a divider with a fixed resistor and reads the middle.
Pins
| Pin | What it does |
|---|---|
1 |
One leg. |
2 |
The other leg. |
Properties
r10: resistance at 10 lux, 15 000 ohms by default (a GL5528). gamma: the slope
of the resistance/light curve on log-log paper, 0.6 by default. dark: the
resistance cap in full darkness, 1 000 000 ohms by default.
While it runs
Drag the slider on the part to change the light falling on it, in lux.
What the model gets right
The curve is the datasheet's own: R(lux) = r10 x (10 / lux) ^ gamma, capped at
dark. With the GL5528 defaults that gives about 950 ohms in full daylight, 15 k in
a dim room, 60 k by candlelight and the megohm cap with the window covered. A
GL5537 is the same model with r10 set to 50 000, an order of magnitude up.
What it does not model
No response time. A real cell takes twenty or thirty milliseconds to follow a step and much longer to recover from bright light, the "light history effect" every datasheet apologizes for, but nothing here runs fast enough for that lag to be the thing that limits a circuit.
The power law is the datasheet's shape, not a fit to one cell: a real GL5528's gamma
drifts across the range rather than staying at 0.6, and the part-to-part spread on r10
is a factor of two or more, so the ohms here are the right order and the right slope
rather than a number to calibrate against. There is no noise, no temperature
coefficient (a real cell moves several percent across a room's range), no spectral
response (the slider is lux of some unspecified color), and no maximum voltage or
power. The resistance changes the instant the slider does.
Common mistakes
Wiring it with no divider resistor at all. An LDR alone between a rail and an ADC pin gives no usable swing; it needs a fixed resistor in series to turn the light level into a voltage.
See it in action
Dark detector and Night light both use an LDR in a divider to sense the room. Open them at /templates.