Here's an easy way to use an LED as a photodiode
Nick McClick
Posts: 1,003
I did a sunburn detector for the Propeller using an LED to detect UV (Mr. Burns);
Video demo
I wanted to make a sunburn alarm for a while, but when I shopped around for a UV detector, they were really expensive. If you take a regular LED and invert it (so the anode is connected to ground), it will generate a very weak voltage in response to light, but you need an op-amp circuit to amplify the voltage and you have to use an ADC or sigma delta to measure the output. I wanted something simpler.
I stumbled across this whitepaper from Mitsubishi; by reversing the LED and adding a capacitor, you can read the light detected like any other R/C decay circuit. Here's how I set it up;
Charge up the cap, and count the discharge. Here's some sample code;
The LED will be sensitive to light at a shorter wavelength than the light it emits. A green LED will sense some green and blue, but not red or yellow. The blue LED I use is sensitive from around 330nm to 400nm (at least tested with a few glass UV filters I have).
I might be discovering what everyone else already knows, but it's an easy & cheap way to read light levels with a Prop without using ADC.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Propeller Forums RSS Feed!
Gadget Gangster - Share your Electronic Projects
Video demo
I wanted to make a sunburn alarm for a while, but when I shopped around for a UV detector, they were really expensive. If you take a regular LED and invert it (so the anode is connected to ground), it will generate a very weak voltage in response to light, but you need an op-amp circuit to amplify the voltage and you have to use an ADC or sigma delta to measure the output. I wanted something simpler.
I stumbled across this whitepaper from Mitsubishi; by reversing the LED and adding a capacitor, you can read the light detected like any other R/C decay circuit. Here's how I set it up;
Charge up the cap, and count the discharge. Here's some sample code;
CON LEDpin = 7 OBJ rc: "rctime" VAR LONG lightvalue PUB readlight RC.RCTIME(LEDpin,1,@lightvalue)
The LED will be sensitive to light at a shorter wavelength than the light it emits. A green LED will sense some green and blue, but not red or yellow. The blue LED I use is sensitive from around 330nm to 400nm (at least tested with a few glass UV filters I have).
I might be discovering what everyone else already knows, but it's an easy & cheap way to read light levels with a Prop without using ADC.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Propeller Forums RSS Feed!
Gadget Gangster - Share your Electronic Projects
Comments
I may have a use for this
I wonder how a UV LED would work and what its
detection range would be? Perhaps it would work
well for UV detection without even needing a filter.
The substitution of LEDs for other kinds of detectors is not a straightforward matter. First of all, the relationship between the emission and spectral response properties of LEDs is not a simple one. Typically, the peak response wavelength is less than the peak emission wavelength. Second, because LEDs have been developed commercially for other purposes, their performance is certainly not optimized for this rather obscure research application. This means that their spectral response does not necessarily give the maximum sensitivity to changes in PW.
I use the LED as switch concept in my black box sequencer.
http://forums.parallax.com/showthread.php?p=831833