Shop OBEX P1 Docs P2 Docs Learn Events
LED as light emitter and light detector — Parallax Forums

LED as light emitter and light detector

virtuPICvirtuPIC Posts: 193
edited 2009-05-13 09:06 in Propeller 1
Well, the idea is not that new. You can find it on many pages related to other controllers. However, I've not found an implementation on the prop so far.

LED means Light Emitting Diode. And if you give a reverse voltage to a semiconductor diode it has a certain capacitance. Even better: The leakage current of such a diode in blocking mode depends on the light falling in. That's why switching diodes are packed into black plastic.

If you give a blocking voltage to an LED you will charge this capacitance. Now disconnect the charger and measure the time the lonely LED needs to discharge to a threshold. You get a value dependent on the light.

You can still operate the LED for light emission when you don't use it as a sensor. If you have two devices you only need two LEDs and two resistors for wireless half duplex transmission! The bad news is that this simple circuitry is rather slow in discharging the LED. I am still thinking how to accelerate it. Resistor in parallel? Lower charge voltage?

If you want to experiment you'll find a small test / demo program attached. Plug an LED and a resistor to your prop demo board, load the program and get an LED adapting its brightness to ambient illumination. It works by charging, discharging, and flashing the LED. If it gets dark the discharge time will be long enough that the LED will flicker or even blink.

It's fun to watch and enlightening!

P.S.: You could connect an LED matrix display and use it as a touch pad. Even multi-touch. But only for your private use since there is already a patent on this.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Airspace V - international hangar flying!
www.airspace-v.com/ggadgets for tools & toys
«1

Comments

  • heaterheater Posts: 3,370
    edited 2009-05-10 09:06
    Great. I never thought about the self discharge time of the LEDs internal capacitance.

    I just though, well, a LED produces voltage when exposed to light. I can measure it with my DVM. So why not use the Prop as ADC just to measure that voltage.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    For me, the past is not over yet.
  • virtuPICvirtuPIC Posts: 193
    edited 2009-05-10 09:40
    Yes, you can also measure the voltage. There's a trade-off between speed and cost. You need more than only one resistor for an ADC at the prop. You might even need active parts if the LED's inner resistance is too large. However, this approach is much faster. You can easily reach 250kbps while getting 2400 bps using the capacitive approach is already demanding.

    I just plugged a resistor of 1 MOhn to 10 MOhm in parallel to the LED and got lower resolution but higher sample rate.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Airspace V - international hangar flying!
    www.airspace-v.com/ggadgets for tools & toys
  • RaymanRayman Posts: 14,827
    edited 2009-05-10 10:21
    That's pretty interesting actually... I've never heard of this. Neat.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    My Prop Info&Apps: ·http://www.rayslogic.com/propeller/propeller.htm
  • heaterheater Posts: 3,370
    edited 2009-05-10 10:41
    Somewhere on this forum this was discussed a few months ago. Some experiments were done then. Can't find it now.

    Here is one such thread but I think it's older: http://forums.parallax.com/showthread.php?p=589699

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    For me, the past is not over yet.
  • WNedWNed Posts: 157
    edited 2009-05-10 13:00
    I got this a while back and can't remember where it's from. I have it in my Obex folder on my PC, but I don't think it that's where I got it...

    Ned

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "They may have computers, and other weapons of mass destruction." - Janet Reno
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2009-05-10 13:37
    WNed,

    If you go back, even further, Tracy Allen was doing this during the very first seminar that the Propeller was introduced to the public.

    http://forums.parallax.com/showthread.php?p=574644

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • heaterheater Posts: 3,370
    edited 2009-05-10 15:00
    So when did anyone get a patent on this earth shattering idea?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    For me, the past is not over yet.
  • SapiehaSapieha Posts: 2,964
    edited 2009-05-10 15:19
    Hi heater.

    It is stil only virtuPIC that have PASM code to that

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nothing is impossible, there are only different degrees of difficulty.
    For every stupid question there is at least one intelligent answer.
    Don't guess - ask instead.
    If you don't ask you won't know.
    If your gonna construct something, make it·as simple as·possible yet as versatile as posible.


    Sapieha
  • Cluso99Cluso99 Posts: 18,069
    edited 2009-05-10 15:45
    In the late 60's / early 70's we used to scrape the paint of transistors to make them light detectors. An OC72 transistor seems to ring a bell in this overloaded memory of mine. smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Links to other interesting threads:

    · Home of the MultiBladeProps: TriBladeProp, SixBladeProp, website (Multiple propeller pcbs)
    · Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
    · Prop Tools under Development or Completed (Index)
    · Emulators: Micros eg Altair, and Terminals eg VT100 (Index)
    · Search the Propeller forums (via Google)
    My cruising website is: ·www.bluemagic.biz·· MultiBladeProp is: www.bluemagic.biz/cluso.htm
  • heaterheater Posts: 3,370
    edited 2009-05-10 16:18
    Almost. OC71's had the black painted glass case. OC72 were in aluminium cans.

    We used to do that conversion at school.

    You can still buy OC71 herestore.triodestore.com/mullardoc71.html

    I had a devil of a job calibrating some radar equipment once, until I discovered that one of the diodes in the circuit was light sensitive. Get everything set up nicely, then close the lid, wtf it's all wrong again.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    For me, the past is not over yet.
  • Toby SeckshundToby Seckshund Posts: 2,027
    edited 2009-05-10 16:33
    Thats why they started to use the opaque blue gunk inside rather than the original clear(ish) gel. The ocp70 (I think) was 10x the price and so the didn't want the cheaper cheat th work any more.

    I remember White/blue/red spot devices
  • heaterheater Posts: 3,370
    edited 2009-05-10 16:41
    "White/blue/red spot devices"

    Oh yes. They came with my Philips Electronic Engineer kit. But that also had LDRs for light detection.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    For me, the past is not over yet.
    901 x 816 - 1M
  • virtuPICvirtuPIC Posts: 193
    edited 2009-05-10 18:09
    heater said...
    So when did anyone get a patent on this earth shattering idea?

    2005: Multi-touch sensing light emitting diode display and method for using the same

    This patent is not on the sensor itself but on how to combine many sensors to form a sensor matrix to locate a finger, stick, or whatever touching its surface. I consider this circuit almost trivial. The LED-sensor idea has been published years before. A Mitsubishi paper dates 2003. And yes, bipolar junctions are known to be slight sensors already for decades.

    You can use an LED as light sensor without any legal problem. But if you build a matrix of them you should do it different from the patent mentioned above.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Airspace V - international hangar flying!
    www.airspace-v.com/ggadgets for tools & toys
  • heaterheater Posts: 3,370
    edited 2009-05-10 18:55
    Fine example of why I think the patent system has gone insane. Assuming it was ever sane in the first place.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    For me, the past is not over yet.
  • Toby SeckshundToby Seckshund Posts: 2,027
    edited 2009-05-10 19:23
    Heater

    That was a good experimentation kit!! The lad was able to hack into the Air Traffic Control system!!

    And there was me, happy to get a cystal set going
  • heaterheater Posts: 3,370
    edited 2009-05-10 20:42
    Well it was many years after I had that kit that I got to hack on air traffic control systems. If you can count military radar as air traffic control[noparse]:)[/noparse]

    Tried building a crystal set again last year, could not get it to work. Eventually came to the conclusion that there is not much around here to receive on a.m. any more.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    For me, the past is not over yet.
  • mctriviamctrivia Posts: 3,772
    edited 2009-05-10 20:49
    that is an ingenious way to make a multi touch display. i don't think there is anything wrong with patenting the combination of simple things together in something that is not necessarily obvious like making a multi touch screen that way.

    Patenting PWM on LED to dim them I think is pushing it a little far though.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    My new unsecure propmod both 1x1 and full size arriving soon.
  • heaterheater Posts: 3,370
    edited 2009-05-10 21:57
    I recently read around the history of the steam engine. Can you believe that James Watt could not transform linear motion of a piston into rotary motion of a wheel using a normal crank? No, he had to invent all kind of weird, more complicated, more expensive and less efficient ways to do it, using sun and planet gears for example, because some other guy held a patent on the crank! The other guy didn't even build steam engines. Of course James Watt had patents of his own which he used to stop other people building engines. In this way progress was held up for a long time.

    This started me thinking patents have always been very "odd".

    Of course a lot hinges on ones interpretation of "obvious".

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    For me, the past is not over yet.
  • Cluso99Cluso99 Posts: 18,069
    edited 2009-05-11 02:21
    That EE kit was fantastic. I was about 13 when I got mine. Way after I was belted across the room from 240V smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Links to other interesting threads:

    · Home of the MultiBladeProps: TriBladeProp, SixBladeProp, website (Multiple propeller pcbs)
    · Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
    · Prop Tools under Development or Completed (Index)
    · Emulators: Micros eg Altair, and Terminals eg VT100 (Index)
    · Search the Propeller forums (via Google)
    My cruising website is: ·www.bluemagic.biz·· MultiBladeProp is: www.bluemagic.biz/cluso.htm
  • mctriviamctrivia Posts: 3,772
    edited 2009-05-11 03:08
    isn't high voltage fun. i was stupid enough to plug a transformer in backwards once and touch the wires. what should have been 12v was 1200v.

    Got zapt by 347V at work once. That hurts a lot.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    My new unsecure propmod both 1x1 and full size arriving soon.
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2009-05-11 08:59
    Jeff Han is the guy who filed the patent application that VirtuPIC mentioned, and he posted an interesting video of the sensor matrix in action posted on his NYU web site,
    cs.nyu.edu/~jhan/ledtouch/index.html
    Back up to the ~jhan directory to see other interesting interactive displays. The patent application is good reading.

    I was intrigued by the lead up in a BASIC Stamp thread[noparse][[/noparse] that came up just before the Propeller beta seminar, and that is why I was fooling around with the LED there.

    For use in half duplex communication channel I think there is no getting around the fact that the photo ("leakage") current is very small, and it becomes vanishingly small as the light intensity decreases with distance. No room for stray light! Stray capacitance of breadboards etc. should be reduced to a minumum, so that it is only the LED reverse diode capacitance that has to be charged. On the other hand, extra capacitance is needed when using the LED to measure bright sources like the sun.

    In the limit of photo current there is the temperature dependent "dark" or "saturation" current. Green gallium nitride LEDs are quite good as photo detectors in that limit, due to their high band gap voltage, higher than silicon or even gallium arsenide.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • virtuPICvirtuPIC Posts: 193
    edited 2009-05-11 18:05
    Yes Tracy, I've also seen Jeff Han's video. There are a few more on the net, some of them also very impressive. Jeff looks rather creative.

    I like the basic idea: Use an LED as a sensor, as a detector. Measuring the leakage is easy: Capacitor and resistor of the needed ADC are already integrated in the LED. You need no other hardware! If you use a phototransistor you need at least a capacitor. Okay, we could try to use the BE-capacitance... However, as I said before, this sensor is rather slow. If you use the photovoltaic effect of the LED you are much faster: www.edn.com/article/CA150821.htm claims up to 250 kpbs for half duplex transmission. But the respective circuit uses two op-amps, several passive elements and a transistor for transmission.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Airspace V - international hangar flying!
    www.airspace-v.com/ggadgets for tools & toys
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2009-05-11 21:38
    Maybe the response could be faster if it were configured as a sigma-delta integrator instead of as a RCTIME scheme. The LED integrates its current onto its own capacitance (+ strays) and the voltage is sensed by a prop input, while slugs of compensating charge are provided through a resistor from a 2nd prop pin. The pin would probably be toggled from input to output rather than high or low, because the photocurrent is unidirectional and small. The sense pin would have a low value resistor so as to double as an output for transmission.

    The EDN article uses an IR led, driven at about 35 mA. Some IR leds can be driven to large pulse powers, for example, I am working with one now, an Osram SFH4550, that can be pulsed up to a good fraction of an 1 amp and over 1000 mW per steridian in a 3 degree beam. Schemes like IrDA use short pulses for transmission, shorter than the normal bit duration. The reason is so that the flashes can be brighter for more distance, without compromising battery life.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • virtuPICvirtuPIC Posts: 193
    edited 2009-05-12 14:34
    Tracy Allen said...
    Maybe the response could be faster if it were configured as a sigma-delta integrator instead of as a RCTIME scheme. The LED integrates its current onto its own capacitance (+ strays) and the voltage is sensed by a prop input, while slugs of compensating charge are provided through a resistor from a 2nd prop pin. The pin would probably be toggled from input to output rather than high or low, because the photocurrent is unidirectional and small. The sense pin would have a low value resistor so as to double as an output for transmission.

    Well, yes: The SD integrator is a similar idea like mine to use voltage only a little over threshold to charge. Both ideas are rather demanding. Do we know the exact threshold voltage? We are dealing with a capacitance smaller than 50 pF, currents of at most a few nA, resistances of hundreds of MOhm.

    The question is the purpose of such a device. If you want to use it for data transmission you won't get it real fast. I estimate at most the magnitude of analog phone modems. In this case I would try the photoelectric generator of the EDN article. (Also with visible light LED.) Touch sensors don't need to be that fast. However, when I unplugged the LED I got a reliable capacitive touch sensor. But I want to build a illumination-controlled automatic door with photoelectric sensor for control and security with as few hardware as possible. Looks perfect for this purpose!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Airspace V - international hangar flying!
    www.airspace-v.com/ggadgets for tools & toys
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2009-05-12 16:49
    As in your program, I ran into the problem of displaying the light level on the 8 LEDs of the demoboard. Linear is okay, but it is hard to scale it due to the dynamic range of light levels. I opted to make it a vu type of logarithmic display using this spin code:

    outa := ((|< >| ratio -1) << 16) | (ledmask & outa) ' transfer log ratio to demo leds

    The ratio was in relation to an initial or calibration light level, so that the display could show 4 doublings above and below the initial value.

    As an aside, another use for green GaN leds is as feedback for logarithmic or log ratio amplifiers. (Shielded from light, of course!) Conformity to the log curve depends on current being much greater than the saturation (dark) current, and with its ~3 volt bandgap voltage, GaN can have a theoretical saturation current down in the femto-Ampere range.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • Fred HawkinsFred Hawkins Posts: 997
    edited 2009-05-12 22:54
    idle curiosity: would there be any beneficial use for a RGB led? A RGB could use either the red or blue for the light (true? or must green sense green?) and use the green for sensing?
  • RaymanRayman Posts: 14,827
    edited 2009-05-13 02:06
    I think the LEDs with the colored plastic would provide some color filtering and give some contrast.
    But, I don't think an RGB LED in clear plastic would give much contrast between the colors.· But, I could imagine maybe a little contrast due to the different bandgaps of the semiconductors involved...

    On second thought, I think the different bandgaps should let you tell something about the color of light involved.· But, the red LED would be sensitive to red, green, and blue light, green to just green and blue, and blue to just blue...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    My Prop Info&Apps: ·http://www.rayslogic.com/propeller/propeller.htm

    Post Edited (Rayman) : 5/13/2009 2:17:32 AM GMT
  • virtuPICvirtuPIC Posts: 193
    edited 2009-05-13 06:25
    LEDs are sensible at wavelengths a little shorter than those they are emitting. Basically this means green senses green. The spectra of the individual LEDs mounted into one package and sold as RGB LED are probably too disjoint that you could use one color to lit and another color to sense. Watch Jeff Han's video already mentioned here to see it works with multiple LEDs mounted in a single package.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Airspace V - international hangar flying!
    www.airspace-v.com/ggadgets for tools & toys
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2009-05-13 08:13
    Here is a pdf link to one of Forrest Mims' original articles on the subject of using LEDs as a sensor element for a sun photometer. Different LED sensitivity wavelengths probe absorption bands of atmospheric gases, for example, water vapor.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • virtuPICvirtuPIC Posts: 193
    edited 2009-05-13 09:06
    I have implemented a SPIN-only version. The PASM code you already know runs in an infinite loop writing values to some hub location. The SPIN code simply does a WAITPNE until the threshold will be passed. You could do this with the PASM code, too. But be aware of the long delays! Don't use it in cogs doing fast, time critical stuff.

    Oh, you don't find the code attached to this message. I finally did it. I started my propeller microcontroller blog where I will publish my ideas. This is the first one.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Airspace V - international hangar flying!
    www.airspace-v.com/ggadgets for tools & toys
Sign In or Register to comment.