Using an LED as a photodiode

I haven't started playing with this yet (to be honest I'm struggling with the concept!) but I was wondering if anyone else had tried using LEDs as photodiodes?

The video here blew me away and I'm sure there's a million uses if I get it working...


Soory for the double post and not searching the site thoroughly in the first place (possibly a little too excited!)


I had read both pages previously as well. The second link you gave is useful information, but as it warns, it takes a long time to sense lower light levels.

I was disappointed to see "more info soon" on the guy's page, because I wanted to see

(1) how he sensed 64 samples so fast,

(2) whether he's using a RED-ONLY matrix and timeslicing, or he's using the green leds as his sensors,

(3) whether the reds are ensuring a minimum light level to bounce off the fingers, or just cosmetic,

(4) whether the lights can be used as information displays at the same time,

(5) the whole Processing sketch to do the very intuitive and catchy bar chart in real time.

I have just been doing some work with this and find you can get much better response if you connect the cathode end to an analogue input port. That way you don't have to wait until the LED is fully discharged. I have used 6 LEDs on the 6 A/D ports. I have two versions one talking back to Processing and the other detecting a touch and turning the LED dim or bright. It depends on what sort of LED you have, best are red with clear packaging and surface mounted.

Next up I want to see if an LED matrix can be made to work. I will post the results when I have finished.

I'm away from my Arduino for a couple of days :'( so look forward to getting going!

I was just thinking about using the analogue read instead of waiting for a digital 0...



Any chance of posting your code for me to have a look at?

Thanks in advance,


Next up I want to see if an LED matrix can be made to work. I will post the results when I have finished.

Several folks have been starting to use cheaper 74HS595 three-state multiplexers for matrix outputs, but if you're depending on analog feedback, I'd guess you can't use digital demux coming back. I wonder what the schematic must be, to digital mux output and analog demux back from the matrix.

Eventually, my RGB matrix package will be on my doorstep, so I can start to play with these.

Well I have not had very good results in driving a matrix. I used a 5 x 7 LED matrix (because i had one and it fitted the Arduino with no extra electronics). I used the analogue read at the start of a discharge time and then again at the end to detect how far the charge has fallen in x milli seconds. Problem is that while I get a response to columns and rows being covered up I can't isolate a single LED. That is as I cover one led up at a time in a row the whole row gets smaller (less light) until it is all covered up. The same goes for columns so there is not something silly going on. I have tried all sorts of combinations of reading, charging and illuminating but to no avail.

It might be that light leaks from on cell to the other in the matrix I have because it is potted in translucent resin.

I always used to tell my students that negative results were just as important as positive ones and so they are but they are not as pleasing. Is it worth posting a failure to save other people wasting their time? I do have it going with individual LEDs and I have some processing code for the matrix display.

Grumpy, of course it’s worth posting. With photos to show the transparent-potted matrix (which seems different from the common Chinese model, white potted with black top), and your home-made matrix.

Do you wire your matrix with common anode rows, similar to packaged matrices? Do you get different results if you put paper strips between rows of independent LEDs? One other guess I made when watching the original video: do you illuminate all neighbors to the row you’re reading?

If that’s the case, it would seem neighbor rows and neighbor columns would also see some dimming. If the farthest LED in the same row sees the same dimming values as the nearest LED in the same row, it would seem like an electrical phenomenon, not a photon problem?

Hi, I'm doing some experiments here, not quite yet with a matrix. I was wondering if Mike (or someone) could post his 6 LEDs on the analog port code (and schematic). Or at least one led as a sensor using the analog inputs. I haven't been able to make it work. I'm a newbie. Thanks in advance.

It's here:-