Close

Qualification of the Sharp Distance Sensor

A project log for Getting started with ROS

Summary of projects to dive (back) into the world of robotics and learning ROS (Robot Operating System)

cclexowcc.lexow 10/24/2018 at 09:240 Comments

Electrical characteristics

The supply voltage to the sensor is stabilized using a 22 uF capacitor. Anyway there are still voltage spikes visible on the output signal. An RC low pass filter reduces these spikes significantly.

Sensor output voltage

The filtered voltage is fed to the 12 Bit A/D converter within the STM32 MCU and sampled at a rate of 1 kHz. The data sheet states a measurement duration of 38.3 ms +/- 9.6 ms which led me to take an average of 100 samples (=100 ms) for one distance measurement.

At http://sim.okawa-denshi.jp/en/CRlowkeisan.html I found a nice tool to calculate RC low pass filters and analyze their behavior.

Output characteristic curve

The data sheet of the distance sensor contains the characteristic curve of the sensor response to an object at a given distance in front of the sensor. One way is to digitize this curve using e.g. the WebPlotDigitizer and take the extracted data to calculate the object distance. Anyway it is still a good idea to perform measurements on your own to evaluate the sensor characteristic. In addition this provides information how the mechanical and electrical integration as well as the environment affects the measurements.

The setup for this test consists of a black floor and a white paper as a reference object, which was moved stepwise from 1 cm to 80 cm distance relative to the sensor.

Measurement setup

At each position the MCU SW takes 10k samples and sends them via USB to a PC. Octave, the open-source equivalent to Matlab, is used on the PC to analyze the measurement data.

With the given setup the distance sensor has the following output characteristic curve:

Sharp Distance Sensor Output Curve

Below ~7 cm and above ~55 cm the sensor has ambiguous output voltages. This limits the usable measurement range to [7..55] cm. In software I will take this measurement data to implement a look up table and use linear interpolation for the distances in between.

The next step is to implement the motor control in SW to perform 360° scans.

Discussions