Photocells are sensors that allow you to detect light. They are small, inexpensive, low-power, easy to use and don't wear out. For that reason they often appear in toys, gadgets and appliances. They are often referred to as CdS cells (they are made of Cadmium-Sulfide), light-dependent resistors (LDR), and photoresistors.
Photocells are basically a resistor that changes its resistive value (in ohms Ω) depending on how much light is shining onto the squiggly face. They are very low cost, easy to get in many sizes and specifications, but are very innacurate. Each photocell sensor will act a little differently than the other, even if they are from the same batch. The variations can be really large, 50% or higher! For this reason, they shouldn't be used to try to determine precise light levels in lux or millicandela. Instead, you can expect to only be able to determine basic light changes.
For most light-sentsitive applications like "is it light or dark out", "is there something in front of the sensor (that would block light)", "is there something interrupting a laser beam" (break-beam sensors), or "which of multiple sensors has the most light hitting it", photocells can be a good choice!
Some Basic Stats
These stats are for the photocell in the Adafruit shop which is very much like the PDV-P8001
. Nearly all photocells will have slightly different specifications, although they all pretty much work the same. If there's a datasheet, you'll want to refer to it
- Size: Round, 5mm (0.2") diameter. (Other photocells can get up to 12mm/0.4" diameter!)
- Price: $1.00 at the Adafruit shop
- Resistance range: 200KΩ (dark) to 10KΩ (10 lux brightness)
- Sensitivity range: CdS cells respond to light between 400nm (violet) and 600nm (orange) wavelengths, peaking at about 520nm (green).
- Power supply: pretty much anything up to 100V, uses less than 1mA of current on average (depends on power supply voltage)
- Datasheet and another Datasheet
- Two application notes on using and selecting photocells where nearly all of these graphs are taken from
This guide was first published on Jul 29, 2012. It was last
updated on Jul 29, 2012.
This page (Overview) was last updated on Dec 26, 2017.
Problems you may encounter with multiple sensors
If, when adding more sensors, you find that the readings are inconsistent, this indicates that the sensors are interfering with each other when switching the analog reading circuit from one pin to the other. You can fix this by doing two delayed readings and tossing out the first one.
See this post for more information