Photocell tutorial! by adafruit
Featured
cds_LRG.jpg
LDR.jpg
cdsconstruction.gif

Photocells a.k.a CdS cells, photoresistors, LDR (light dependent resistor)...

What is a photocell?

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 are often referred to a CdS cells (they are made of Cadmium-Sulfide), light-dependent resistors (LDR), and photoresistors.

A Photocell is 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 inaccurate. 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-sensitive 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 11mm/0.4" diameter!)
  • Price $1.50 at the Adafruit shop
  • Resistance range: 200K ohm (dark) to 10K ohm (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
 
Remove these adsRemove these ads by Signing Up

Step 1: How to measure light using a photocell

graph.gif
cdsspectrum.gif
IlluminanceTable.png

As we've said, a photocell's resistance changes as the face is exposed to more light. When it's dark, the sensor looks like an large resistor up to 10M ohms, as the light level increases, the resistance goes down. This graph indicates approximately the resistance of the sensor at different light levels. Remember each photocell will be a little different so use this as a guide only!

(See Resistance Vs. Illumination graph below)
Note that the graph is not linear, its a log-log graph!

Photocells, particularly the common CdS cells that you're likely to find, are not sensitive to all light. In particular they tend to be sensitive to light between 700nm (red) and 500nm (green) light.

Basically, blue light wont be nearly as effective at triggering the sensor as green/yellow light!

What the heck is lux?

Most datasheets use lux to indicate the resistance at certain light levels. But what is lux? It's not a method we tend to use to describe brightness so it's tough to gauge. Here is a table adapted from a Wikipedia article on the topic!
(See Illumination table below)

BookLover715 says: May 12, 2013. 11:06 AM
Is it possible to get photo sensors that are sensitive to other colors, like blue/UV or IR?
Artificial Intelligence says: Jun 17, 2009. 11:58 AM
Really nice tutorial. There is another photoresistor setup, that's worth mentioning. Instead of having a variable resistor (in this case a photoresistor) connected to the positive and a fixed resistor connected to ground, you could use two photoresistors (schematic shown below). this is called a differential light sensor. This setup can be used to measure the difference between the two sensors with one analog input. If the two sensors are exposed to the same amount of light, the readout on the ADC pin should be around 512, if the microcontroller has a 10 bit resolution. If the photoresistor connected to ground is exposed to more light than the other one, the analog voltage would drop, and if the photoresistor connected to positive is exposed to more light, the voltage would rise.
Artificial Intelligence says: Jun 17, 2009. 12:01 PM
Sorry. The schematic, I uploaded somehow couldn't be added to the comment.
Chowmix12 says: Jan 27, 2011. 6:38 PM
If both light sensors were receives bright light (low resistance) wouldn't there be a short circuit?
diy_bloke says: Jan 6, 2012. 7:45 PM
I don't think they wld go all the way to 0, but you cld include 2 equal resistors in series with each LDR
ReCreate says: Jun 17, 2009. 10:02 AM
that is why they call it photoresistors...I always thought that they either went ON or OFF...
drock267 says: Jun 11, 2009. 6:30 PM
Great 'ible. I just finished my senior project using photoresistors to make an interactive LED table. It also involved some PLC programming for the I/O behaviors. I am entered in a competition tomorrow against my fellow graduating classmates. Here's hoping I win some $$ and get an interview or ten. I learned a great deal about photo cells from personal research and this 'ible explains it pretty clear.
alessiof76 says: Jun 11, 2009. 1:40 PM
good tutorial!
Did you know that the LED can be used as a photocell?
25 mV with 60 W of lighting small green led
i test it: http://www.youtube.com/watch?v=L3-0aCJOedo (only in italian sorry)
balam says: Jun 11, 2009. 7:43 AM
Thank you for this tutorial very informative
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!