Ultrasonic Sensor

Ultrasonic sensors is a commonly used sensor that allows you to measure distance from the sensor to the thing in front of you. They are easy to setup and very accessible to come by.

How do they work?

They work by sending out a signal that bounce off objects in front of it, and then waiting for that signal to return. The time it takes to send out a signal and receive it again, determines how far or close an object is to the sensor.

illustration of how an Ultrasonic sensor functions, by sending out signals and receiving them again when the signal bounces back
Since the speed of sound in air at 20 degrees C travels at 343 m/s, the time taken to receive a signal can be converted to distance in centimeters by using the following formula: cm = (duration/2) * 0.0343 So for example would a time measured of 0.1 seconds be translated to cm = (0.1/2) * 0.0343 = 17.15 cm Meaning that there would be an object 17.15 cm in front of the sensor. If you want to learn how to use an ultrasonic sensor, try our guide here .