A Mouse Becomes A Camera

If your pointing device is a mouse, turn it over. The chances are you’ll see a red LED light if you’re not seriously old-school and your mouse has a ball, this light serves as the illumination for a very simple camera sensor. The mouse electronics do their thing by looking for movement in the resulting image, but it should be possible to pull out the data and repurpose the sensor as a digital camera. [Doctor Volt] has a new video showing just that with the innards of a Logitech peripheral.

The mouse contains a microcontroller and the camera part, which fortunately has an SPI interface. The correct register to query the sensor information was deduced, and as if my magic, an image appeared. An M12 lens provided focus with a handy 3D printed mount, and the board went back into the mouse case as a housing. The pictures have something of the Game Boy camera about them, being low-res and monochrome, but it’s still a neat hack.

If you’d like to give it a go you can find the code in a GitHub repository. You might find it worth finding a gaming mouse though, for the much higher resolution sensor.

24 thoughts on “A Mouse Becomes A Camera

      1. I used to have a mouse which had a mechanical slide below to flip from infrared sensor, to all light.
        When the the switch was flipped, it doubled down as a camera.
        I didn’t open to check the insides but I suppose you only switch on and off the the IR filter and how the device interprets the light.
        I didn’t even know it was a camera mouse, I once discovered when I had to clean it up and saw the camera switch below.

        This is nteresting project, nonetheless, but my mouse was uselessly dumb.

    1. You can convert every CMOS camera to IR. They are all sensitiv to IR light, but you dont want that in a photo camera. Therfore they all have a IR filter in front of the sensor which can be removed.

      If these mouse sensors usually work with IR then they should have a filter for visable light in front of them. Thats just my theory. Anybody?

  1. Hehe, back in the last millennium we used Int 33H for this. No hacking needed.
    It even made a passable though slow page scanner: just cross correlate the itty bitty images as they came in, while you slowly rastered the page (or magazine photo…) with the mouse.

      1. Oh, yes. Totally pre-USB DOS/Win3.1 era. But Logitech had an optical mouse, and its driver had a subfunction in Int 33H that dumped the image array. The whole kilopixel. At 115200 bps. Still managed better than a frame per second. Like I said — slow, but fun to play with.

          1. “Pre USB is 1995”

            Technically true, but in real life USB didn’t catch on really quickly.
            USB 1.0 was considered being buggy and it was being ignored at first.
            It wasn’t until the iMac in 1998 that USB got more popular.

            Personally, I remember that here in Germany most people didn’t have heard of USB until ~2000 and Windows 98SE.

            Even past 2000, peripherals with RS-232, Centronics, Gameport and PS/2 were still being sold.

            It was also a matter of reliability. The legacy ports had better latency. USB 1.x used polling mainly, which caused high CPU usage compared to other ports.

            Anyway, USB modems were popular early on. By using USB modems, a higher data rate between PC and modem could be achieved. That was useful for compression etc.

            It also made sure the modem would never have been used with a horrible 16450 UART. It’s unbelievable how long this little devil was kept being around on PCs. Someone should think that all PCs being in use by late 90s had been upgraded with an 16550AFN at least.

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.