View Full Version : PhotoTransistor vs CdS for ambient light measurement with Propellor

03-23-2012, 08:11 PM
I seem to remember somewhere a discussion of measuring ambient light using a Propellor. Charge a capacitor and watch it discharge through a resistance which varies with light. There was, if I remember correctly, a reason to use a phototransistor rather than a CdS photo resistor. If some kind soul would reply with a pointer to that thread, I would be forever grateful. tc

03-23-2012, 08:15 PM
CdS sensors are hard to get hold of. Cadmium is very toxic and their use has been banned in many countries.

Phil Pilgrim (PhiPi)
03-23-2012, 08:23 PM
For accurate ambient light measurement, I would recommend one of these devices over either a CdS or phototransistor:


The devices integrate a photodiode and op-amp, which give much more repeatable results over temperature, and they're easy to use with both BASIC Stamps and Propellers.


Duane Degn
03-23-2012, 08:23 PM
The latest version of "Robotics with the BOE-Bot" uses a photo transistor for light sensing. The earlier version uses a CdS photo resistor.

As Leon said, the CdS aren't ROHS compliant. I think this is the main reason for the switch.

Duane C. Johnson
03-24-2012, 04:36 AM
I would not use either of these.

I use LEDs as photo sensors.

LEDs act as current sources developing a few uA of current depending on the intensity of the light on it.


1. The Prop first discharges the capacitor to 0V by setting the pin to an output and driving it low. Usually a few mS or so depending on the value of the capacitor.

2. Set the Prop pin to an input an start counting the time it takes to read a "1" on the pin.

The rate the voltage builds is quite linear depending on the intensity.

This basic concept works even better using the Sigma Delta AtoD method described elsewhere.

Duane J

Peter Jakacki
03-24-2012, 08:49 AM
Good one Duane, I noticed earlier that nobody had mentioned the obvious as I have always used clear green LEDs as light sensors, sometimes in photovoltaic mode but the current mode suits the Prop better.

Duane C. Johnson
03-24-2012, 12:32 PM
Hi Pete;

I have always used clear green LEDs as light sensors, sometimes in photovoltaic mode but the current mode suits the Prop better

Yes, LEDs are basically PV cells with exotic semiconductor materials which have the ability to produce much more voltage than silicon.

But, to be technical about it, the developed voltage is independent of the applied light intensity, assuming the meter has infinite input resistance. The voltage is basically dependent on the color of the photons to which the semiconductor is sensitive and independent of the intensity.

OK, OK, we don't have perfect meters as they do consume a bit of current and there is some leakage current in the LED itself, or any other Photovoltaic device. which limits the voltage reading. The problem is this voltage is not particularly proportional to the applied light intensity.

Current mode is directly dependent on the applied light intensity. The more photons captured the higher the resultant current. In the circuit I posted the capacitor charging rate is directly proportional to this light intensity.

As a practical mater, it's helpful that the visible colored LED sensor can develop develop more voltage than silicon (0.55V) so one doesn't need an OpAmp in the circuit to get the voltage high enough to hit the trip point of the Prop pin.

Ya, I like LEDs as light sensors.

Duane J

Duane Degn
03-24-2012, 01:50 PM

Do you have a circuit that would let the LED also be used to emit light?

I think it would be cool to have a dual use LED that acts as both input and output.

03-24-2012, 01:51 PM
PV cells can be loosely modelled as a photon-flux controlled current source in parallel with the diode - the forward-voltage v current curve is what sets the no-load output voltage, in other words a very roughly logarithmic response. A red LED will respond to most of the spectrum, a green LED only to the green/blue/violet end.

Duane C. Johnson
03-24-2012, 03:00 PM
Hi Duane;

Yes, it can be used both as a sensor and an LED.
Of course, not at the same time. %^)

In the circuit published make the resister divider using lower values and offset enough to allow the 3.3V high on the pin able to cause forward conduction through the LED.

If you use a blue LED, which is capable of generating a bit more than 2V, with the cathode grounded and series resister to the pin is the simplest.


Duane J