 Ultrasonic sensors measure distance using sound waves at frequencies above the range of human hearing, much like bats or dolphins use sonar to sense their surroundings. The sensor emits a high frequency pulse through the air and then listens for that same frequency pulse to be reflected back by an object. The distance from the sensor to that object is calculated by taking the time elapsed between sending and receiving and multiplying it by the speed of sound. Finally, because the pulse is traveling the distance twice in a round trip to the object and back, we divide by two. So, placing my notebook 31 centimeters away from the sensor, it sends a pulse to the microcontroller with a duration of 1.86 milliseconds. Divide that by the speed of sound, 340 meters per second, divide by two, we arrive at 31 centimeters. Yup, it works.