Tracking A Car Like It Were A Computer Mouse

optical-mouse-sensor-tracks-vehicle-motion

This is [Paul Mandel’s] Ground-truth velocity sensor. That’s a fancy name for a device which tracks the movement of a vehicle by actually monitoring the ground its travelling over. This differs from simply measuring wheel rotation (which is how traditional odometers work) in that those systems are an indirect measurement of motion. For us the interesting part is the use of an ADNS-3080 single-chip optical mouse sensor on the left. It’s cheap, accurate, and only needs to be ruggedized before being strapped to the bottom of a car.

[Paul] designed a case that would protect the electronics and allow the sensor to mount on the uneven underbelly of a vehicle. The optical chip needs to be paired with a lens, and he went with one that cost about ten times as much as the sensor. Data is fed from the sensor to the main system controller using the PIC 18F2221. One little nugget that we learned from this project is to poll a register that always returns a default value as a sanity check. If you don’t get the expected value back it signals a communications problem, an important test for hardware going into the vibration-hell that is automotive technology.

35 thoughts on “Tracking A Car Like It Were A Computer Mouse

  1. I wonder what he was trying to censor in all the photos….

    Looking at slide 5 gives you the most information. (his censor box is a little off compared to the rest. It looks like there is a SOT23 transistor on the back side (Q1) and potentially some logic on the top but only one net could be involved.

    Or is this another case where a buddy got a hold of his design and added some NSFW content just before it headed out for etch :)

      1. His email and entire resume is at the bottom of that page. There’s a trace leaving pin 5 on the sensor going to the left, I’m guessing there’s a component there. In the datasheet pin 5 is the led control pin to drive the sensor’s light source.

    1. They don’t hide it very well. Anyone remember the ‘redacted’ PDFs from a long while back wherein the redaction black boxes could simply be deleted or just wouldn’t render in time on a slow computer? Same thing here. It’s some text related to an overpriced speaker company. Censor your images – not your powerpoints or PDFs!

      1. Which uncovers this in the resume:
        Bose Corporation – Research Intern – Automotive suspensions
        “Built low-cost vehicular velocity sensor from COTS parts, allowing
        precise lateral drift measurements and smoother compensation.”

        So he was censoring it because it’s something being used at BOSE for suspension research ;)

  2. “poll a register that always returns a default value as a sanity check”

    Awesome! Taking the time to implement checksums and the like would be a major buzz-kill for a smaller project like this, real neat trick.

  3. I was looking at using one of those mouse sensors for similar application. The problem seems to be that avago doesn’t make them easily available. I can’t find them on digikey, mouser, etc. Parallax has an eval board for about $25 – but the sensor should only be about $1-$2. Luckily I have a few old optical mice lying around with similar sensors, but it would be nice to find ONE sensor and work out the kinks for that one as opposed to hacking similar sensors from multiple mice.

    Anyone have any luck sourcing these?

      1. They actually learned that trick from ships, whenever you look at the bridge of anything afloat over several tons of displacement, it has at least one rotating window ;-)

        However here compressed air and shaped nozzles would do a much better job, since rotating seals are always a pain in the butt to design properly…

      2. If you have a RWD car, go underneath it and look at your drive shaft. Is it covered it rust, indicating water got on it? Unless you have a new car, it will be, and it spins. Also there will be tons of road dirt all over the under carriage too.

  4. I tried something like this on an RC Car, that would skim over the ground. I used a cheap PS/2 Optical mouse. But the car would go much faster than the mouse would poll the sensor, so it would loose track of how far it went. As it was for a school project, I ended up turning the mouse over, and using the scroll wheel, which had lower resolution, but worked out better.

  5. The problem is that it can’t be accurate under specific situations.

    For example if you drive on water covered road it isn’t going to pick anything.

    If you drive on a dirt road with dirt flying all over the downside of the vehicle it will pick nothing either as it wont be able to see anything even though the lens is kept clean.

    It should be at least laser based or based on Microwaves,etc,if the actual use would be under uncontrollable situations.

    1. There’s also the problem that mice sensors drift a lot.

      They’re supposed to be counting a certain number per inch, but that number actually depends on the exact distance to the surface, the surface quality, how many details of the surface the sensor picks up due to the texture, the amount of light, focus, etc.

      If you try it on a real computer mouse, move it back and forth a known distance between two stops, it doesn’t take very long till the cursor drifts off. If you apply that to a car, the calibration of the sensor is affected by things like how high the suspension rides.

        1. The depth of field of the camera is something like 1-2 millimeters at a distance of 5 mm from the lens and outside of that it just sees a blur with no trackable features. If you add a lens to correct the distance up to a meter but keep the original lens in between, it’s got a depth of field just 15 centimeters or about 6″. The ground must remain within three inches of the focal point or it can’t track anything.

          The feature tracker is also pretty naive. It just takes the picture, blows up the contrast and sees what moves. If you have a diagonal line going through the picture from up to down, like the edge of a curb or a patch in the road, it will interpret it as sideways motion. That’s why mousepads with advertisements or other sharp contrast figures on them are really annoying.

          1. I happen to know the guy who designed the optics for the m$ mouse. His advice is to use a white piece of paper – best contrast, best surface features.

            I have a few of the ADNS-3090 chips and the datasheet. It takes a 30×30 picture (each pixel is 5 bits greyscale) and compares it with the previous picture. Pretty high-power image analysis – x, y, and rotation. You can read the image back – as a 30×50 so you get a bit of history.

            Not sure about the drift. No obvious reason. You would need to look directly at the chip registers to determine what is going on. Also, different surfaces.

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.