Input device using LED and four photoresistors

[Julien] built an input device that uses reflected light detected by some photoresistors. Placing your hand above the device will reflect light from the LED back down onto the cadmium-sulfide sensors. The resistance of those sensors is read by four ADC pins on a Teensy microcontroller and translated to mouse movements. In the video after the break you can see that this works rather well in controlling the cursor. The source code is available on pastebin but we’re also going to host the code for posterity.

[Thanks Patrick]

Comments

  1. RodgerTheGreat says:

    I presume you’re hosting the code for ‘posterity’.

  2. kevin says:

    Wow. Dude needs to sell that to hospitals.

  3. APerson says:

    from dictionary.com:
    prosperity:
    1.
    a successful, flourishing, or thriving condition, esp. in financial respects; good fortune.
    2.
    prosperities, prosperous circumstances.

    posterity:
    1.
    succeeding or future generations collectively: Judgment of this age must be left to posterity.
    2.
    all descendants of one person: His fortune was gradually dissipated by his posterity.

    /grammartroll

    this seems like it could be used for a lot of other very sleek input solutions with a little modification. tack a bit of frosted glass over it and maybe do it in IR you can fairly easily make a poor man’s trackpad.

  4. Per Jensen says:

    I would rather have done it with 4 LED’s, since LED’s can be used for sensors too, and they are faster than CDS cells too.

  5. projectbluebook says:

    hm.. interesting hack.
    this got me thinking, why not use a wheatstone bridge setup, and save on uc pins? all that is needed is a pseudosine wave (PWM) and this will work on a cheaper micro with more free pins for other functions.

    another worthwhile hack is to replace the sensors with infrared LEDs drilled and filled with ZnS glow in the dark compound to add dual functionality as both indicator and sensor.
    (ZnS flashes when exposed to IR light)

  6. Brennan says:

    Nice proof of concept but this is hardly very precise or responsive enough to be used in almost any situation. It wouldn’t be precise enough compared to a mouse or touchpad or nub, so high-precision applications are out. And it wouldn’t even be good enough for basic tasks like navigating a web browser. But like I said, it’s a really clever idea and pretty cool execution. I agree with the above poster that he should have used IR and IR sensors so it doesn’t blind you to use.

  7. Frenchie says:

    0:10 – “Blue LED.. Obviously”

  8. svofski says:

    This is very interesting. Something like this could be converted into a really cheap touchscreen implementation. But I’m not sure about the details yet :)

  9. Very nice hack (cheap and simple)

  10. fluidic says:

    It works. But it doesn’t look like the control loop is very tight or precise.

  11. J. Peterson says:

    Please people – when you make a video of your project, do us a favor and invest in a tripod.

  12. Julien says:

    Hey :)

    I’m the creator of this prototype.

    Just a few notes:
    – This project was made using only the few components I had in my room, while I was waiting for a bunch of new components (among which some IR emitter/receivers) to arrive by mail.
    – This is just a proof of concept, that was never intended for any practical use.
    – It has no practical use, since nobody wants to stay all day long with one hand in the air…
    – It’s fast to build, it’s fast to code, and it’s fun to do.

    About the video:
    – It was made in French and with a crappy quality since it was only intended for a friend.
    – I never thought more than 2 or 3 people would ever see it, else I would have made it in English, and with a way better quality.
    – I didn’t keep the prototype, and re-used its components a few days later. So I won’t make a new and better video, since I’m lazy to build it again.

    If anybody makes a better version (and I’m sure some of you will), using IR lights or other variations, post the video as a reply to this one :)

  13. TomN says:

    Can anyone think of a reason he would have mounted the photoresistors at the corners instead of up/down/left/right config :S

  14. Julien says:

    Yes, there is a reason:
    Each photoresistor is used both for up-down and left-right detection;
    By having the 4 photoresistors at each corners, I have 2 horizontal and 2 vertical detectors:

    1 2

    3 4

    To detect the up-down movement, I use both [1;3] and [2;4].
    To detect the left-right movement, I use both [1;2] and [3;4].

    With the config you’re suggesting it would be like this:

    1
    2 3
    4

    To detect up-down I would be able to use only [1;4] and to detect left-right [2;3], which would be less precise.

  15. Cory Borrow says:

    That is quite interesting, IR’s would have been better just for the fact the don’t blind you but not as visual on the video.

  16. draeath says:

    would adding the NSEW positions allow more precision, or would that be relatively pointless?

  17. Fallen says:

    Couldn’t this be done with 3 CdS cells instead of 4? In a triangle around the LED? I’d imagine it would make the math a little more hairy though.

    Cool proof of concept though.

  18. fluidic says:

    “It has no practical use, since nobody wants to stay all day long with one hand in the air”

    I wouldn’t say that. It does need some refinement – it’s a prototype, so that’s hardly surprising. But imagine building this into a laptop keyboard, or a public kiosk, or a terminal in a hospital.

    Not that this approach is the only way to get this result…but the hands-free approach is well suited to a number of applications, even if it’s not about to replace everyone’s mouse.

  19. Whatnot says:

    Problem here seems that your hand is an irregular surface causing errors that need smoothing out.
    But you could use it with a flat square above it to make it more precise if you needed a contactless tilt indicator for something, although unfortunately I can’t think of such a situation right now :)
    Although.. it would work through a window, made from glass or armored glass/plactic, if you use something transparent to IR but not visible light it could also be made covert, maybe that has a use? Secret entrance handshake maybe?

  20. fluidic says:

    @Whatnot

    You would probably want to use a source outside the visible range anyway simply so it’s not (perceptibly) shining at the operator.

  21. Patrick says:

    Yaaay! I like this one.

  22. Anonymouses says:

    Keep in mind that due to the banned substance lists, that cadmium sulfide photosensors are an absolute no-no in ANY commmercial application.

    This means, solar cell LED garden lights and everything else.

    Just an FYI as I have not seen these used in a while. They were a good technology in things like self dimming mirrors 20 years ago, but they are banned now in commercial apps.

  23. jeditalian says:

    after watching the video.. i’m not so sure they have dollar tree in france, or french quebec or wherever they speak french

  24. jeditalian says:

    dollar tree being for buying a cheap tripod, since i don’t see that comment

  25. jAMES says:

    Very nice build Julien. This would be the ultimate mouse controller for someone like Howie Mandel who is afraid to touch things :)

  26. neato says:

    I love this idea. It may have no immediate practical uses but it’s clever, simple and above all cheap. Plus, I’m sure it was fun to create. Let’s have some more of these type of projects, they don’t all have to solve real-world problems to be interesting or inspiring.

    Thanks for sharing this Hack A Day!

  27. James says:

    @jeditalian – well done for spotting a slightly wobbly vid, but missing both the first complaint about it being wobbly AND the author’s statement that it was never meant for public consumption :)

  28. Philippe says:

    Beau travail, Julien ! Le génie français à l’œuvre, hahaha !

  29. Julien says:

    @Anonymouses: Why are photoresistors still sold if their’s banned from commercial applications?
    I bought these in February 2010 on an american website.

    But anyway, you could replace them with IR receptors, and it would probably be more stable, since there would be less ambient interferences to compensate for.

  30. KC8RWR says:

    Nice! Very creative! I’m going to have to add this to my list of things to try… eventually…

    @Anonymouses – But is it banned anywhere outside of the EU?

  31. kevin mcguigan says:

    i would like to say that anyone that sends a hack to hackaday and it gets posted is truly someone who has worked hard to make something no one else has or has improved upon an idea already out there, and to all of you that tear down and criticize the post should keep your comments to yourself. if you are so smart, then improve upon the hack and submit it yourself.

  32. walt says:

    genius!

  33. Whatnot says:

    You can get cadmium free photosensitive elements now like the AMS104Y.
    From the AMS104Y datasheet:

    Built-in optical filter for spectral response similar to the human eye

    Photocurrent is proportional to illumination (linear output)

    Lead-free

    In 3 types of packages:
    SMD
    Lead-type same as CdS cell
    Chip (miniature)

  34. Mike Szczys says:

    @APerson: oops… fixed.

  35. Ulrich Lukas says:

    –> Use a high frequency modulated light source
    to make the rig insensitive to ambient light
    (DC and 50, 60, 100, 120 Hz components)

    –> Use IR (same reason, plus it’s not so blinding)

    –> Use photodiondes because of the faster
    frequency response

    –> Calibrate the intensity response of the diodes

    –> Perform continuous, intermittent,
    re-calibration during operation

    –> Post the results once it works ;-)

  36. Panikos says:

    Make a VR room. Embed a bunch of this on the walls and something (accelerometers) to track movement of legs arms etc, combine inputs and you have the whole body as an input device

  37. Vivi Fizgig says:

    I saw this from the Teensy page and was hoping it was the grid of LEDs that sense position somehow by themselves. Anyone got that link? It seems a logical Teensy project.

  38. MauiMaker says:

    Link to the local hosted code is broken as of 12/28/11
    pastebin still works.
    so much for posterity :-)

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

Follow

Get every new post delivered to your Inbox.

Join 97,512 other followers