Bi-Directional LEDs

As a glutton for punishment, I find it is best to keep as many irons in the fire in terms of micro-electronic projects as possible.

My latest fascination is with the bi-directional properties of light emitting diodes. From reading a few dry papers on using LEDs as inputs, I have found there are at least two ways of accomplishing this. First an LED by itself will generate a tiny DC voltage when exposed to a light source of the same or higher frequency of the LED. I think of this as photovoltaic operation. Any high-impedance voltmeter can measure this voltage, and it ranges based on intensity from 0 to 1.5 volts. The other, and perhaps more useful method, is using the LED as a light dependent capacitor. By reverse biasing the LED, a charge is placed on the junction. This charge is then dissipated by the LED’s photovoltaic properties once the reverse bias is removed.

So, using a microcontroller, I have been able to take advantage of this knowledge to create a simple ‘interactive interface’ with a pair of LEDs. The process works like this:

Breadboard setup: 2 LEDs, 2 current limiting resistors in series with the LEDs. LED anodes are connected to bi-directional digital I/O pins on the mcu. LED cathodes are connected to bi-directional digital/analog I/O pins on the mcu.

Step 1> Forward bias the led array (all LEDs lit). This entails setting the anode connected IO lines to output a HIGH logic state (current source) and the cathode connected pins to output a LOW logic state (current sink).

Step 2> Reverse bias the first led in the array. I accomplish this by switching the rolls of the anode and cathode pins. Anode = sink, Cathode = source. This charges the capacitance of the led up to a logic HIGH potential (+5v).

Step 3> Switch the cathode connected pin into a high-z input mode and connect it to the microcontrollers ADC.

Step 4> Perform an analog to digital conversion on the LED, reading the voltage potential stored in the LED. I’ve obtained values around 3.3 volts while the led is “dark” and as low as 0.9 volts while the led is brightly lit by the rest of the array via a mirror. Using a red laser pointer fully discharges the LED resulting in a 0 volt sample.

Step 5> Forward bias the LED again, switching the cathode connected pin back into a digital output of a logic LOW state.

Step 6> Repeat steps 2 through 6 for remaining LEDs in the array

Step 7> Dump ADC results to the serial port for analysis by the host PC.

On paper, this sounds like a lot of work, but thanks to the mighty Microchip PIC microcontroller, it’s really just a series of setting bitwise registers on the PIC and reading the ADC results.

I want to try connecting an op-amp inline with the ADC sampling to try to increase the response time of the led… right now I’m using a 1ms analog sample time, which is causing a slight flicker in my array. If I can halve that it should eliminate any flicker. The problem with a faster sample time is I loose dynamic range or “brightness sensitivity”. I believe this is due to the fact the LED does not discharge fast enough.

A forum member on the linear1 forum recommended I place a resistor across the LED to speed up this discharge. It is certainly worth trying, and simpler than wiring in an op-amp!

Stay tuned…

10 Replies to “Bi-Directional LEDs”

  1. The diode technically creates a current proportional to the power of the light it is receiving.

    Also the “speed” of your circuit is related to the capacitance in the diodes. Smaller diodes have less capacitance that leads to a smaller RC time constant and faster discharges.

  2. Sorry for the double post, but I wanted to add the that the ‘change in capacitance’ you are seeing is also from the current being generated by the LEDs. The diode (which contains some capacitance as mentioned before) cannot discharge as quickly with extra current being created.

  3. like this is so old. in the matter of technology. I remember that I had a old player, that plays the big round things, vintage. Any way it had same type of control for all of its butons. And the thing is like 25 years old.

  4. well sure it’s old … Mimms guy wrote about it in the 70s … although I honestly doubt your record player used the bidirectional nature of LEDs as some sort of button, it’s just not reliable as a mass production real world interface.

  5. Hey,

    I’ve just been reading up on your LED as sensors posts which is really really cool. I started off by reading this research article (http://www.merl.com/reports/docs/TR2003-35.pdf) explaining the basics. One thing I noticed was that they don’t really mention that they’re using an ADC they just suggest you can use any I/O pins, which was one of my first issues, as I know you encountered, since many PICs only have a few if any ADC inputs. In the demo ckt they show they are using the pic12c509 which has no ADC inputs!! So that leaves me to think they must be using some more clever way to utilize all I/O pins? I havent read all of your logs but have you investigated that? Possibly using a simple interrupt to detect when the voltage is a logic ‘0’ input and use that to indicate the LED capacitance has discharged? Just some thoughts. I’d love to hear what you think. I havent really had a chance to investigate myself. Just curious. Thanks!!!

  6. Jeremy,

    You don’t need to use ADC … however, using ADC gives you a second dimension to your data. Not only can sense location, you can sense distance. I use the ADC to read the state of charge of the led junction. You can also do this with a digital input pin, by timing how long it takes for the charge to decay. For me, programming the ADC routines was easier than writing a precision timing loop.

    It’s been a few years since I’ve read the MERL work, but I’m guessing the used one of the 509’s schmitt-trigger inputs to read the state of the LED. From the 509 datasheet, the ST input buffer recognizes 0 to 0.15v as a “low” and 0.85 to Vdd as a “high”. A good red led will generate about 1 volt when illuminated by another red led at close range.

Leave a Reply

Your email address will not be published. Required fields are marked *