Robotics/Sensors/Distance Sensors

IR
IR distance sensors are one of the most used distance sensors. They fall in 3 categories:

Reflection
(Short range. Not more than 2 - 3cm) This type uses an IR-LED and IR-diode (or phototransistor). When an object is close to the sensor it reflects the light emitted by the LED to the IR-diode. Using modulated IR-light (A) and filtering (B) the input signal of the IR-diode leads to better results as this blocks (much of) other IR-light. There are ICs that contain both a modulator, IR-diode and filter-circuit.

Triangulation
(Larger range. Around 10 - 30cm) e.g. Sharp has a family of sensors that use this principle for measuring distance. They consist of an IR-LED and an IR-sensitive LDR strip. Combined with built-in optical lenses, the reflected beam's position on the LDR depends on how far the object is.

line detecting sensor
Similar setup as the reflection IR-sensor, but aimed downwards to detect lines on the ground. This sensor makes use of the difference in reflection between a white background and a black line.

More advanced robots use multiple line detection sensors to follow a line more cleanly.

Ultrasonic
Ultrasonic distance sensors use sound to measure distance. These sensors emit an ultrasonic pulse train and then measure the time until the pulse is reflected. Since the speed of sound is (more or less; excluding temperature and wind) constant in air (approx. 344m/s) it is easy to calculate the distance to the reflecting object. These are used for distance ranging from several centimeters up to a few meters.

Laser
Laser based distance sensors use the same principle as ultrasonic distance sensors, but use light instead of sound. These sensors are useful from short (0.05 meters) to quite long range (as in used in home construction, i.e. 150 feet or more). They may have class 2 lasers. The led beam can be fairly narrow at reasonable distance for example with the Bosch GLM50C, the led beam is 6mm at 10m. http://web.archive.org/web/20211017003815/https://www.boschtools.com/us/en/ocsmedia/GLM50C.pdf