[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.
38 thoughts on “Input Device Using LED And Four Photoresistors”
I presume you’re hosting the code for ‘posterity’.
Wow. Dude needs to sell that to hospitals.
a successful, flourishing, or thriving condition, esp. in financial respects; good fortune.
prosperities, prosperous circumstances.
succeeding or future generations collectively: Judgment of this age must be left to posterity.
all descendants of one person: His fortune was gradually dissipated by his posterity.
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.
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.
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)
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.
0:10 – “Blue LED.. Obviously”
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 :)
Very nice hack (cheap and simple)
It works. But it doesn’t look like the control loop is very tight or precise.
Please people – when you make a video of your project, do us a favor and invest in a tripod.
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 :)
Can anyone think of a reason he would have mounted the photoresistors at the corners instead of up/down/left/right config :S
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:
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:
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.
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.
would adding the NSEW positions allow more precision, or would that be relatively pointless?
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.
“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.
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?
You would probably want to use a source outside the visible range anyway simply so it’s not (perceptibly) shining at the operator.
Yaaay! I like this one.
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.
after watching the video.. i’m not so sure they have dollar tree in france, or french quebec or wherever they speak french
dollar tree being for buying a cheap tripod, since i don’t see that comment
Very nice build Julien. This would be the ultimate mouse controller for someone like Howie Mandel who is afraid to touch things :)
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!
@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 :)
Beau travail, Julien ! Le génie français à l’œuvre, hahaha !
@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.
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?
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.
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)
In 3 types of packages:
Lead-type same as CdS cell
@APerson: oops… fixed.
–> 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
–> Calibrate the intensity response of the diodes
–> Perform continuous, intermittent,
re-calibration during operation
–> Post the results once it works ;-)
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
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.
Link to the local hosted code is broken as of 12/28/11
pastebin still works.
so much for posterity :-)
Please be kind and respectful to help make the comments section excellent. (Comment Policy)