How HC-SR04 Ultrasonic Sensor work?

0
How to use the HC-SR04 Ultrasonic Sensor with Arduino


 Your next Arduino project will gain bat powers with the HC-SR04 Ultrasonic Distance Sensor, which can measure distances up to 13 feet. If you want to prevent your robot from hitting a wall, you should know this. Its low power consumption (suitable for battery-operated devices) makes them ideal for hobbyists, and it is affordable and easy to use.

Describe ultrasound.


A high-pitched sound wave with a frequency outside the range of human hearing is an ultrasound. Sound waves vibrating between 20 times per second (a deep rumbling noise) and 20,000 times per second may be heard by humans (a high-pitched whistle). However, ultrasound is inaudible to humans since it has a frequency of more than 20,000 Hz.

Overview of HC-SR04 hardware

Two ultrasonic transducers make up the HC-SR04 ultrasonic distance sensor.

The electrical signal is transformed into 40 kHz ultrasonic sound pulses by one, which also serves as a transmitter. One person receives the signal and listens for the pulses being sent. 

When the receiver picks up these pulses, it generates an output pulse whose width varies with the proximity of the item in front of it. 

This sensor delivers excellent non-contact range detection between 2 cm to 400 cm (~13 ft) with an accuracy of 3 mm. It may be immediately linked to an Arduino or any other 5V logic microcontroller because it runs on 5 volts.

Technical Specifications

The details are given:

Operating Voltage DC 5V
Operating Current 15mA
Operating Frequency 40KHz
Max Range 4m
Min Range 2cm
Ranging Accuracy 3mm
Measuring Angle 15 degree
Trigger Input Signal 10µS TTL pulse
Dimension 45 x 20 x 15mm

pinout for the ultrasonic sensor HC-SR04.

Let’s have a check at its pinout.
pinout picture


Power for the HC-SR04 ultrasonic sensor is provided by VCC. It may be connected to the Arduino's 5V output. 

 Ultrasonic sound pulses are initiated by the Trig (Trigger) pin. The sensor starts an ultrasonic burst by holding this pin HIGH for 10 s. 

 When the ultrasonic burst is sent, the echo pin rises high and stays high until the sensor gets an echo, at which point it becomes low. 

The distance may be determined by timing how long the Echo pin remains up. The ground pin is designated as GND. Connect it to the Arduino's ground.

About HC-SR04 Ultrasonic Distance Sensor: How Will It Perform?

functioning animation


The trigger pin must be HIGH for 10 seconds to initiate anything. The sensor responds by sending an eight-pulse burst of ultrasonic data at a frequency of 40 kHz. This eight-pulse pattern was specifically created to allow the receiver to differentiate between the transmitted pulses and background ultrasonic noise. 

These eight ultrasonic pulses move away from the transmitter via the air. The echo pin goes HIGH in the interim to start the echo-back signal. After 38 ms, the echo signal times out and becomes weak if those pulses are not reflected back (38 milliseconds). 

Thus, a pulse of 38 ms shows that there is no blockage inside the sensor's field of view. As soon as the signal is received, the echo pin goes low if those pulses are reflected back. 

Depending on how long it takes to receive the signal, this causes a pulse is generated on the echo pin whose width ranges from 150 s to 25 ms.

Distance Calculation

The width of the received pulse is used to calculate the distance from the reflected object. This may be calculated using the simple distance-speed-time equation we learned in high school. The equation is easy to remember when the letters are arranged in a triangle.

Distance calculation


To further illustrate, let's use an example. Let's say we have an unknown-sized item in front of the sensor and we detect a 500-second pulse on the echo pin. Let's now determine the object's distance from the sensor. The equation below will be used for this.

Distance Speed Time

Here, we know the speed and the value of time, which is 500 seconds. It must be sound speed, of course! There is 340 m/s. We must translate the sound speed into cm/s in order to compute the distance. It moves at 0.034 cm/s. Now that we have that knowledge, we can determine the distance!

Distance = 0.034 cm/µs x 500 µs

We're not done yet, though! Keep in mind that the echo pulse represents the duration of the signal's transmission and reflection. Thus, you must divide your result by two in order to obtain the distance.

Distance = (0.034 cm/µs x 500 µs) / 2

Distance = 8.5 cm

The distance between the item and the sensor is now known to be 8.5 cm.

Post a Comment

0Comments
Post a Comment (0)

#buttons=(Accept !) #days=(20)

Our website uses cookies to enhance your experience. Learn More
Accept !