Close

Optical flow sensor from an LED mouse

A project log for Potpourri

Definition: A mixture of things, especially a musical or literary medley

peter-walshPeter Walsh 11/22/2016 at 02:154 Comments

(A response to a question on the blog.)

Here's an example of working with an optical flow sensor.

Take an LED mouse and clip out the DIP micro using a pair of side cutters, then install headers into the footprint. You can then attach jumpers to PWR, GND, and the two SPI lines as needed.

And here's my homemade dev kit. The mouse board is under the "ferris wheel", which was cut from a laser. Turn the wheel by hand and watch the measurements flow by on the serial port.

(Using an arduino program to read the flow sensor.)

I'd give out the arduino code, but it's a bare-metal program (ie - not a sketch). Not for the faint of heart.

If there's a ton of interest I'll put the code up somewhere.

Discussions

Peter Walsh wrote 11/22/2016 at 05:31 point

The LED is not needed if the surface is already lit. (The underside of a mouse needs one, for obvious reasons.)

The optical flow sensor is a 16x16 (varies with device) CCD camera with some special firmware onboard. It works just like a camera. In fact, some of the chips let you read the actual camera data, which is a neat way of getting a 16x16 camera image.

The CCD array has no optics whatsoever, so you'll need a lens of some type to focus the image onto the sensor. That's how the optical flow sensors for quad-copters work - they mount a lens on the device that focuses at infinity.

Search for "optical flow" on eBay and you'll see what I mean. None of those have a light source, but they all have lenses.

For a mouse, the special lens is an acrylic prism that routes the LED light down onto the surface, and focuses the resulting image onto the sensor. There's a small lens as part of the prism that does that.

The focal length of that lens is very short, but it shouldn't be hard to get a different lens to focus at other distances.

  Are you sure? yes | no

Trevor Johansen Aase wrote 11/23/2016 at 01:08 point

I had no idea there were even optical flow sensors for quadcopters. Leared a lot this week, thanks.

  Are you sure? yes | no

Peter Walsh wrote 11/23/2016 at 01:17 point

It's how they do "stationkeeping" onboard. The flow sensor pointed at the ground gives a processed output that the onboard micro can use to adjust the position.

  Are you sure? yes | no

Trevor Johansen Aase wrote 11/22/2016 at 03:58 point

How important is the lense and LED for pickup accuracy?

  Are you sure? yes | no