O'Reilly logo

Raspberry Pi Robotic Blueprints by Richard Grimmett

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Connecting Raspberry Pi to a USB sonar sensor

One of the easiest ways to sense the presence of objects is to use a sonar sensor. Before adding this capability to your system, here's a little tutorial on sonar sensors. Sonar sensors use ultrasonic sound to calculate the distance from an object. The sound wave travels out from the sensor, as illustrated in the following figure:

Connecting Raspberry Pi to a USB sonar sensor

The device emits a sound wave 10 times a second. If an object obstructs these waves, the waves will reflect off of the object and then return to the sensor, as shown in the following figure:

The sensor then measures the returning waves. It uses the time difference between when ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required