registered authors login here For more on PMWiki, see pmwiki.org |
Report by Guy Lee, last update 4/30/06 In the project LED Touch Sensing by Jeff Han, I saw a magic happen on a LED matrix. That LED matrix not only lighted but also sensedthe touch of fingers. At first, I thought there should be some secret behind and the LED matrix he used must be a special one. After discussing and simple trial with Tom Igoe, I found that any LED could be used as photdiode! Actually, the LED, as its name (Light Emitting Diode) implies, is electrically a diode and can be used as a detection device similar to a photodiode. But there are some restrictions: Rule
Related links 1. Using LED as photodiode I am also working on touch panel simultaneously as an input device for my project daPass. However, I prefer to use LED which can be both input and output device for my project if I can conquer hopefully. Below is the test I did: [test 1] I used porta.0 for a LED analog-in and portb.7 for another LED output. ![]() ![]() Check video here: video1 (800k, avi), video2 (500k, avi), video3 (serial data display, 500k, avi). [schematic] ![]() The test is doing when I cover the poarta.0 LED dark enough (seria data value <= 2), tehn the LED on portb.7 will be triggered to light up. Porta.0 LED is reversed by its pins to get negative voltage. Below is my code: [PicBasic code] DEFINE OSC 4 TRISA = %11111111 ADCON1 = %10000010 tx var portc.6 rx var portc.7 n9600 con 16468 adcVar var word main adcin 0, adcVar serout2 tx, n9600, [DEC adcVar, 13] if adcVar<=2 then high portb.7 else low portb.7 endif pause 100 goto main [test 2] In this step, I used 2x2 LED matrix as photodiodes matrix with row-column-scanning. But it didnt work very well. The Leds didn't work separately. Only when did I cover all 4 LEDs that serial numbers started declining from 3. ![]() In video1(200k, mpg), it shows how the relationship is between LED-matrix and portb.7 LED. Portb.7 LED lights up when I use coverlet on LED matrix. Video2(250k, mpg) shows that how serial changes accomanpying with covering the LEDs. Here is my schematic: ![]() DEFINE OSC 4 TRISA = %11111111 TrisB = %00000000 TRISC = %10000000 TRISD = %00000000 ADCON1 = %10000010 rows var byte cols var byte bArray var portb dArray var portd tx var portc.6 rx var portc.7 n9600 con 16468 adcVar VAR byte main 'LEDs are sensing for cols = 0 to 1 bArray.0[cols] = 1 portd=%11111111 for rows = 0 to 1 dArray.0[rows] = 0 pause 10 adcin rows, adcVar[rows] serout2 tx, n9600, ["adcVar[",DEC cols,44,DEC rows,"]= ",DEC adcVar[rows],10,13] if adcVar <=2 then high portb.7 pause 100 low portb.7 endif dArray.0[rows] = 1 next 'bArray.0[cols] = 0 next goto main Questions
|