W. Durfee, Dec-03
A robot can find the distance to a solid object using sonar. A ping of sound is sent from the robot. The computer measures the round trip time of flight the sound to bounce off the distant object and return. High accuracy, long range sonar involves complex, expensive equipment, but short range, reasonable accuracy sonar can be done on the cheap. It is also easy to interface a low end sonar system to the Basic Stamp.
The following links are a starting place.
Old Polaroid cameras had sonar sensing for their autofocus system. Salvaging the sensors and converting for use in Basic stamp robots is common. There are many articles on the web and you can find old cameras on E-bay. You can also purchase the Polaroid sensor from Acroname for $46 if you don't like the E-bay route. Here are some links on salvaging Polaroid sensors and interfacing to the Stamp:
The Devantech SRF04 sonar sensor can read 3" to 10' and costs $32. The Nuts and Volts Column #84 describes is sensor and how to interface to the Stamp. An article from Acroname also describes interfacing to the Stamp.
Jameco sells ultrasonic transceiver units for
build-from-scratch systems. If you are comfortable with electronics, here's
an article that shows how
(*Note: if you are in ME 2011, we have not tested any of these approaches so you are pretty much on your own)