Skip to content

Electronics

How to wire an LDR (photoresistor)

An LDR (light-dependent resistor, or photoresistor) is a resistor whose resistance falls as the light gets brighter. It makes no voltage of its own, so to sense light you put it in a voltage divider with a fixed resistor across a supply. The voltage at the middle then follows the light, ready for a microcontroller's analog input or a comparator.

A resistor that sees

Light knocks extra charge carriers loose inside the LDR's material, so it conducts better. Each ten times more light makes a typical LDR roughly five times smaller:

LightLDR
1 lux (night)50 kΩ
10 lux (dusk)10 kΩ
100 lux (dim room)2 kΩ
1,000 lux (bright room)400 Ω

Real parts vary a lot from one to the next, so check yours with a meter.

Make it a voltage

With the LDR at the bottom of the divider and a fixed resistor on top:

Vout = V × RLDR over Rfixed + RLDR

On 5 V with 10 kΩ on top: at dusk the LDR is 10 kΩ, so the output is 2.5 V. At night, 50 kΩ gives 5 × 50 ÷ 60 ≈ 4.17 V. In a bright room, 400 Ω gives only 0.19 V. The output rises in the dark.

Swap the two parts and it moves the other way: an LDR on top gives an output that falls in the dark.

Live experiment

Watch the sun go down

5 V across a fixed 10 kΩ and a light sensor. Slide the sun from 1000 lux down to 1: with the LDR at the bottom, the output climbs from 0.19 V in bright light to 2.5 V at dusk and 4.17 V at night. Then swap the parts, or try a thermistor in tea.

Try it yourself: free lesson

“Light and heat sensors” is lesson 4 of 6 in Silicon Ridge, Electronics World 5. Free with an account. Lessons unlock in order, so you’ll do the 31 before it first.

Pick the fixed resistor

Far too big or far too small and the output barely moves. The biggest swing between two light levels comes from the geometric mean:

Rfixed ≈ √(Rdark × Rlight)

Example: a dark detector that should see 50 kΩ at night and 1.2 kΩ in a lit room. √(50,000 × 1,200) ≈ 7.7 kΩ, so 6.8 kΩ or 8.2 kΩ. With 8.2 kΩ the output swings from about 0.64 V to 4.3 V.

To turn that into an on/off decision, feed it to a comparator, ideally with hysteresis so a street light doesn't flicker as clouds pass at dusk.

Thermistors work the same way

An NTC thermistor is a resistor whose resistance falls as it warms: a common 10 kΩ part is 33.6 kΩ at 0 °C and 700 Ω at 100 °C. Put it in a divider just like an LDR. That's how car engines, chargers and 3D printers watch their temperature.

LDRs contain cadmium, so many new products use photodiodes or phototransistors instead, but the divider idea is the same.

Free lesson

Now build it yourself

Each lesson comes in three short parts: see the idea, try it on a live board, then build it yourself, with quick checks as you go.

Try it yourself: free lesson

“Light and heat sensors” is lesson 4 of 6 in Silicon Ridge, Electronics World 5. Free with an account. Lessons unlock in order, so you’ll do the 31 before it first.

Or start from the very first lesson, no account needed

Practice questions

Three quick questions from the lessons. Pick an answer to check it.

  1. Question 1 of 3An LDR in a dark box is joined straight to a voltmeter, with no battery anywhere. What does the meter read?
    Show the answer

    Answer: 0 V. An LDR makes no voltage at all. It only changes its resistance. With no supply, nothing pushes charge round, so the meter reads 0 V.

    • Why not “About 5 V: the LDR makes a voltage in the dark”? An LDR makes no voltage of its own, dark or light. It only changes its resistance.
    • Why not “A voltage that rises as the box gets darker”? Darkness raises an LDR's resistance, but with no supply there's still nothing to push charge round, so no voltage.
  2. Question 2 of 3In the dark, an LDR's resistance is…
    Show the answer

    Answer: high. Light frees up charge inside the LDR, so bright light means low resistance. In the dark there's little free charge, and the resistance climbs to tens of kilohms.

    • Why not “zero”? An LDR never reaches zero ohms. Even in bright light it's a few hundred ohms.
    • Why not “the same as in daylight”? The whole point of an LDR is that its resistance changes with light.
    • Why not “low”? Low resistance is what bright light gives: light frees charge inside the LDR.
  3. Question 3 of 3A thermistor gets warmer. Its resistance…
    Show the answer

    Answer: falls. This kind, an NTC thermistor, has a negative temperature coefficient. Warmer means lower resistance, so on top of the divider it lets more of the 5 V reach A0.

    • Why not “flips to zero”? Its resistance falls smoothly as it warms. It never drops to zero.
    • Why not “rises”? That's a PTC thermistor, or an ordinary wire. An NTC, the common kind, falls as it warms.
    • Why not “stays the same”? A thermistor is built so its resistance changes with temperature.
Keep practising: free lesson

“Light and heat sensors” is lesson 4 of 6 in Silicon Ridge, Electronics World 5. Free with an account. Lessons unlock in order, so you’ll do the 31 before it first.

Questions people ask

How does an LDR work?

An LDR, light-dependent resistor or photoresistor, is a resistor whose resistance falls as light gets brighter. Light knocks charge carriers loose in its material so it conducts better. A typical one is tens of kilohms in the dark and a few hundred ohms in a bright room.

Why does an LDR need a resistor?

An LDR only changes its resistance; it makes no voltage. Put it in a voltage divider with a fixed resistor across a supply and the voltage at the middle follows the light. That's the voltage a microcontroller's analog input or a comparator reads.

What value resistor should I use with an LDR?

For the biggest swing, use about √(R_dark × R_light), the geometric mean of its resistance at the two light levels you care about. For 50 kΩ at night and 1.2 kΩ in a lit room, that's about 7.7 kΩ, so 6.8 kΩ or 8.2 kΩ.

How do I make the output rise in the dark?

Put the LDR at the bottom of the divider, between the output and ground. In the dark its resistance climbs and it takes a bigger share of the supply. With the LDR on top, the output falls in the dark instead.

Every topic