Working Principle
A Light Dependent Resistor (LDR) uses the photoconductivity of cadmium sulphide (CdS). Photons excite electrons into the conduction band, decreasing resistance. In darkness, resistance can exceed 1 MΩ; in bright sunlight it drops below 1 kΩ.
Analogy: Think of an LDR as a water valve controlled by sunlight — more light opens the valve wider, letting more current flow.
Electrical Characteristics
| Parameter | Value |
|---|---|
| Dark Resistance | > 1 MΩ |
| Light Resistance (1000 lux) | ~400 Ω |
| Spectral Peak | ~540 nm (green) |
| Response Time (rise) | ~20 ms |
| Response Time (fall) | ~30 ms |
| Max Voltage | 150 V DC |
Interfacing (Voltage Divider)
An LDR cannot be read directly by an ADC (it outputs resistance, not voltage). Create a voltage divider with a fixed resistor (10 kΩ typical):
V_out = V_cc × R_fixed / (R_ldr + R_fixed)
Code Example
/*
* LDR Light Level Detector — Arduino
* Wiring: LDR between A0 and 5V, 10kΩ between A0 and GND
*/
#define LDR_PIN A0
#define R_FIXED 10000.0 /* 10kΩ fixed resistor */
void setup() {
Serial.begin(9600);
}
void loop() {
int adcValue = analogRead(LDR_PIN);
/* Calculate LDR resistance from voltage divider */
float voltage = adcValue * (5.0 / 1023.0);
float ldrResistance = R_FIXED * (5.0 - voltage) / voltage;
/* Map to approximate lux (rough logarithmic estimate) */
float lux = 500000.0 / ldrResistance; /* Simplified model */
/* Categorise light level */
const char* level;
if (lux > 500) level = "Bright sunlight";
else if (lux > 100) level = "Daylight";
else if (lux > 10) level = "Dim indoor";
else level = "Dark";
Serial.print("ADC: "); Serial.print(adcValue);
Serial.print(" | R: "); Serial.print(ldrResistance, 0);
Serial.print("Ω | ~"); Serial.print(lux, 0);
Serial.print(" lux | "); Serial.println(level);
delay(500);
}
Real-World Applications
Automatic Street Lighting
Municipal street lights use LDRs to detect dusk and dawn, switching lights on/off without timers. The simplicity and low cost of an LDR makes it ideal when exact lux values don’t matter — only “dark enough to turn on.”
Limitations
- Non-linear response: Resistance vs. lux is logarithmic; precise light measurement requires calibration curves.
- Slow decay: Fall time (~30 ms) is too slow for optical encoders or data communication.
- Cadmium (RoHS): CdS is restricted in the EU; use silicon photodiodes for new products.
- Spectral bias: Peaks at green; poor sensitivity to IR and UV.