LEDs as light sensor inputs

Paix

Senior Member
Has anyone any direct experience of using LEDs as light sensors using PICAXE chips connected to an ADC input?

Has anyone managed to use such LEDs as both input and output devices in an interleaved fashion, so that the input level is able to determine some facet of the output level, possibly via PWM?

This seems to be gaining traction in the Atmel/Arduino camp and I am becoming curiouser and curiouser.
 

Paix

Senior Member
Thanks Ibenson, more food for thought and play.

http://www.youtube.com/watch?v=h5n0rw8wo14
http://www.youtube.com/watch?v=vzWEgOt3xsM
grhmaustin has a number of YouTube videos covering his development of light table modules.

He starts off with opamps and uses IR proximity illumination and detection sensors which are separate from the display illumination. An interesting progression as he develops his ideas..

All too rich for me at the moment, as I wish to investigate the LED sensor/detector scenario and Wilf_nv's fireflies look like a good starting point to understand, adapt and grow on. Then I'll look for an application . . . toys are a good first target too.
 

chipwich

Member
I just posted a nightlight which uses the LED for both sensing and flashing. Details at: http://corticalcafe.com/picaxe_simple_nightlight.html .

Btw, in my experience, the LED readings changed when the serial cable was connected, which led to some confusion at first. It also makes finding and hardcoding a threshold for light sensitivity very difficult. I got around this by keeping track of both min/max values, and then setting the threshold to 25% of the range in between them. This also accommodates changes in the light environment.

Also, you'll find that some LEDs are much better than others, so be prepared to try some different colors, and stay away from more complex ones, and white.

What do you mean that the LED could sense it's own output? Laser diodes use a separate photodiode to sense output power and provide feedback. But I don't see how you could use just a single diode to perform both input and output simultaneously.
 

Paix

Senior Member
Thanks Geoytex, I saw the White Paper earlier but hurried by a little. I will read it a little closer, but it doesn't seem to lend itself to a significant number of sensors due to the component count.

Chipwich said:
What do you mean that the LED could sense it's own output? Laser diodes use a separate photodiode to sense output power and provide feedback. But I don't see how you could use just a single diode to perform both input and output simultaneously.
Did I actually say that . . . seemingly I was very close. I meant that the environment could be sensed at the same time/alternating with periods of illumination , but failed to express myself clearly; sorry!

More a case of sequentially being an input or output device in a manner that appears to be simultaneous to the viewer/user. The depletion layer of the LED PN junction can be charged and will act as a very small capacitor. The discharge time can be measured giving an indication of the capacitance magnitude and by extrapolation the amount of the charge on the junction. This magnitude could then be used to pwm the diode and so mimic the degree of illumination to some degree. Not the effect that we are actually using, but another possibility I guess, but would necessitate the use of opamps etc, become very complicated and not want to scale well for nefarious arrays of wizardry that someone will doubtless wish to introduce. I just dream about these things :)

Varicap/varactor diodes use the same reverse biased PN junction, depletion layer capacitance to good effect. Like all specialised diodes, the junction is tailored to the task. In the same way that a 1N4001 rectifier diode is a poor man's varicap diode, then our LED is being recognised as a potentially economic light sensor.

You will have to forgive me the fractional precision nature of my description, but I believe that I am somewhere close if not exactly in the target zone :)

Good picture at the bottoml

Chipwich, I will digest your link in the light of day tomorrow as it is a bit late here and good lads should be inspecting eyelids from the inside about now.

The advice regarding the connection of the serial cable is probably invaluable and possibly also indicates that using another chip to drive multiple LED/sensors could be less than plain sailing. I appreciate the variable mileage from different types of LED and again take from your experience of establishing a light sensitivity threshold.

I imagine that white LEDs are enhanced with phosphors in the envelope that attenuate light in the reverse direction due to their presence.
 
Last edited:

Flenser

Senior Member
I've used a single LED as both a light sensor and as a light output on an AVR micro using the approach described in this excellent paper http://www.merl.com/papers/docs/TR2003-35.pdf

It makes this important comment "The LED is a photodiode that is sensitive to light at and above the wavelength at which it emits (barring any filtering effects of a colored plastic package)."

The implications of this are:
- A waterclear LED will be much more sensitive than a coloured plastic LED because the coloured plastic simply filters out all the light except for just that colour.
- If you are shining light on a waterclear LED then a red LED should be more sensitive than a green LED because a greater proportion of the light will be above the LEDs emitting wavelength. This was what I saw when I tried to use a waterclear green LED.

I've not tried to do it with a PICAXE (before now).
 
Last edited:
Top