Using an LED to illuminate and Sense Light at the same time.
TonyA
Posts: 226
Hi,
I found this stuff on the web recently and found it very interesting. This paper describes using an ordinary LED to emit light and act as a light sensor all at the same time. Since an LED is a photodiode.
I thought this would make a cool inexpensive sensor alternative. They also describe using an LED for serial data communication. From what I understand Forest Mims described this stuff back in th 70's.
It involves just adding an LED between two pins and switching each pin high and low to alternately emit light and sense light. Then I am assuming you can use RCTIME to measure the time it takes for the capacitance to discharge (the capacitance of the LED itself not an external cap).
Has anyone done this? I was wondering if anyone could comment on what I think the code would like like for this.
HIGH 1 ' if the cathode of LED in series with a resistor to pin 2, anode to pin 1; emits light
LOW 2
PAUSE x
HIGH 2 ' same connections as above, now acting to sense light
LOW 1
RCTIME 2, 1, result ' measuring the time it takes for discharge
DEBUG result
PAUSE x
Would this be right?
Here are the links:
The Paper:
http://www.merl.com/reports/docs/TR2003-35.pdf
http://mrl.nyu.edu/~jhan/ledtouch/index.html
http://laser.physics.sunysb.edu/~tanya/report2/
http://www.sensorsynergy.com/helpfulhints.htm
I found this stuff on the web recently and found it very interesting. This paper describes using an ordinary LED to emit light and act as a light sensor all at the same time. Since an LED is a photodiode.
I thought this would make a cool inexpensive sensor alternative. They also describe using an LED for serial data communication. From what I understand Forest Mims described this stuff back in th 70's.
It involves just adding an LED between two pins and switching each pin high and low to alternately emit light and sense light. Then I am assuming you can use RCTIME to measure the time it takes for the capacitance to discharge (the capacitance of the LED itself not an external cap).
Has anyone done this? I was wondering if anyone could comment on what I think the code would like like for this.
HIGH 1 ' if the cathode of LED in series with a resistor to pin 2, anode to pin 1; emits light
LOW 2
PAUSE x
HIGH 2 ' same connections as above, now acting to sense light
LOW 1
RCTIME 2, 1, result ' measuring the time it takes for discharge
DEBUG result
PAUSE x
Would this be right?
Here are the links:
The Paper:
http://www.merl.com/reports/docs/TR2003-35.pdf
http://mrl.nyu.edu/~jhan/ledtouch/index.html
http://laser.physics.sunysb.edu/~tanya/report2/
http://www.sensorsynergy.com/helpfulhints.htm
Comments
material elements are used, you can force certain properties to be emphasized. Thus the variety of LED's,Photo
sensors, Transistors etc. that are available.
All I can suggest it to try it and see... what I think you might encounter, is that the reverse PN capacitance is going
to be very small which means it will require a very fast processor to produce any meaningful results. The SX would
be a better candidate for something like this.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
I was thinking about just using it as an on/off switch. Light = off, no light = on.
Thanks,
Tony A
Two leds, or one with a photo-transistor, or photo-resistor would work better.
With a photo-transistor, the reflection of light from the led could provide the signal to stamp to turn on or off room lights.
With a photo-resistor, you could set how the room lights are turned on by amount of light reflected back from led.
It could also be a neat dimmer switch, or a visual theramin...
Bob N9LVU
If you would like to pursue the one LED option, I would try a circuit similar to what is
below as a TEST circuit to get a baseline of what values you are dealing with. If you
use a known value inductor (20uH or so), you should be able to calculate the capacitor
value based on the resulting frequency on a Scope.
f = 1/ [noparse][[/noparse] 2 * pi * sqrt( L * C ) ]
or
C = [noparse][[/noparse] 1 / ( F * 2 * pi ) ] ^2 / L
f = Hertz
L = henries
C = farads
Reference:
http://en.wikipedia.org/wiki/Tank_circuit
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
www.parallax.com/dl/docs/books/edu/AppliedSensors1_3.pdf
You could add a small capacitor in parallel in order to make the result more stable. LEDs have relatively small junctions, and the input capacitance of the SX pin (~10pf) and your circuit connection will add to that.
RCTIME will be satisfactory in relatively bright light. E.g., full sunlight (~100klux) but it will be harder in a brightly lighted room (~2klux), and next to impossible in a dimly lighted room or as a communication link. The reason is, in photodiode mode (with reverse voltage across the diode), there is leakage current, even in the dark. (Aptly called the "dark current", which is strongly dependent on temperature and the reverse bias voltage). When the light is low, it is hard to sort out the dark current from the increase in current actually due to the light.
Detection of low light levels calls for a transconductance amplifier, with feedback around an op-amp to amplify the diode current while keeping the voltage across it at zero. This is sometimes calles "solar cell mode". Some of the communication links make use of a chopped signal and sophisticated AC signal techniques, like lock-in amplifiers. It really gets dicey when you require both high speed and high sensitivity.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Thanks for this info. What I did was this:
Main:
DO
HIGH 1 'blink LED
LOW 2
PAUSE 1
HIGH 2 'sense light
LOW 1
PULSIN 2, 1, pulse
DEBUG HOME
DEBUG "pulse = ", DEC pulse, " ", CR
IF pulse = 0 THEN 'turn on another LED if light on sensor is blocked
HIGH 3
ELSE
LOW 3
ENDIF
LOOP
END
I decided to use PULSIN because for some reason RCTIME didn't work.
I have a small orange LED (without any resistor) connected between pins 1 and 2. The cathode of the LED in on pin 2.
I have a larger red LED that lights up when I block the sensor LED with my finger. This red LED has a series resistor connected to its cathode (220 Ohms) going to ground.
Would the capacitor in parallel still work here? Can anyone could offer suggestions on how to make it work faster?
Thanks again,
TOny A
I tried it, and had good luck with the following code snippet. I do think RCTIME is the proper command to use with this. However, you will see that I have extended it so that it can measure longer time intervals, out to over 10 seconds. The current in these LEDs is quite low, ~ 1 nanoamp in room light, so the interval can exceed one RCTIME unit.
I take back what I said about not being able to measure low room light levels. It is actually quite sensitive. I forgot that LEDs tend to have a very low reverse leakage current and a sharp zener knee. The reverse current of the green LED I am using for this was around 1 microamp in full sunlight, 100 nanoamps in very bright room light (up against a flourescent fixture), and less than 1 nanoamp in relatively low room light (70 lux).
Your led really should have a resistor in series, 220 ohms or so, if you are going to blink it from a Stamp pin. The resistor will have no effect on the measurement function.
Also, your result will depend a lot on how you have the LED mounted. Because of the capacitance. If you want the fastest possible response, mount it right on a Stamp pin. In constrast, don't mount it on one of those white breadboard thingies as on the BOE, because they have quite a bit of extra capacitance between the pins. If you want to do the opposite, and slow down the response, and increase the sensitivity, and experiment, then do mount it on a white protoboard, and add a small capacitor in parallel with the sensor, say 100 picofarad.
By the way, thanks for the reference links--Those are very interesting.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Post Edited (Tracy Allen) : 2/13/2006 3:07:01 AM GMT
By the way, if you have seen the LED array here http://mrl.nyu.edu/~jhan/ledtouch/index.html
I was wondering if the other LEDs are acting as the light source since there seems to be no light in the room on this video clip. So with an LED array, you have each acting as sensor and light source for surrounding LEDs?
Tony A.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
This might be a little off topic, but it is a sensor question I thought might be of interest here.
I'm looking into making my own FSR's (force sensing resistor strips), however something more like a linear pot. I acquired one from a company awhile back and took it apart recently. I noticed it had one layer of what looked like graphite printed on one side of a plastic strip. I am learning that this is called "resistive ink" and that it is screen printed onto a substrate which can be anything, vinyl, glass, etc. The other piece of vinly is coated with a conductive metal, I think silver. Each piece (conductor and resistor layer) is sandwiched together and it's edges glued. There are very small bumps which seem also to be printed onto the resistive ink layer to keep the conductor strip from making contact with the resistor when the two parts are sandwiched together, and allowing for contact only when you press down on the conductor strip.
I made a crude version of this by painting a piece of paper with something called "Electrodag", which is used to shield the inside of electric guitar cavaties and prevent noise from being picked up by the guitar electronics, etc. Then a piece of aluminum foil placed on top of the dried graphite paint. I got a variable kOhm reading as I move my finger across the length of aluminum foil.
(I saw stuff like this in some of the Forest Mims books too.)
Wondering if there are materials out there (that anyone can buy), like vinyl sheets with this resistive ink already printed on, or if anyone can offer alternatives to this resistive material. I see suppliers of things like the graphite paint and graphite sheets. The resistance of the graphite sheet is too low, something like 600 micoOhms per inch of material, maybe you can double it up, etc.
I'm searching for alternative materials to make some of this things myself. By the way this might be of some interest to people here: Pressure activated conductive rubber, in sheets or you can cure your own to make your own shapes with a mold:
http://www.irmicrolink.com/Pressure_activated_Conductive_rubber.html
I was thinking I could use this "pressure activated conductive rubber" and sandwich it onto a piece of vinyl with resistive ink printed on it and create the touch activated linear pot.
Was wondering if anyone might be able to suggest what could be used for the "resistor" part? (Painting the graphite paint onto a piece of vinyl will work, but I have found the dried graphite paint to become very brittle. Also, maintaining uniformity would be hard.)
Thanks for any ideas, insight or feedback.
Tony A
www.qprox.com
...might hold interesting things for you...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Truly Understand the Fundamentals and the Path will be so much easier...
The follwoing bit of information may or may not be helpful. Many potentiometers made today use a conductive plastic internally, instead or a carbon or wire element. I suppose one might make inquiry of one of the larger manufacturers of potentiometers to find where the get these conductive sheets of plastic from which they punch these resistance "discs".
What is it you are actually trying to accomplish, or what is the real world application? There may be other methods or alternatives to what you are trying to do or for providing the method for what you are trying to sense.
As just an aside, and perhaps not useful to you here, but the anti-static black foam "sponge" in which DIP IC's are sometimes packed, has an easily measurable and reasonably linear resistance curve when compresssed or crushed. I have been meaning to experiment with that material for quite some time.
Another area which might well be in consideration here, depending on your exact needs, is the both the voltage generating potential, and transducer/actuator characteristics of piezoelectric (P-E) elements which can be configured in almost any shape or size you can imagine. I had a real good web site which discussed much of this, along with scads of rather unusual P-E applications, and I'll see if I can find the link, if you show any further interest in this area. P-E is alot broader an area than most folks realize.
I suspect you are aware that Parallax does sell the flexible resistor elements as force sensors, right on thier web site, here:
http://www.parallax.com/detail.asp?product_id=30056
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
<!--StartFragment -->
Thanks for the info. I'd like to make the touch sensitive linear pot for use with electronic musical instruments, midi controllers. Instead of using a regular rotary pot. This would be a "ribbon controller" type thing seen on midi controllers and keyboards. I have used commercially purchased linear touch pots made by some companies. I have paid from $50.00 - $100 for 2" X 10", and was recently quoted $100.00 for a linear pot strip that was 1" X 5". After seeing how they're made, using cheap components and very simple technology I thought I'd try to make my own. I was able to make a crude example using paper, graphite paint and aluminum foil, but now I'm looking for the material to improve it.
They use "resistive ink" which from what I have been reading is either graphite, or graphite mixed with silver (or some other metal). The "Electrodag" worked well, but I'm looking for something that has already been deposited on a substrate (like vinyl sheets already coated with this "resistive ink"). I'm just looking for a more convenient material rather than painting a piece of paper with graphite paint.
I've also been reading that they use a piezoresistive polymer for the force sensitive resistors. So I guess that's piezo crystal's mixed with rubber/plastic.
Thanks again for the references and info, I appreciate it.
Tony A.
Post Edited (TonyA) : 2/14/2006 3:43:14 PM GMT
I would like to apologize for my "it can't be done easily" attitude. Last week I had a chance to meet Tracy Allen and he showed me a simple setup that he
had for this concept. I must say that I was slightly surprised with what I saw. It shows much more promise than I had anticipated.
....Line follower type sensors, bump sensors (<-whisker replacement), ....buttons?!! ... etc.
Anyway.... Cool!!
BTW) Green LED's seem to be more sensitive than some of the others.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Yeah, I was amazed by the simplicity of this. I love simple things, and things that light up. Tracy explained some of the code above and he said that it was very sensitive to light, and able to detect low light levels.
Tony A
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Sid
Click on the link in Tony's original post or mine just above, to nyu media lab, and look at the movie they made.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
These are normal LED matrices, not specific 'special' touch-sensitive parts... (if I'm understanding you correctly...)
Rick