Connecting Raspberry Pi to a USB sonar sensor

There is yet another way to sense the presence of objects: using a sonar sensor. But, before you add this capability to our system, here's a little tutorial on sonar sensors. This type of sensor uses ultrasonic sound to calculate the distance from an object.

The sound wave travels out from the sensor as illustrated in the following diagram:

Connecting Raspberry Pi to a USB sonar sensor

The device sends out a sound wave at the rate of 10 times per second. If an object is in the path of these waves, then the waves are reflected off the object, sending waves that return to the sensor, as shown in the following figure:

The sensor then measures any return ...

Get Raspberry Pi Robotic Projects now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.