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.
Does the mouse camera do infrared? I mean I can’t see a reason a mouse would need an infrared filter?
It is typically using IR illumination, so IR-pass filter reduced background stray light.
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.
Mouse typically use infrared illumination, so IR-pass filter reduces ambient stray light.
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?
I’m not an expert, but I think the requirement of a visible-light filter is negligable, since the mouse is on the table and external light doesn’t really reach it…
It tends to be luck of the draw whether a particular sensor chip provides access to the raw bitmap through it’s SPI interface, as opposed to just position
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.
At least ADNS2700 allows reading image data over USB: https://stackoverflow.com/questions/23229083/acquiring-images-from-a-usb-mouse-single-chip-adns-2700-via-pyusb
But I don’t see where INT 33H comes into play, that sounds from a totally different era than camera-based optical mice :)
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.
Pre USB is 1995, pre win3.1is 1992. Optical mice didnt use camera sensors before 1998 Avago H2000, US Patent 5,729,008 filled in 1996. Interview with inventor: Oral History of Travis Blalock https://www.youtube.com/watch?v=wmqa9XJED-Q
“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.
Thanks for the memory prod, Paul!
I thought that hack sounded decades-old familiar!
Obligatory sprites mods.
Basics covered.
https://spritesmods.com/?art=mouseeye
And the associated hackaday flashback: https://hackaday.com/2006/01/07/optical-mouse-based-scanner/
OMG, someone needs to go in there and fix up all the old posts from 2006!
Haha Hackaday was hotlinking images from engadget :]
At that point, Hackaday was still part of Engadget.
Tom Nardi says:
>At that point, Hackaday was still part of Engadget.
Wasnt the sale one year earlier in 2005?
“Weblogs Inc was sold to AOL for a reported $25 million in October 2005.”
https://hackaday.com/2010/07/12/a-letter-from-jason-calicanis-the-owner-of-hack-a-day/
” When we sold Weblogs Inc, the parent company of Engadget, Hackaday and 100 other blogs to AOL I pulled Hackaday out of the deal at the last-minute.”
Common mouse optical sensor with selected lens would be nice movement sensor…
Put it aiming ceiling – ta ta
People have done this for awhile….
It’s a mouscroscope !
Nice work there.
WCH ships MCUs with half-duplex SPI/UART.
Its blu-ray laser microscope project seems to be even more interesting!