Light dependent resistors are an easy solution for reacting to brightness changes. Let's discover their properties!
Light dependent resistors (LDRs) or photoresistors are electric components whose resistance changes with the light intensity. LDRs are easy to use and found in many hobbyist projects.
In this tutorial we will look at how LDRs work and how they can be used. To make clear that LDRs react to light they are symbolized as a resistor with two incoming light beams. The circuit symbol used in schematics is shown in the picture below. As always there is an ANSI and an IEC variant of the symbol. Additionally, there are also variations that omit the circle.
LDRs are semiconductor components and make use of an effect called photoconductivity. As explained in the background tutorial on semiconductors, the incoming photons of light can excite electrons from the valence into the conduction band and thereby increase the conductivity of the semiconductor material.
LDRs are typically made out of non-doped semiconductor material. They consist out of a thin amorphous film of cadmium sulfide (CdS) on top of a ceramic plate. This will be the type of photoresistors that we will focus on in this tutorial. There are also extrinsic photoresitors that use doped silicon or germanium. These photoresistors are primarily used to detect infrared light. It is important to note, that contrary to photodiodes and phototransistors, photoresitors don't make use of a p-n junction. Photoresitors are passive components.
The advantage of LDRs that use CdS is that their sensitivity to different wavelength of light is similar to the one of the human eye. This makes them suitable for ambient light sensing. Even if these LDRs don't use doped semiconductor material, the impurities and grain boundaries in the amorphous CdS film greatly affect their photoconductive behavior. One effect caused by this is that LDRs have a pretty slow response time in the areas of ten to several hundred milliseconds. Especially, the recovery after a change from the illuminated to the dark state needs some time. The actual response time depends on the used manufacturing process.
The resistance of LDRs varies a lot over the range of possible light intensities. Their resistance can be as high as several hundred mega ohms in the dark and as low as only a few hundred ohms in bright light. At normal lighting conditions the resistance is in the area of 10 kΩ. The resistance curve is highly non-linear. The resistance change decreases further and further with increasing intensity. This behavior is quite useful in practice, as our human reception of light intensities is non-linear too.
One thing, however, is not useful at all. As all semiconductors, LDRs react to temperature changes as well. They feature a high temperature dependence. For accurate measurements a temperature compensation has to be done. Additionally, there is also a high part variance between different LDRs. This requires a calibration of each individual sensor to make accurate measurements possible. The typical applications for LDRs do not require a high accuracy anyway, however.
A common application for LDRs are twilight switches as found in streetlights or nightlights. They were also used in alarm systems, smoke detectors and similar systems that make use of light barriers. While they are still a cheap an easy solution, they are not often used anymore. This is because they are not ROHS compliant due to the use of the heavy metal cadmium. For this reason, they are not allowed for new products and have been vastly replaced by photodiodes and phototransistors.
To make use of LDRs in a circuit one can build a simple voltage divider as shown in the circuit diagram below. At normal lighting conditions a 10 kΩ resistor for R2 does the job. For more flexibility one can also use a 100 kΩ potentiometer as varistor. The voltage divider is typically used together with an analog comparator or a simple transistor circuit. We will learn how to build such circuits is one of the upcoming tutorials. Of course, you can also connect the output of the voltage divider to an analog pin of an Arduino and use the integrated ADC to perform the measurement and react to brightness changes. We did that in the Arduino introduction series in the tutorial on analog inputs, for example.
LDRs are not suited for precise light intensity measurements due to the high part variance and temperature dependence. This is why we usually don't really care about the exact resistance curve and only use them for applications that don't require the measurement of absolute light intensity values. Nevertheless, LDRs were used in photographic light meters. Even if they are not as accurate as other sensor, they allow a far more accurate measurement of the luminosity than we would be able to do with our subjective impression. It is needless to say, that such a use case requires a calibration of the used LDR.
I would advise you to use a digital ambient light sensor for this kind of applications. These sensors make use of a photodiode or phototransistor internally and provide an output value in Lux without the requirement for complex calculations and temperature corrections. The math behind light intensity measurements is pretty complicated. For the calculation of the light intensity in Lux the intensity for different wavelengths needs to be weighted according to the sensitivity of the human eye. If the sensor response does not precisely match the sensitivity of the human eye, additional color filters to e.g. exclude UV and infrared light have to be applied and further mathematical transformations are likely necessary. Digital sensors usually do all of this for you. This makes them a good pick if you really need absolute light intensity values, once.
LDRs are not suited for data transmissions, also. This is due to their slow response time. For these applications photodiodes and phototransistors are the more appropriate choice. The IR receiver used in the Arduino introduction series is a perfect example for this. Besides additional amplification, filtering and data demodulation logic, it makes use of an IR photodiode for data reception.