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.


48 thoughts on “Your Mouse Is A Terrible Webcam

  1. 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”?

    1. 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.

    2. 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. 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.

    1. bigclive just found a similar chip/cam in a 1 pound optical mouse from Poundland. I used to have the same mouse here that was A$2, so about the same cost. The cheapest, crappy webcams in those stores are $10 a pop so it all depends what level of detail you need on a project. Plus as a bonus, you get 3 micro switches and a couple of other minor parts, all for a couple of bucks

    1. 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?

    2. 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.

  3. 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?

  4. 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.

    1. 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.

  5. 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.

    1. 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.

    2. 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…

  6. 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.

  7. 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.

  8. 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).

  9. 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)

  10. 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!

    1. 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?”

  11. 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.

  12. Interesting idea: hook this up to a DVDR drive sensor and read back disk quality with it.
    Add this data to the readback so the drive can insert dummy data for data recovery purposes.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.