HC-SR04 Ultrasonic Sensor Module
|Operating Voltage||DC 5V|
|Measuring Angle||15 degree|
|Trigger Input Signal||10?S TTL pulse|
|Dimension||45 x 20 x 15mm|
How Does HC-SR04 Ultrasonic Distance Sensor Work?
It all starts, when a pulse of at least 10 ?S (10 microseconds) in duration is applied to the Trigger pin. In response to that the sensor transmits a sonic burst of eight pulses at 40 KHz. This 8-pulse pattern makes the ?ultrasonic signature? from the device unique, allowing the receiver to differentiate the transmitted pattern from the ambient ultrasonic noise.
The eight ultrasonic pulses travel through the air away from the transmitter. Meanwhile the Echo pin goes HIGH to start forming the beginning of the echo-back signal.
In case, If those pulses are not reflected back then the Echo signal will timeout after 38 mS (38 milliseconds) and return low. Thus a 38 mS pulse indicates no obstruction within the range of the sensor.
If those pulses are reflected back the Echo pin goes low as soon as the signal is received. This produces a pulse whose width varies between 150 ?S to 25 mS, depending upon the time it took for the signal to be received.
The width of the received pulse is then used to calculate the distance to the reflected object. This can be worked out using simple distance-speed-time equation, we learned in High school. In case you forgot, an easy way to remember the distance, speed and time equations is to put the letters into a triangle.
Let?s take an example to make it more clear. Suppose we have an object in front of the sensor at an unknown distance and we received a pulse of width 500 ?S on the Echo pin. Now let?s calculate how far the object from the sensor is. We will use the below equation.
Distance = Speed x Time
Here, we have the value of Time i.e. 500 ?s and we know the speed. What speed do we have? The speed of sound, of course! Its 340 m/s. We have to convert the speed of sound into cm/?s in order to calculate the distance. A quick Google search for ?speed of sound in centimeters per microsecond? will say that it is 0.034 cm/?s. You could do the math, but searching it is easier. Anyway, with that information, we can calculate the distance!
Distance = 0.034 cm/?s x 500 ?s
But this is not done! Remember that the pulse indicates the time it took for the signal to be sent out and reflected back so to get the distance so, you?ll need to divide your result in half.
Distance = (0.034 cm/?s x 500 ?s) / 2
Distance = 8.5 cm
So, now we know that the object is?8.5 centimeters?away from the sensor.