An optical distance sensor is a sensor which can give an approximation of the distance to an object and outputs this in an (analog) signal. The useful range typically is from several centimeters to a few meters depending on the model and type of the sensor.

The company Sharp produces a series of easy to use optical distance sensors. These sensors make use of the principle of triangulation to measure the distance of an object in front of the sensor.

Optical triangulation is based on measuring the angle between the emitted and the reflected light beam. Inside the sensor an LED is emitting infrared light through a lens towards the object. This lens is focusing the light bundle. The object in front of the distance sensor is reflecting a fraction of this light towards the light sensitive part of the distance sensor.  Again the light is passing a lens focusing the light bundle. In the end the light reaches one or more of the light sensitive cells, mounted next to each other in a row; a so called linear array (CCD). If the distance to the target object changes, the angle of the received light beam also changes, and a different sensor part is illuminated.

The sensors operate on a 5 Volt supply voltage and have a special 3 pin, 2 mm pitch JST  connector (although a normal female header will also fit).

Note: some models have both a minimum as well as a maximum detection range.

Output characteristic

The output characteristics of the Sharp sensors are all highly non-linear (a big change in output voltage does not always indicate a big change in distance). When you read the sensors with a microcontroller, it is easy to convert this to a linear relation. This article describes how to achieve that.

Output voltage - distance example.

Output voltage – distance example.