Adding an optical mouse sensor to an autonomous vehicle

optical-mouse-sensor-for-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?

Comments

  1. Tom the Brat says:

    You know, this gives me an idea. Perhaps you should beware.

  2. Amnon says:

    Hi
    I have used the optical mouse technique since 2006 . the sensing speed is limited in the mouse sensor data sheet , in the mouse I have used it was (if I recall correctly) 1.2 meters a second when the sensor was 4 mm above the ground.
    Here is my system from 2006


    Amnon

  3. Kyle says:

    Gaming mouses usually have a maximum speed specification, for instance, my Logitech G5 has a Max Speed of “45—65 inches/second (depending on surface)”.

  4. Squirrel says:

    Anyone know where you can find the sensor modules themselves? It appears that Avago has left that market.

    http://www.mouser.com/PCN/Avago-5-16-12-Avago%20NID%20announcement%20letter%20May%202012.pdf

    • nybbler905 says:

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

    • datagon says:

      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.

  5. bob.cook says:

    Looks like the PX4FLOW is an improved version of this type of sensor. https://store.diydrones.com/ProductDetails.asp?ProductCode=BR-PXFLW

  6. Mark m says:

    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

    • Taylorian says:

      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.

  7. kay says:

    http://www.youtube.com/watch?v=YiJOiqOHG1s I did this a while ago and you get much better performance using two mice. They have to be the same make of course.

  8. Liam Jackson says:

    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?

  9. dosgamer74 says:

    Just a a correction on the above article: The ADNS-5020 is actually a 3-wire SPI device, not I2C.

  10. bonooobong says:

    It seems to be working! I’ve used an almost 10 yrs old Logitech optical mouse with my Arduino, the sensor has been about 5mm-s from the ground and it has worked:)

  11. Squirrel says:

    Oh, and if you’re looking for research papers on the concepts behind using vision to track movement, look up ‘Visual Odometry’.

  12. jgabby says:

    Instead of measuring the ground moving past, can you effectively gear down the travel speed by measuring axle rotation?

  13. Hattori Hanzo says:

    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.

    • A says:

      Hey Hattori Hanzo,
      Do you know the pin layout for the Avago ADNS S9500 variant? It seems that you’re experienced with this issue (that I’m currently facing).
      TNX

  14. Dave Suffling says:

    Most USB mouses will speak PS/2 — those adapters that let you use a USB mouse with a PS/2 port are just pin-to-pin connections.

    This page has a mapping from USB lines to PS/2 lines: http://pinouts.ru/InputCables/usb_ps2_mouse_pinout.shtml

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 93,990 other followers