HC-SR04 Ultrasonic Distance Sensor Calculator

This calculator can be used with an HC-SR04 Ultrasonic Distance Sensor. The sensor uses high frequency audio to measure the distance to an object between 2cm and 400cm from the front of the emitters, with a manufacturer’s stated accuracy of around 3mm. The non-audible tone is broadcast when the TRIGGER pin is brought high and the time it takes for that signal to be reflected back is presented as a pulse of corresponding width on the ECHO pin. Measure the pulse width, and you know the distance.

The calculators below will help you to verify the accuracy of your device under test by calculating what the measured sensor distance should be, based on the pulse length provided. Conversely, you can determine the expected pulse length based on a distance provided. All calculations require using the speed of sound in air which varies with temperature. Standard room temperature is 20°C / 68°F.

METRIC DISTANCE BASED ON PULSE LENGTH
Pulse Length

Enter pulse length in milliseconds
mS
<– EDIT THIS

VALUES USED AS CONSTANTS

RATIO OF SPECIFIC HEATS            1.40 γ
INDIVIDUAL GAS CONSTANT – AIR    286.90 J/kg K

Temperature in °C

Enter temperature in degrees Celsius
°C
<– EDIT THIS
Speed of Sound
343.14
m/s
<————–
Distance in Meters
0.369
m
<– RESULT
Distance in Centimeters
36.942
cm
<– RESULT
IMPERIAL DISTANCE BASED ON PULSE LENGTH
Pulse Length

Enter pulse length in milliseconds
mS
<– EDIT THIS

VALUES USED AS CONSTANTS

RATIO OF SPECIFIC HEATS            1.40 γ
INDIVIDUAL GAS CONSTANT – AIR    1,716.00 ft lb/slug °R

Temperature in °F

Enter temperature in degrees Fahrenheit
°F
<– EDIT THIS
Speed of Sound
1125.91
ft/s
<————–
Distance in Feet
1.212
ft
<– RESULT
Distance in Inches
14.545
in
<– RESULT
PULSE LENGTH BASED ON METRIC DISTANCE
Speed of Sound (Metric)
343.000
m/s
Distance in Centimeters

Enter distance in Centimeters
cm
<– EDIT THIS
Pulse Length
23.324
mS
<– RESULT
PULSE LENGTH BASED ON IMPERIAL DISTANCE
Speed of Sound (Imperial)
549.880
ft/s
Distance in Inches

Enter distance in Inches
in
<– EDIT THIS
Pulse Length
2.135
mS
<– RESULT

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed

Menu