A Light Dependent Resistor (LDR), also known as a photoresistor, is a passive electronic component whose resistance changes based on the intensity of light it is exposed to. The resistance of an LDR decreases with increasing incident light intensity; conversely, it increases as the light intensity decreases. This characteristic makes LDRs suitable for light sensing applications, such as light meters, clock radios, night lights, outdoor clocks, and security systems.
LDRs are two-terminal devices and do not have a polarity, meaning they can be connected in any direction in a circuit.
Pin | Description |
---|---|
1 | Photoresistive layer (can be connected to Vcc) |
2 | Conductive substrate (can be connected to ground) |
To use an LDR in a circuit, it is commonly placed in series with a resistor to form a voltage divider. This setup allows the measurement of voltage changes across the LDR as the light intensity varies.
Vcc ----/\/\/\-----| LDR |----- GND
R1 Photoresistor
In this circuit, R1
is a fixed resistor, and the LDR is the photoresistor. The voltage at the junction between R1
and the LDR can be measured and will vary with light intensity.
The following example demonstrates how to use an LDR with an Arduino UNO to measure light intensity.
int ldrPin = A0; // LDR connected to analog pin A0
int ldrValue = 0; // Variable to store LDR value
void setup() {
Serial.begin(9600); // Start serial communication at 9600 baud
}
void loop() {
ldrValue = analogRead(ldrPin); // Read the value from the LDR
Serial.println(ldrValue); // Print the LDR value to the serial monitor
delay(500); // Wait for half a second before reading again
}
In this code, the LDR is connected to the analog pin A0 of the Arduino. The analogRead
function reads the voltage across the LDR, which is then printed to the serial monitor.
Q: Can I use an LDR to measure the exact intensity of light? A: LDRs are not precision devices and are best suited for detecting changes in light levels rather than measuring exact intensities.
Q: How do I choose the value of the fixed resistor in the voltage divider? A: The fixed resistor value (R1) should be chosen based on the expected range of light levels. A common approach is to select R1 to be approximately equal to the resistance of the LDR at the midpoint of the expected light range.
Q: Are LDRs sensitive to all types of light? A: LDRs are most sensitive to visible light, with peak sensitivity typically around green light (560 nm). Their sensitivity decreases for wavelengths outside of the visible spectrum.