What is an Ultrasonic Sensor and how it works?

If you are new to electronics, you might have so many questions like what is an Ultrasonic sensor? How it can measure the distance of any object? In this section, we will try to find the answers to such questions. Once you have all the required components with you, you can follow the steps mentioned below and work on the project. Take a look at the picture of an ultrasonic sensor below. On the left, we have the front view of an ultrasonic sensor and on the right side, we get to see the backside view of the ultrasonic sensor. We have two transducers at the front of this sensor that you can see in the first image.


One transducer is used to transmit, the ultrasonic burst at 40kHz, and another one receives the reflected ultrasonic burst. We have 2 pins (i.e. Vcc and GND) for powering up the sensor and 2 pins (i.e. Trigger and Echo) for measuring the distance.


Now, let’s try to understand the working with the help of timing diagram below. At first, we need to set the Trigger pin of the ultrasonic sensor HIGH(5V) for at least 10 micro seconds(us). This will cause the sensor to send an 8-cycle ultrasonic burst at 40kHz and wait for the reflected ultrasonic burst. When the sensor detects reflected ultrasonic from the receiver, it sets the Echo pin to high (5V) and delays for a time (width) proportional to the distance. We need to measure this width of the Echo pin in time (in micro seconds) and then we will use this time to calculate the distance by using the distance formula. Here, we know the speed of the sound is 340 meter per second. This corresponds to around 29.412 microseconds per centimeter. It's a basic school math that you can do very easily. To calculate the distance in centimeter, we need to use the following formula where the units of the Distance and Time are Centimeter and Micro Seconds, respectively.

Distance = (Time/2) / 29.412

We are dividing the time taken by the echo pin by 2 because the ultrasonic wave had to covered the distance twice by travelling towards the object and reflected back to the sensor.


Now you have completely understood how an ultrasonic sensor works. It's time to learn how to interface the ultrasonic sensor with Raspberry Pi

Comments

Popular posts from this blog

Design Multiplexer and Demultiplexer ICs using VHDL on Modelsim

Watch OTT Content on Raspberry Pi

What are the basic components of electronics?