Your Mouse Is A Terrible Webcam

camera

It should come as no surprise your optical mouse contains a very tiny, very low resolution camera. [Franci] decided to take apart one of his old mice and turn that tiny optical sensor into a webcam.

Inside [Franci]‘s Logitech RX 250 is an ADNS-5020 optical sensor. This three wire SPI device stuffed into an 8-pin package is a 15×15 pixel grayscale image sensor. [Franci] started this project by bringing out the Arduino and Ethernet shield. After soldering a pull-up resistor to the image sensor’s reset pin, connecting the rest of the circuit was as simple as soldering a few wires to the Arduino.

The Arduino sketch sends the image data for each pixel to a computer over a serial connection. A bit of javascript and a touch of HTML takes this pixel data and turns it into a webpage with a live view of whatever is directly under [Franci]‘s mouse.

Video of the mousewebcam in action below.

Comments

  1. ScottishCaptain says:

    Um… ok?

    So he’s using an Arduino with an ethernet shield… But he has to run a daemon on his computer *anyways*, then open a web browser and connect to localhost:8888 to get an image that seems to have an effective frame rate of 0.5fps?

    Is this some kind of Arduino thing?

    “Let’s do stuff in the most convoluted way humanly possible”?

    • mh says:

      I think that is very common for any off-the-shelf option. I always prefer write-ups that disassociates the “hack” part from the choice of MCU/platform as much as possible. But nevertheles, this still shows what one could do with a mouse-cam, leaving room for
      your imagination to make it into something usefull. convoluted setup or not.

    • Fungus says:

      The article says he’s sending the image over the Serial line. The fact that the Arduino has an Ethernet shield on it only means he was too lazy to take it off for the video.

    • Tim says:

      I did a similar hack of this (in color :p) with direct display, and the framerate isn’t any better. If this is using one of the typical ADNS-xxxx mouse sensors, raw pixel-grabbing is done via a crude debug feature on the chip – it can only read out one pixel per frame.

  2. mh says:

    That is pretty cute somehow. I can imagine there could be use for (ultra-)lowres cams in plenty of hacks. Perhaps a cheap source for the robot hobbyist crowd. Not all cams are meant for the human eye after all (just like this mouse originally). Though admittedly, higher resolution webcams are probably as cheap/available as mice.

  3. David says:

    Wow. Very English. Much grammar.

  4. Andrew says:

    It’s been done before AND better. http://spritesmods.com/?art=mouseeye

    • ColdTurkey says:

      I agree. And by a HAD contributor no less! Also, I’m struggling to see the point of using an arduino here. It just seems to me that it’s being used as an overly expensive serial port. Couldn’t this just directly interface to serial from the chip in the same way Sprite_tm did?

    • tekkieneet says:

      The chip Sprite_tm used only need 2 I/O lines. One *could* use use modem
      handshake lines as I/O for bit-banging assuming that there is no timing
      constraints on the signals. I made a serial port to I2C dongle that way
      with a couple of transistors and a few resistors.

      These days, you can get USB to serial dongles/cables/chips at TTL signal
      level and you should be able to interface to the sensor directly.

  5. vonskippy says:

    Interesting background music…

  6. bkubicek says:

    the new part here is the ip connectivity. Otherwise look in the archives.

  7. W Lowry says:

    Hmmm… It doesn’t seem so useless to me, my first thought would be to use something like this to check for defects, say in something like chain, or wire – some continuous process. Though I’m betting with that frame rate, you’d be ordering a real part pretty quick. What useful things could one do with this?

  8. jpa says:

    These sensors might be useful as motion encoders on robots etc.

    But it seems that Avago has stopped manufacturing them, and I haven’t been able to find any other optical mouse sensor that can be bought as a chip and comes with a datasheet.

    • andres says:

      the old apple optical mice have nice sensors on them. direct quadrature x and y axis output, i prefered it because i could hook them up to an interrupt pin and know exactly when the sensor had moved a certain distance.

  9. w says:

    I just thought of the perfect application for this: use it as an absolute or relative position indicator for a milling machine or lathe. Print out a strip of material with a very fine-pitch binary count pattern on it and place the camera over it and have the software read the binary pattern off the strip.

    This could be pretty accurate if one uses sub-pixel intensity analysis. Doesn’t need to be run at a high frame rate either, 5FPS would be enough for sure.
    With a binary count pattern you can simply read off the number right in front of the camera and you know your absolue position down to a fraction of a millimeter.

    Probably would have high enough resolution for a cheap hobbyist-level mill or lathe.

    • juno says:

      Tried that, it’s cumbersome and under-performing. Use a TCD1201: large frame-rate (100s of measurements per second) and accuracy down to ~20µm. Use a transparent binary encoded strip.

    • W Lowry says:

      That’s brilliant. I wonder if a simple greyscale gradient would work? If so, I bet a square would work well for slow moving robots where you wanted to know “real” X & Y coordinates. Just mount it on a pantagraph like mechanism…

  10. Similar sensors are used in drones for optical flow guidance systems. Even with the low resolution, they work pretty well for obstacle avoidance and holding positions. One of the interesting things about these sensors is that they have very high framerates — 1000+ fps — when accessed via their low-level interfaces.

  11. Echoes says:

    There’s a typo in the first sentence (now->no)

  12. Jehu says:

    Would love to see this done with a DVD read sensor and to have control over the focusing solenoids.

  13. jimmy_pop says:

    This type of hacks are very interesting, I love the idea of using parts from computer scrap because these things are widely available. I keep a big box full of ball mice at home because I was using their optical sensors and wheels to build small robots. I started collecting optical mice now but they are still useful so people don’t get rid of them so often as they did when they transitioned from mechanical to optical.

  14. aztraph says:

    i wonder if you could use a high resolution, or even a hd camera as the sensor for the mouse, then hold it up and use it as a camera again?

  15. jimmy_pop says:

    Has anyone considered the possibility to combine a hack like this with Anoto paper to achieve absolute positioning? The Anoto pens have a camera which reads dot patterns printed on paper to guess the exact position of the pen.

    A good starting point is http://freedot.sourceforge.net/

  16. wieland says:

    The interesting thing about these sensors are not their resolution (neither spatial nor color), but their very low cost combined with absurdly high frame rates of up to 4000 FPS (high-end gaming mice) and still low data rates (1000 FPS – about 120 kb/s, most are 16×16 pixel and 4 bit grayscale or less).

  17. zibri says:

    Wasn’t this already done like 6 years ago? Old news!

  18. Lister says:

    Hmmm, infrared image sensor… Would this work as a cheap thermal imager?

  19. would someone be able to create an android app that uses the camera on the back of the phone and connects via bluetooth to act as an optical mouse (complete with touchscreen buttons and scroll wheel)? there’s a lot of situations (mainly CAD modeling) where I’ve found myself desperately in need of a physical three button mouse. (you’d likely need to make some kind of separate lens, though, to get it to track the table)

  20. INB4 NSA conspiracy comment.

  21. sbrk says:

    Hackaday has turned to recycling old articles. This “news” about the ADNS hackability was out about 6 years ago, I think? Friend of mine did a Mac program that read out the pixel data and put it up on the screen back then.

    Oh, wait, you mean they hooked it up to an Arduino? Ok then, stop the presses!

    • Tim says:

      Waaah. If “someone somewhere did it before” were a reason not to do/publish something, this would be a pretty short site (and most of us would be out of jobs…)

      He never claims to be the first. The fun part here is it’s streaming images from underneath the mouse over the internet. He happens to be doing it locally, but he could just as easily be checking in on it while on vacation in another country.

      With a bit of effort making the electronics and the host software easier to hide, this could be a neat little corporate espionage trick. “Ah, you use your mouse on whatever document is lying on your desk because it works better?”

  22. jj says:

    since its a grey scale image, you could use this in a robot to follow a line on the ground. when it loses its path, aka senses different scale it could readjust maybe even using multiple mouse eyes, like a spider ^^.
    large corps use a similar system to deliver mail by robot to peoples desk and they move along a piece of tape on top or underneath the carpet. albeit a lot more complex but same principle.

  23. S Kamel says:

    can’t a lens be attached as such to get a useful image?

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 96,311 other followers