Subscribe to Make Magazine Today!

md_ranger.jpg
It is amazing what you can accomplish with a web cam, cheap laser pointer and a bit of C++ coding. The complete build, along with all the source code, is available on the site. – Link

There are many off the shelf range finding components available including ultrasonic, infrared, and even laser rangefinders. All of these devices work well, but in the field of aerial robotics, weight is a primary concern. It is desirable to get as much functionality out of each component that is added to an airframe. This page describes how a mini laser pointer can be configured along with a single camera to provide mono-machine vision with range information.


  • Dan

    Rotate the camera 90 degrees for more pixels to play with.

  • Tom

    Loved this project. I will be trying this soon myself. Some thoughts on possible improvements (at the cost of some complexity).

    Instead of looking JUST for the brightest dot, you may wish to process a variable number of adjacent pixels (especially if the dot smears), and use an algorithm (TBD) to find the interpolated non-integer value of the max pixel. You will likely improve your accuracy beyong the inherent resolution of the camera.

    This will likely make this project’s base accuracy depend on the physical alignment and calibrations.

  • Rostov

    Excellent article!
    The math can be simplified to eliminate the trigonometry. Looking at the drawing, you can see that there are two similar right triangles: one with legs D and h, and a similar but smaller triangle inside the camera with legs we will call D2 and h2. Since the angles are similar, the legs are proportional such that D/h=D2/h2. h2 is the number of pixels from the center of focus (pfc in the article). Since h and D2 are fixed, we can let a constant r=h*D2. Then, D=r/h2, and r can be derived through the calibration process. Note: this assumes the two axes are parallel, but should be close enough for small deviations.

  • mary

    i love trying this project.since i’m a beginner, i dont understand how to calculate the gain constant and offset constant.anyone can help me?