What is an Ultrasonic sensor ? An Ultrasonic sensor is a device that can detect signals of a specific frequency. Especially, audio signals.
How does it work ?
It sends an audio wave of a specific frequency, then it will raise the output signal HIGH
. Once the echo hits the receiver the signal goes LOW
.
How does it look like ?
How can we calculate the distance from the obstacle ?
The distance is proportional to the time the output signal is HIGH
. Since, the time taken by the audio signal to reach an obstacle and reach back to the sensor is equal to the time the signal is HIGH
, we can calculate the distance.
Speed of sound = 340.29 m / s
Signal Up Time = 0.01 s
Distance Travelled = (Signal Up Time) * ( Speed of sound )
This gives us the double distance. since, the audio signal travels from the source to the obstacle and back
Distance To Obstacle = Distance Travelled / 2
What are we going to build ? A Distance calculator to understand the basic setup of an ultrasonic sensor. Later, we will convert it into a human interactable device.
Baisc Setup
Link to the Github project: Ultrasonic HID