Circuit 3D

Light-dependent resistor

A light-dependent resistor (LDR), also called a photoresistor, is a resistor whose resistance falls as light on it rises: high in the dark, low in bright light. Placed in a voltage divider, it turns light into a voltage: with 10 kΩ above it on 5 V, an LDR reading 5 kΩ in room light gives about 1.67 V.

Vout = Vin × RLDR ÷ (R + RLDR)

where RLDR is the sensor’s resistance at the moment and R a fixed resistor above it, so the output rises as the light falls.

That is how a night light or a streetlight knows when it is dark. The lab’s sensor runs from about 100 kΩ in the dark to 200 Ω in direct light.

What is a light-dependent resistor?

A light-dependent resistor, or photoresistor, is a resistor made of a light-sensitive material, so its resistance changes with the light falling on it.

It goes by several names, photoresistor, photocell or LDR, and has no polarity. In Figure 1 the lab’s sensor sits in its night light’s divider; turn the light down and the lamp comes on.

Dark: the sensor measures 100 kΩ. In the lab’s night light that lifts the divider to 2.46 V, past the 0.7 V its transistor needs, so the lamp comes on.

Figure 1. The lab’s light-dependent resistor, the 22 kΩ resistor above it in the night light’s divider, and the night light’s green lamp, from dark to direct light.

How does a light-dependent resistor work?

A light-dependent resistor works because light frees charge carriers in its material, usually cadmium sulfide, so the brighter the light, the more current it lets through and the lower its resistance.

The material lies in a zigzag track between two contacts, under a clear window. Its resistance falls steeply but not in a straight line: each step brighter in Figure 1 cuts it by a factor of four or five. In the dark it is highest; the datasheet gives its resistance at a set light level.

How do you use an LDR in a circuit?

To use an LDR in a circuit, put it in series with a fixed resistor across the supply, as a voltage divider, and take the output from between them. A thermistor reads temperature the same way, and a force sensing resistor reads pressure.

The fixed resistor sets the switch point. A transistor on the output turns on past about 0.7 V, or a microcontroller reads the voltage directly.

0.7 V Dark Dim Room Bright Direct 3 V

Dim, with 22 kΩ on top: Vout = 3 V × 25 kΩ ÷ 47 kΩ ≈ 1.6 V, so the lamp is on. This divider switches when the sensor passes about 6.7 kΩ.

Figure 2. The night light’s divider from 3 V, its output in color wherever it passes 0.7 V. A bigger top resistor needs a darker room to switch.

How do you make a dark-activated or light-activated switch?

To make a dark-activated switch, put the LDR at the bottom of a voltage divider; for a light-activated one, put it at the top.

At the bottom, darkness raises its resistance and with it the output, which suits night lights and streetlights. At the top, light lowers its resistance and the output rises instead, for a light alarm or a sunrise switch; the Cupboard Alarm, a gadget you can build, works this way.

3 V 0 V 2.46 V on

Sensor at the bottom, dark-activated: in the dark, Vout = 3 V × 100 kΩ ÷ 122 kΩ ≈ 2.46 V, so the output is on.

Figure 3. The same sensor and 22 kΩ from 3 V, swapped. At the bottom, darkness raises the output; at the top, light does.

What is the difference between an LDR and a photodiode?

An LDR changes its resistance with light and responds in tens of milliseconds; a photodiode is a diode that passes a current set by the light, and responds far faster.

A phototransistor is a photodiode with built-in gain, for a bigger signal. Most LDRs contain cadmium, which the EU restricts under RoHS, so new designs often use photodiodes or phototransistors.

What are light-dependent resistors used for?

Light-dependent resistors sense light levels where speed doesn’t matter, among the commonest types of sensors: night lights, streetlights, garden lamps, toys and simple alarms.

They are cheap, need no polarity and work from any supply, which is why they appear in so many beginner kits. For measuring light precisely, a calibrated photodiode is better.

How do you calculate an LDR circuit?

To calculate an LDR circuit, use the divider formula with the LDR’s resistance at the light level you care about: 5 V with 10 kΩ on top and the LDR at 5 kΩ gives about 1.67 V. To set a switch point, solve it for the fixed resistor.

Example 1: find a light sensor’s output

A 5 V divider has 10 kΩ on top and the lab’s light sensor underneath, in room light. What voltage does it give?

Given
5 V, 10 kΩ on top, and the lab’s sensor underneath in room light, where it measures 5 kΩ
Find
the output, Vout
Solution
Vout = Vin × Rsensor ÷ (10 kΩ + Rsensor) = 5 V × 5 kΩ ÷ 15 kΩ ≈ 1.67 V
Answer
Vout ≈ 1.67 V

Example 2: set where a night light switches on

A night light runs from 3 V, its transistor switching at about 0.7 V. What top resistor makes it switch when the sensor reaches 10 kΩ?

Given
3 V, the sensor at the bottom, and a transistor that switches at 0.7 V when the sensor reads 10 kΩ
Find
the top resistor
Solution
At the switch point, 0.7 V = 3 V × 10 kΩ ÷ (Rtop + 10 kΩ)So Rtop = 10 kΩ × (3 V − 0.7 V) ÷ 0.7 V ≈ 32.9 kΩThe nearest standard size, 33 kΩ, switches at about 10 kΩ
Answer
Rtop = 33 kΩ

Summary

Key equations

  • Vout = Vin × RLDR ÷ (R + RLDR) sensor at the bottom
  • R = Rswitch × (Vin − 0.7 V) ÷ 0.7 V the top resistor for a switch point

Key terms

LDR, photoresistor
A resistor whose resistance falls in light.
Dark resistance
Its resistance with no light.
Photodiode
A diode that passes a current set by light.
Switch point
The light level where a circuit turns on or off.

Practice problems

  1. What happens to an LDR’s resistance as the light gets brighter?

  2. In the lab’s night light the LDR is the bottom resistor. What does the output do as it gets dark?

  3. 3 V sits across 10 kΩ on top and an LDR reading 5 kΩ underneath. What is the output?

  4. Which responds faster to a flash of light?

  5. For a light-activated switch, where does the LDR go in the divider?

FAQ

What is an LDR made of?

Usually cadmium sulfide, a semiconductor whose resistance falls as light frees charge in it, laid in a zigzag track between two contacts.

What is the resistance of an LDR?

It varies by part: often around 1 MΩ in the dark, down to a few hundred ohms in bright light. A datasheet gives it at a set light level, such as 10 to 20 kΩ at 10 lux.

Does an LDR have polarity?

No. Like any resistor it works either way round.

How do you test an LDR?

Measure its resistance with a multimeter, then cover it: the reading should rise sharply in the dark and fall in bright light.

Why are LDRs being replaced?

Most contain cadmium, restricted in electronics sold in the EU under RoHS, and they respond slowly, so new designs often use photodiodes or phototransistors.

Is a photocell the same as an LDR?

Usually, yes: LDR, photoresistor, photocell and photo cell all name the same light-dependent resistor, though photocell can also mean a solar cell or photodiode.

What is a photodiode used for?

Fast light sensing: remote-control receivers, optical links, smoke detectors and light meters, where an LDR would be too slow.

What is a phototransistor?

A transistor switched by light instead of a base current, so light on it lets collector current flow; it responds far faster than an LDR and is the sensor inside an optocoupler.