Light Pen Draws on LED Matrix

dot-matrix01

Who needs a 1920×1080 OLED display when you can have an 8×8 matrix of LED goodness? That’s the question [Kathy] asked when she built this LED matrix light pen project. It looks simple enough – a 64-LED matrix illuminates as the pen draws shapes. But how does the circuit know which LED is under the pen? Good old fashioned matrix scanning is the answer. Only one LED is lit up at any time.

[Kathy] used a pair of 74LS138 3-to-8 line decoders to scan the matrix. The active low outputs on the ’138 would be perfect for a common cathode matrix. Of course [Kathy] only had a common anode matrix, so 8 PNP transistors were pressed into service as inverters.

The pen itself is a phototransistor. [Kathy] originally tried a CdS photoresistor, but found it was a bit too slow for matrix scanning. An LM358 op-amp is used to get the signal up to a reasonable level for an Arduino Uno to detect.

The result is impressive for such a simple design. We’d love to see someone use this platform as the start of an epic snake game.

Comments

  1. I think the next cool iteration of this would be to use the LED pixels as photodiodes, allowing the then LED-tipped pen to be completely independent of the matrix!

  2. egzola says:

    awesome !!

  3. I thought a matrix has 16 pins – 8 for the cathodes and 8 for the anodes. Why were inverters needed?

  4. akaki says:

    I wonder if you could instead use the LEDs in the matrix as photodiodes. Between frames, turn off the matrix, turn on a red LED in the tip of the pen, and go through each row and column with an amp to see who is seeing the most light.

    I can’t image how to wire it, and if the LEDs-turned-photodiodes would respond fast enough, but it would eliminate the problem of all the “off” LEDs on the display having to emit a little light.

    • Pat says:

      There are a lot of downsides to that. You need an amp for every LED, and then a discriminator as well so you could try to multiplex it. You couldn’t do it digitally because the ambient light in the room would change the threshold level.

      The ‘off’ LEDs can be made to be emitting arbitrarily tiny amounts of light, really, by just scanning faster.

      • anon says:

        “You couldn’t do it digitally because the ambient light in the room would change the threshold level.”

        You could sample all the LEDs that aren’t lit and use their average as a reference so the threshold changes based on ambient light.

        • Pat says:

          Right, which is a lot more work. Here she’s just using an op-amp as an open-loop comparator, with a single potentiometer, which is fine because you’re putting a fair amount of light out.

          You could have that adjust to ambient light as well, of course, by sampling the light sensor’s output when you have no LED lit, and setting the threshold based on that. But you need to do the scanning fast, and adding any ADCs, etc. will take time.

      • akaki says:

        Ah, exactly what I was thinking of.

    • tekkieneet says:

      The physical connection would be like this: http://www.cs.cmu.edu/~ehayashi/projects/lasercommand/
      >The most interesting part in this game is that the game uses a laser pointer as a two-dimensional input device in conjunction with a matrix LED.

      If you need to detect the difference in ambient light (vs a laser), you would need something more sensitive that detect minute changes in electrical charge instead of being lazy with ADC. Typically you are going to measure the time for the logic threshold for diode photo current to charge up parasitic capacitances like touch sensor application.

    • Angry Midget says:

      First off: Cool project!

      For accurate or low light level measurements you’ll want a transimpedance amp(I-V converter) for each photodiode for sure as Pat stated. With a premade matrix I don’t think that’s possible.

      In this case since you only want detection and will have a lot of light available you might be able to get away with muxing the matrix directly without too much impact from the other photodiodes, even though they behave as current sources.

      At this point you could look at the charge as tekkie described, use a transimpedance amplifier to translate the shortcircuit current to an output voltage or maybe you can even get away with just a large load resistor (The output will not be linear to the received flux, but in this case I doubt that really matters).

      I’m unsure if measuring the charge is any more accurate than sampling the output of a transimpedance amp or maybe even just a load resistor in this case.

      What are typically the benefits measuring the charge decay time? I guess you don’t need any analogue inputs as long as you can cross your logic threshold. For a capacitive sensor I guess it’s nice to be able to measure a small charge without having to worry about it decaying before you can measure it (since that is exactly what you measure), but for a photodiode that can behave as a current source, what makes this a better option than sampling whatever output with an ADC? And how reproducible would relying on parasitic capacitances and leakages for your measurment usually be? It feels kind of icky to me, but then again I’ve never done it.

  5. HV says:

    Cool project! :) To some of the folks talking about using an LED on the pen instead, do you know if (clear) LEDs working as photo-diodes are only sensitive to the wavelength they emit or if their spectral response is based on their composition or something else?

    • Chris C. says:

      I believe they’re most sensitive to their emission wavelength. But if plotted on a graph, the reception curve isn’t nearly as sharp as the emission curve, and you could theoretically pick up any visible wavelength (and IR) given enough amplification.

  6. Brian says:

    Lots of talk on here about using the LEDs as photodiodes. I still think the most impressive example of that was featured here in 2006: http://hackaday.com/2006/02/21/low-cost-sensing-and-communication-with-an-led/

    The project homepage (basically empty) is here: http://cs.nyu.edu/~jhan/ledtouch/index.html
    And a YouTube copy of the video here: https://www.youtube.com/watch?v=95LGS90BIB0

  7. supershwa says:

    Animated GIFs again?? These cause a ton of distraction on my dashboard, and are quite frankly: annoying. I turned Adblock on again…sorry guys.

  8. HV says:

    I know most people only complain, but I’ll counter and say I appreciate the animated GIFs and if you stop using them, I’ll turn on adblock. You are now break even either way you go and free to do what you want… for the time being. ;)

  9. plrderesdmancube says:

    I don’t know why everyone is using gifs in their article, but please, leave it where it belongs, in the trash(tubmlr(no offense(another paranthesis(ok, sorry that you had to read this))))

    • Indyaner says:

      I strongly disagree with his opinion. I like the GIFs. after only one loop I had a full knowledge of what this article would be about. A still standing image never can provide this kind of information-gathering. I like skimming thru here and those GIFs help me to determine if one article is worth the time of diving into it.

      • Chris C. says:

        Couldn’t have said it better. The animations haven’t been used indiscriminately, just in cases where they convey information.

      • TacticalNinja says:

        While I agree with you, this doesn’t make still-pictures any less descriptive. This just takes more bandwidth for what it’s worth when I would have read the article anyway.

  10. TeleFox says:

    For those interested in using the LED matrix as a sensor, here’s a similar project I built a few years back around the concept.
    Surprisingly reliable under real world lighting conditions, and no ADC required =D

    http://letsmakerobots.com/node/17166

  11. William DeRieux says:

    Why not use a capacitive touch-screen like film on-top of the led matrix, and then use a capacitive stylus. A micro controller would process the touch of the pen and would allow the led that was touched to change state (ie from off to on, and vice versa)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s