Are you making something that needs a form of distance measurement? Say for example you are making a trip wire security system or an obstacle avoiding robot. If you are, ultrasonic distance sensors may be an option for you.
Ultrasonic distance sensors work on the very basic principle that sound bounces off solid objects, otherwise known as echo. Surely you have been in a cave, large hallway, or in the mountains and have yelled, only to have it yell back at you, this is echo.
The great thing is sound travels at a constant speed, around 300 metres per second. What does this mean? It means that we can use sound as a form of distance measurement.
To determine how far away an object is we use a simple equation, Speed = Distance / Time. Well, like I said earlier, speed travels at a constant 300ms-1. So to determine distance we only need to know time, then we can re-arrange the formula to, Distance = Speed x Time. To work out Time we must measure how long it takes for the sound to return to its origin. Simply start the timer when we send out the sound wave and stop it when it returns.
One you have the time taken you then simply multiply it by the speed to give you the overall travel distance. Note that the overall travel distance is not the distance away the object it, the sound bounced back so we need to divide the distance by two to work out the actual distance to the object.
Funnily enough bats use a very similar method to navigate. They send out an ultrasonic wave and listen for it, using that they can roughly estimate how far away something is.
The great thing about using ultrasound is that we can’t hear it. Just imagine how annoying having an audible sound distance sensor would be!
If you want to pick up an Ultrasonic distance sensor be sure to check out the HC-SR04. It’s a handy little sensor that operates on 5V and works great with Arduino.