Shop OBEX P1 Docs P2 Docs Learn Events
PhotoTransistor vs CdS for ambient light measurement with Propellor — Parallax Forums

PhotoTransistor vs CdS for ambient light measurement with Propellor

tomcrawfordtomcrawford Posts: 1,129
edited 2012-03-24 08:00 in Propeller 1
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

Comments

  • LeonLeon Posts: 7,620
    edited 2012-03-23 13:15
    CdS sensors are hard to get hold of. Cadmium is very toxic and their use has been banned in many countries.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-03-23 13:23
    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.

    -Phil
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-03-23 13:23
    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. JohnsonDuane C. Johnson Posts: 955
    edited 2012-03-23 21:36
    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.

    LightSensor.png


    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
    135 x 189 - 2K
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-03-24 01:49
    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. JohnsonDuane C. Johnson Posts: 955
    edited 2012-03-24 05:32
    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 DegnDuane Degn Posts: 10,588
    edited 2012-03-24 06:50
    Duane,

    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.
  • Mark_TMark_T Posts: 1,981
    edited 2012-03-24 06:51
    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. JohnsonDuane C. Johnson Posts: 955
    edited 2012-03-24 08:00
    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.

    LightSensor2.png


    Duane J
    271 x 161 - 3K
Sign In or Register to comment.