Skip to content

Test: A non-linear sensor (the Sharp GP2D12)

Interactive Lab

A non-linear sensor: the Sharp GP2D12

An infrared distance sensor on an MCP3208: avoid its fold-back, filter it, fit a curve to it and turn the fit into a lookup table.

The MCP3208 reads 1861 (1.50 V). Where is the target?

← Start here
00.511.522.533.501020304050607080Distance from the sensor (cm)Output (V)fold-back5.6 cm20.0 cm

Ringed: the real target. Dots: every distance that gives the same voltage. Grey band: inside the robot, where no target can be.

bumpersensor

20.0 cm → 1.758 V → code 2181

⚠ Ambiguous: 5.6 cm or 20.0 cm from the sensor.

Set the sensor back by 10 cm or more and no target can reach the fold-back region. Until then, a target close to the bumper reads like one much further away.

0 of 4 predictions made. Leaving out the 40 cm point in tab 3 also changes the fit behind the lookup table.

What this does not model: the target’s colour and angle, sunlight, the spread from one sensor to the next, the sensor’s 4.5 to 5.5 V supply and its current pulses, and the real shape of the fold-back below 10 cm, which is drawn as a straight line. The calibration data are the ten points of Table 7.5, from one sensor.