please dont rip this site

Optical Ranging

Andy Kunz says

...Have you considered optical (laser) ranging? Two laser transmitters set to converge at a spot at the far end of your expected range. Use a CCD to accurately measure the distance between the dots. This is linearly proportional to the distance. Simple geometry --> simple code.

Peter van Hoof says: need for two lasers and two dots if the camera is mounted a fixed distance from the laser...

Dan Larson says: can turn the laser off, take a frame, and if the dot is still there, it wasn't the laser. Actually, you could just take two frames. One with lasers on and the other with lasers off. Subtract them. What's left are only the laser dots and some noise, which could be easily filtered.

Olin Lathrop [olin at] says:

That sounded like such a good idea I had to try it myself. I agree with Randy. Wow! I would have included the results in this email message, but I figured that the images would exceed the PIClist line length limit. I therefore set up a web page at (cached 20010206145741) for those of you that would like to see the results.

I've been hearing this solution for a while and I'm sure it would work nicely. It is further described at: (cached 20010131154628) and (as Sean H. Breheny notes) is often used in AutoFocus Cameras as described at

The problem(s) is(are):

  1. CCDs are in the under a $100 range. (getting lower ever day... see cameras) Ok for the dedicated hobbiest but it makes it hard for kids, producable products, or wife/kid limited budgets (me).
  2. Reading a CCD and finding the right spot requires

3D scanning takes almost no memory if you don't do the "frame difference" thing. One counter for "how far am I from the hsync pulse" and then that value gets RS232'd or what ever back to the host and then wait for vsync and then count down to the next horizontal line and repeat. Over the course of 256 fields, you get a complete vertical scan. Then hit the stepper motor to rotate the camera / laser platform one step right and repeat. For faster operation you can store up the first X lines and send them parallel then do the next X lines, etc... If the laser is modulated, you verify that the count you got last time is not there when the laser is off.

Or for a robot, you toss the bulk of the information... divide the result into 4 or so ranges ("too close", "close", "present" and "open"; two bits per line) and only do every 4th line or something. Since the robot doesn't really need to be as concerned about the height of the objects its navagating around, the whole thing needs to be on its side so your laser line is left to right and the cameras horizontal lines are scanning vertically.

Again, modulate the Laser(s) and use a photo diode to a filter with Q at modulation frequency directed by a mirror on a pager motor. The filter outputs pluses only when it sees the correct frequency and the time between the two pluses (or from the pluse to a reference provided by a sensor that watches the mirror spin when using only one laser) is proportional to the distance. Easily PICable, very low cost, etc...

Actually Scott Dattalo has done a brilliant page at on how to pick out the presence a frequency by just sampeling the signal at a regular interval (ISR) and doing a DFT on it. He uses it for 0 hardware DTMF. Scenix did it in thier single chip modem. It could be used in a PIC to eliminate the filter and just connect the photo-diode to the PIC. Another pin for the reference pulse and maybe a PWM out for the motor speed.


See also:


file: /Techref/io/sensor/pos/opticalranging.htm, 6KB, , updated: 2021/8/19 09:40, local time: 2024/7/18 04:01,

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF=""> Optical Ranging</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.

Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

  PICList 2024 contributors:
o List host: MIT, Site host, Top posters @none found
- Page Editors: James Newton, David Cary, and YOU!
* Roman Black of Black Robotics donates from sales of Linistep stepper controller kits.
* Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters.
* Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated!
* Contributors: Richard Seriani, Sr.

Welcome to!