Set delay time and temperature to calculate reflection distance
Parameters
Presets (typical systems):
Results
—
Speed of sound (m/s)
—
Round-trip time (ms)
—
One-way time (ms)
—
Wavelength at 40 kHz (mm)
Round-trip sound-wave animation
Blue circle = sound source, red circle = reflector. Shows the sound wave travelling there and back in real time.
Theory & Key Formulas
$$d = \frac{v \cdot t_{echo}}{2}$$
$d$: distance (m), $v$: speed of sound (m/s), $t_{echo}$: round-trip time (s)
The round-trip time is divided by 2 because the sound travels twice the distance: emitter → reflector → receiver.
Change of the speed of sound with temperature (in air)
$$v = 331.3 + 0.606 \cdot T \quad \text{(m/s)}$$
$T$: temperature (°C). About 344 m/s at 20°C and about 319 m/s at −20°C
Typical speed of sound by medium
Air (20°C): $v \approx 343$ m/s
Seawater (20°C): $v \approx 1500$ m/s
Steel (longitudinal wave): $v \approx 5900$ m/s
Basic theory of echo ranging
Echo ranging through a conversation
🙋
I heard bats measure distance with echoes. Is that the same principle as the ultrasonic sensors people design?
🎓
The principle is exactly the same. Bats emit ultrasonic pulses of 20–200 kHz and work out the distance from the time it takes for the echo from an insect to come back. The HC-SR04 sensor often used with Arduino also works at 40 kHz, and all it calculates is "speed of sound × round-trip time ÷ 2".
🙋
Wait, bats "calculate"? You mean their brains process it in real time?
🎓
Yes! And bats work out not only distance but also speed, from the Doppler effect (the change in frequency). The bat's auditory cortex has "delay-tuned neurons" that respond precisely to particular round-trip times, building a distance map in the brain. As a biological sensing system, it is tens of millions of years ahead of human engineering.
🙋
You said the speed of sound changes with temperature. Do real sensors correct for that?
🎓
Systems that need high accuracy do. For example, the speed of sound differs by as much as 48 m/s (about 15%) between −30°C and 50°C. Cheap HC-SR04 modules do not correct for this, so errors appear in extreme temperatures. Some industrial ultrasonic flowmeters and rangefinders have a built-in temperature sensor and correct automatically.
🙋
So the speed of sound for underwater sonar is as high as 1500 m/s, more than four times that in air. Why is it so fast?
🎓
The speed of sound is $v = \sqrt{B/\rho}$, where B is the bulk modulus (resistance to compression) and ρ is the density. Water is denser than air, but its resistance to compression (modulus) is larger by even more. As a result the speed of sound in water is about 4.4 times that in air. In solid steel it is about 5900 m/s, and ultrasonic testing (UT) uses that high speed to locate internal flaws with an accuracy better than 0.1 mm.
Frequently Asked Questions
The sound wave travels from the emitter to the target, reflects and comes back, so it actually covers twice the distance. Dividing the total measured delay by 2 gives the time that corresponds to the actual one-way distance.
Yes. Ultrasonic sensors have a "dead zone"; the HC-SR04 cannot measure within about 2 cm. Sound-absorbing materials such as soft cloth or fur, very thin targets and angles away from the front of the sensor are also hard to detect.
LiDAR uses light (a laser), so it calculates with the speed of light (300 million m/s) instead of the speed of sound. The round-trip time of light is a matter of nanoseconds, so a high-precision timing circuit is needed, but sub-millimetre accuracy and long-range (over 100 m) measurement are possible. Ultrasonic sensors are cheap and work well in rain and smoke.
Active sonar reaches a few to several tens of kilometres, and passive sonar (which only listens to the target's sound) can reach hundreds of kilometres depending on conditions. Sound attenuates less in water than in air, and the SOFAR (sound fixing and ranging) channel phenomenon, which uses the ocean's temperature structure to carry sound over long distances, is also exploited.
What Is the Echo Delay and Distance Calculator?
The physical model of this tool calculates distance from the round-trip time (echo delay) that a sound wave takes to travel through the medium, hit a reflector and return to the receiver. The speed of sound \( v \) in the medium depends on the temperature \( T \) (°C) and in air is approximated by \( v = 331.3 + 0.606\,T \). The distance \( d \) from the emitter to the reflector is then \( d = \frac{v t}{2} \) using the measured delay \( t \). In water the speed of sound is about 1500 m/s, about four times faster than in air, so the delay for the same distance is shorter. Changing the temperature, medium and distance with the sliders animates the wavefronts and gives an intuitive grasp of the principle of distance estimation in sonar and bat echolocation.
$d = \frac{v \cdot t_{echo}}{2}$
Real-World Applications
Industrial use
Parking assistance in cars (reversing sonar) works on the same principle as this tool, finding the distance to an obstacle from the round-trip time of ultrasound. In non-destructive testing in construction and plants, ultrasonic thickness gauges and flaw detectors determine wall thickness and the position of flaws from the round-trip time in steel, and correcting for the change of sound speed with temperature is essential for quality control.
Research and education
In university physics labs and biology departments it is used as teaching material to visualise the echolocation of bats and dolphins. Because the effect of the medium (air or water) and temperature on the speed of sound can be adjusted in real time, students can grasp the principles of sound propagation intuitively.
Relation to CAE analysis and practical use
This tool provides simple distance and delay calculations as a preliminary step before ultrasonic simulations in CAE software (such as ANSYS or COMSOL). In practice it is used to optimise sensor placement and predict the timing of reflected waves, setting initial parameter values before moving on to detailed 3D analysis.
Common Misconceptions and Points to Note
It is tempting to think that "simply dividing the round-trip time by 2 gives the one-way distance", but the speed of sound changes with the temperature and density of the medium, so an accurate distance calculation must take that into account. In particular, the speed of sound in water and in air differs by a factor of about 4.4, so the same delay means a very different distance.
It is tempting to think that "the reflected wave always comes back exactly once", but in reality multiple reflections (multipath) and reverberation occur, and especially in narrow spaces or with hard walls the echoes overlap, making it hard to identify the correct delay. Processing that separates noise from the wanted reflection is needed.
A common misunderstanding is that "the distance set with the slider is exactly the measured result". This tool is meant for understanding the principle under ideal conditions; in real sonar and biological echolocation, the reflection characteristics due to the shape and material of the target and the Doppler effect from motion must also be considered. Keep in mind that it is a tool for visualising the basic concept.
Set the temperature of the medium with the temperature slider. In air the speed of sound changes from 340 m/s at 15°C to 346 m/s at 25°C
Enter the distance to the target with the distance slider, in the range 0.5–100 m
The simulator calculates the round-trip time automatically and shows the relationship between the echo delay (in milliseconds) and the distance
Worked Example
Select "Water (seawater)" (speed of sound 1500 m/s) as the medium and set the target distance to 50 m: the round-trip distance is 100 m and the round-trip time = 100 ÷ 1500 ≈ 66.7 ms. In air at 20°C (speed of sound = 331.3 + 0.606 × 20 ≈ 343.4 m/s), a bat detecting an insect 3 m away gets a round-trip time = 6 ÷ 343.4 ≈ 17.5 ms. For the same distance, the round-trip time in water is about 1/4.4 of that in air.
Practical Notes
Temperature affects the speed of sound linearly, so between 0°C in winter and 35°C in summer the speed of sound in air differs by about 21 m/s, and ranging errors accumulate
Changes in density due to salinity make the speed of sound in seawater vary between 1500 and 1540 m/s, so real sonar is calibrated with the measured speed of sound (seawater is fixed at 1500 m/s in this tool)
Signal strength is attenuated according to the absorption coefficient of the reflecting surface (concrete 0.05, cloth 0.4), so thresholds must be set with the reduced reliability of distance measurement in mind