Initial report by Diane Thomas 09 Oct 2005

(definition from Wikipedia) A photoresistor is an electronic component whose resistance decreases with increasing incident light intensity. It can also be called a light-dependent resistor (LDR), or photoconductor.

Physical changes (wikipedia) A photoresistor is made of a high-resistance semiconductor. If light falling on the device is of high enough frequency, photons absorbed by the semiconductor give bound electrons enough energy to jump into the conduction band. The resulting free electron (and its hole partner) conduct electricity, thereby lowering resistance.

So--lots of light = lots of conductivity: less light = less conductivity.

The photocell variable resistor on hand in the shop (jameco part no. 120299 (?) (vary from 0-100k.) Data shows the response and decay time varies a little between them. (All are available through Jameco electronics.)

CDS Photocell

  • Applications include: auto-focus lenses, exposure meters, contrast controls for TVs, dimmer or light switches, flame detectors, electronic toys, street lamp switches, optocouplers
  • Generate variable signal based on detection of light levels
  • Operating temperature: -30 degreeC to +70 degreeC
  • Cadmium Sulfide (CDS)
  • Soldering: 230 degreeC for 3 seconds Rating 350Vp, 400mW
  • Resistance: 1M ohms (dark); 12k ohms (light)
  • Size: 0.37" x 0.43"
  • Lead Spacing: 0.30"
  • Lead Length: 1.44"


The data sheet assumes tungsten light source (color temp. 2856k), so I'm assuming a the graph demonstrates a gradual or subtitle light change. The graph measures voltage after incident light after 10 seconds. (that's a pretty long time) The pic appears to return values closer to .5 sec after event.

Typical Behavior There is a note about "light history conditions" (...cells exposed to light (100 to 500 lux) for one to two hours. --do the cells respond to "training"? -- test reflect an evening out of response to laser beam. test was twice terminated early due to waning laser power.

(Because I will be focusing a pen point laser light on the cell to trigger change in resistance values, i expect to have to experiment with different pull-down resistor values to get the broadest range of values reading from pin.)

Pin Descriptions / Microcontroller Connections There are only 2 leads on the photocell: one to the pic (porta.0) and power. And a resister to ground and photocell pin to even out resistance values.

Testing for optimal pull-down resistor value: Serial data (DEC)

x ohm/ ambient light/ completely covered
10 ohm /1021 / 1021
27 ohm / 979 / 835
220 ohm /155 / 40
1k ohm / 470 / 155
10k ohm /916 / 710

The 1k ohm yields the best range for the shop photocell. (the model # for photocell on hand in shop-?/ Jameco offers a small variety of resistor values in the photocell family.--not printed on device)

Application: Thru-Beam Sensor The photocell paired with a pointer laser makes a thru-beam sensor. The Thru-beam can be use to detect if a body has crossed into an area; a passing body interrupts the laser beam aimed at the photocell and the light intensity drops (resistance value of the photocell increases). The micro-controller is programmed to trigger an event when input from the photocell drops below a determined value.

That "a body has crossed a line" is not enough information to know if as event should be triggered: in a public space, most people will pass through and be on their way in less time than it takes to initiate an event.

In order to know (or come somewhere near knowing) if a person is lingering inside site boundaries a specific area needs to be isolated: possible path-ways a person might travel must be plotted; time (t) it takes a typical person to enter and exit the site (if they do not mean to stop) must to be estimated.

Code Sample

'set photocell pin for input
'if photocell goes low, trigger the relays
' make test LED HIGH if resistance drops (trigger event -- make array calculations)

'This is the initial test code for the Though-beam sensor.
'3 things--:
'1) photocell seems to acclimate to the intensity of the laser, 
' electron activity falls off some.*see light history 'note above.  
' intitial evaluation of "700 in DEC" would have to be lowered.
'2) lasers bout in ChinaTown have a very short life span--10 minutes. (tried two types)
'3) evaluating laser consistency burns out eye balls.

define ADC_CLOCK 3
define ADC_BITS 10
define osc 4

ADCvar var word
PCell var porta.0
TestBlink var portc.4
output testblink
ADCON1 = %10000010
TRISA = %11111111
Tx var portc.6

high testblink 'testblink 2 times --stop
pause 200
low testblink
pause 200
high testblink
pause 200
low testblink
pause 200

pcell = adcvar
adcin 0, adcvar
serout2 tx, 16468,["adcvar = ", dec adcvar, 10,13]
pause 200
if adcvar > 700 then 'if photocell light is blocked and voltage drops-
high testblink 'test light goes HIGH if beam is broken
low testblink
goto main 'keep reading Pcell pin

Application Notes

(I will continue with Though-beam in order to set up "tandem beams" to get directional data about activity in the area. Pairs of beams will have to trigger A-B or B-A, (east to west or west to east, for example). Combined with a D-C / C-D tandem beams installed at opposite end of pathway; and including a counter in code, should give useful information about the nature of foot traffic in a site.)
(There are a number of packaged photoelectric sensors could be employed towards the same program design. I will choose the least expensive with a range of at least 3 meters to keep installation consistent.

An alternative to the through-beam would be video tracking: detecting change---moments of less change-- as incidents to trigger an event.)

Questions: A photoelectric device can be either intrinsic or extrinsic. In intrinsic devices, the only available electrons are in the valence band, and hence the photon must have enough energy to excite the electron across the entire bandgap. Extrinsic devices have impurities added, which have a ground state energy closer to the conduction band - since the electrons don't have as far to jump, lower energy photons (i.e. longer wavelengths and lower frequencies) are sufficient to trigger the device.

Is the Jameco photocell intrinsic or extrinsic? Would one fit this application better than the other? -