Adding An Optical Mouse Sensor To An Autonomous Vehicle

[Tim] is getting his drone ready for SparkFun’s 2013 Autonomous Vehicle Competition on June 8th. He has a pretty good start, but was having some problems accurately measuring travel distance. The technique he chose for the task was to glue magnets onto the axles of the vehicle and monitor them with a hall effect sensor. Those sensors are finicky and a few problems during testing prompted him to look at a redundant system. Right now he’s experimenting with adding an optical mouse sensor to the autonomous vehicle.

Recently we saw the same concept used, but it was meant for tracking movement of a full-sized automobile. If it can work in that application it should be perfect here since the vehicle is much closer to the ground and will be used in ideal conditions (flat pavement with clear weather). [Tim] cracked open an old HP mouse he had lying around. Inside he found an Avago ADNS-5020 sensor. After grabbing the datasheet he discovered that it’s simply an I2C device. Above you can see the Arduino Leonardo he used for the first tests.

[Tim] coded functions to monitor the chip, including some interesting ones like measuring how in-focus the surface below the sensor is. This brings up a question, is there limit on how fast the vehicle can travel before the sensor fails to report back accurately?

22 thoughts on “Adding An Optical Mouse Sensor To An Autonomous Vehicle

    1. There are alot of places to find optic mice for parts, thrift stores, your local recycle station ( in some places they have a ‘ free store ‘ for usable items ), friends and relatives that are upgrading their PC/Macs and are getting new ones. I have been messing with a PIC18f and mikroelectronica’s mikroC includes a PS/2 library so using an older style mouse ( optic or otherwise ) as a form of serial interface should be a non issue PLUS the interface hardware is already attached ( if you are lucky, the buttons, scroll wheel can also get moved for other robot IO functions like wall detecting ). Ingenuity is another way of saying looking at the existing and finding more ways to use it.
      On a personal note, stay away from older Microsoft Optical Mice as the boards in them were why my optical mice died horrible, painful deaths ( and not the games I was playing or the solder reworking to get them running again ).

    2. I have been working to source a similar module for a project at work. Avago is indeed out of the market, but they have sold the rights to produce many of their old optical products to Pixart Imaging out of Taiwan (as noted in the linked press release). Their website is awful but I spoke to their US sales office and they were pretty helpful. Of course, I was shopping for somewhat larger quantities than one, but depending on your planned usage they might be able to help you out.

  1. Stop looking at the ground and monitor the wheel or a disk attached to the wheel. Then the surface the robot travels on doesn’t matter. And you can position the disk at the optimum position and color it for best pickup. Gear the disk for more or less accuracy

    1. And if the wheel is no longer in contact with the ground? Optical tracking of the ground is THE most reliable means of tracking speed…hence why it became used in so many farm vehicle automation systems.I live in beet country up in the Dakotas..I’ve seen many tractors outfitted with large, very precise optical tracking units that are based on roughly the same technology as this.

  2. I must’ve pulled apart 5 or 6 mice trying to find one with an interfaceable chip. They all had just one chip which was directly connected to the usb cable, led and buttons and had the sensor built in.
    Anyone know a particular brand of cheap mice that are hackable?

  3. High end gaming mice usually have dedicated camera chips, where a separate micro cares about interpreting data and implementing the USB interface. They’re costly, though, and there is brands to avoid, most importantly Logitech. Especially they usually have “custom” versions of the sensors where no datasheet or SROM is available and the pinout differs. Eg. the Avago ADNS-9500, where Logitech has the S9500 variant that misses two pins and you have to rely on luck and trial and error to find the differences.

    Low end mice often have fully integrated single chip solutions these days that directly interface to USB or PS/2. Interfacing with them is a pain, as that is their only output.

    Also, those chips use SPI, not I2C.

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.