This sensor measures the distance to an object by using sound waves.
- Power Supply: 3.3~5.5V DC
- Operating Current: 20mA
- Operating Temperature: -10℃～＋70℃
- Measurement Range: 2cm～500cm
- Resolution: 1cm
- Accuracy: 1%
- Frequency: 30Hz Max
How does it work?
It measures distance by sending out a sound wave at a specific frequency and listening for that sound wave to bounce back. This is the same principle that bats use to detect their prey and avoid obstacles. It is called echolocation
Since it is known that sound travels through air at about 344 m/s, you can take the time for the sound wave to return and multiply it by 344 meters to find the total round-trip distance of the sound wave. Round-trip means that the sound wave traveled 2 times the distance to the object before it was detected by the sensor; it includes the ‘trip’ from the sonar sensor to the object AND the ‘trip’ from the object to the Ultrasonic sensor (after the sound wave bounced off the object). To find the distance to the object, simply divide the round-trip distance in half.
Check out this video by Khan Academy for a great explanation of this principle
This is a very inexpensive sensor that has a wide angle of view. This means that it can easily get confused when it picks up reflections from objects other than its target
Where are they used in real life?
Measuring the distance to an object is a universal requirement in the Internet of Things. Vehicles need it to avoid crashing into obstacles, backing into things, or keeping a fixed distance. Doorbells use it to detect someone approaching the door. Robots need it for many functions.