Smart Ruler Has Many Features

For those of us who remember old ball mice, they were a lot like modern optical mice except that they needed to be cleaned constantly. Having optical mice as a standard way of interacting with a computer is a major improvement over previous eras in computing. With extinction of the ball mouse, there are an uncountable number of cheap optical mice around now which are easy pickings for modern hacking, and this latest project from [Vipul] shows off some of the ways that optical mice can be repurposed by building a digital ruler.

The build seems straightforward on the surface. As the ruler is passed over a surface the device keeps track of exactly how far it has moved, making it an effective and very accurate ruler. To built it, the optical component of a mouse was scavenged and mated directly to a Raspberry Pi Zero W over USB. Originally he intended to use an ESP32 but could not get the USB interface to work. [Vipul] was then able to write some software which can read the information from the mouse’s PCB directly and translate it into human-readable form where it is displayed on a small screen. The entire device is housed in a custom 3D-printed enclosure to wrap everything up, but the build doesn’t stop there though. [Vipul] also leveraged the Bluetooth functionality of the Pi and wrote a smartphone app which can be used to control the ruler as well.

While the device does have some limitations in that it has to make contact with the object being measured across its entire length, there are some situations where we can imagine something like this being extremely useful especially when measuring things that aren’t a straight line. [Vipul] has also made all of the code for this project publicly available for those of us who might have other uses in mind for something like this. We’ve seen optical mice repurposed for all kinds of things in the past, too, including measuring travel distances in autonomous vehicles.

12 thoughts on “Smart Ruler Has Many Features

      1. The chip in the mouse doing the optical flow has a standard SPI interface that can be easily connected to a micro. Here’s an example of how to do that:

        https://hackaday.io/project/5283/log/49337-optical-flow-sensor-from-an-led-mouse

        I have an Arduino library function that interfaces to one type of optical flow chip. It’s in very readable C, so it should be easy to port to another micro, or use it as a template to interface to other chips:

        https://github.com/ToolChainGang/ArduinoLib

        https://github.com/ToolChainGang/ArduinoLib/blob/main/lib/ADNS2610.h

        1. @PWalsh said: “The chip in the mouse doing the optical flow has a standard SPI interface that can be easily connected to a micro.”

          Mouse sensors with three-wire serial (SPI) outputs are harder to find today. Almost all cheap modern optical mouse sensors will have an on-die USB interface. In that case the only way to interface the sensor with a generic ESP-32 would be to use a software USB HID interface like I cited.

          For example the ADNS-2610 8PDIP Optical Mouse Sensor you wrote your driver for is very hard to find these days. Originally the part was manufactured by Avago [1] (previously HP/Hewlett Packard), now called Broadcom. It is still possible to find the datasheet for the ADNS-2610 part, but all of the mainstream distributors list the part as obsolete.[2]

          There are other manufacturers of cheap simple SPI optical mouse sensors, but most are Chinese so it is hard to get English datasheets much less parts and the protocols can vary between manufacturers and sometimes even between sensors within a given manufacturer.

          One company based in Taiwan, PixArt (a.k.a. PXI) still makes SPI Optical Mouse Sensors with English datasheets. Some of these sensors are specialty parts with features sought after by high-end gamers. Link [3] shows a list of all PixArt’s mouse sensors. PixArt also makes sensors with on-die USB interfaces.

          Just for fun, at [4] you can find a nice article with the title: “Flawless Mouse Sensors: The Complete Guide” which lists the desired features found in high-end gaming mice along with sensor part numbers.

          * References:

          1. Broadcom

          https://en.wikipedia.org/wiki/Broadcom_Inc.

          Excerpting: “Avago Technologies Limited took the Broadcom part of the Broadcom Corporation name after acquiring it in January 2016. The ticker symbol AVGO that represented old Avago now represents the new merged entity. The Broadcom Corporation ticker symbol BRCM was retired.”

          2. ADNS-2610 @ Digi-Key – Obsolete

          https://www.digikey.com/en/products/detail/broadcom-limited/ADNS-2610/1233710

          3. PixArt Mouse Sensors

          https://www.pixart.com/products-comparison/7/Optical_Mouse_Sensor

          4. Flawless Mouse Sensors: The Complete Guide

          https://www.gaming-mice.com/flawless-mouse-sensors-guide/

  1. Personally, I never had an issue with ball mice. Contrary, they didn’t glitch as much as optical mice.
    – Many of these which I had caused the pointer to slowly move from one side of the screen to the other..

    Also, many ball mice cobtained light barriers made of red LEDs, special wheels and photo diodes.
    Merely the very old or lower end ball mice used mechanical potentiometers etc.

    PS: I also preferred serial mice over (serial) ps/2 mice.
    They had less stutter than the latter.
    http://www.os2museum.com/wp/jumpy-ps2-mouse-in-enhanced-mode-windows-3-x/

  2. I thought mice didn’t make good relative position sensors. Like everyone else who has a 3d printer, I looked into a better way to catch missed steps and thought a mouse sensor would do the trick. Reading up on it (quite a while ago now) convinced me otherwise. I can try to find the articles on this but perusing the various printer forums would probably be enough.

  3. Maybe he could use a nrf-Whatever bluetooth dongle, and offload the processing of the data to the smartphone app. No need to run a full linux OS on the pi in the ruler.

    Also, won´t it get erros due to the person who is moving it trembling, changing speed, etc ?

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.