Page 1 of 1

Automatic water depth measurement in a well using sound

PostPosted: Thu Jan 14, 2021 5:18 pm
by VirtinsTech
Nowadays, distance measurement is usually performed using ultrasonic sound or laser. However, these two methods requires the signal travelling path to be a straight line and there are no obstacles along the way. This may not be possible or convenient under some circumstances. Sound or infrasound is thus used instead for distance measurement as their wavelength is longer and can go around obstacles through diffraction. Here we take the Youtube video (by Peter Maginot) below as an example to demonstrate how to automatically measure a distance using auto-correlation of a sound containing the stimulus and its echo, with Multi-Instrument and only one microphone connected to the computer sound card.



In the above video, the time delay of the echo is manually measured to be about 60 ms. In Multi-Instrument, we can use auto-correlation to measure this time delay automatically with an accuracy of 1/[sampling rate]. From the above video, one of the impact sounds including its echo was captured in a WAV file using Multi-Instrument (see figure below). The spectrum clearly shows the (damped) natural frequency excited by this impact is 3411.5Hz (period = 0.293 ms).

WellDepth1.zip
(68.59 KiB) Downloaded 2246 times


ResonantFrequency.png
ResonantFrequency.png (57.54 KiB) Viewed 19463 times


As auto-correlation function always has its highest peak at 0 s, only the second highest peak in this function is of interest here. Ideally, for distance measurement through correlation (which is very much immune to noises), a continuous or pulsed white noise or MLS should be used as the stimulus, because their auto-correlation functions only have one single peak at 0 s and almost zeros at the rest of time delay. If the sound recorded contains both stimulus and echo, then the second highest auto-correlation peak will be shown at the delay time of the echo. This time is captured by a DDP called SecondPeakACFTimeDelay_A(s) in Multi-Instrument. Assuming sound speed in air is 344 m/s, then the distance would be [SecondPeakACFTimeDelay_A(s)]*172. Here we define a UDDP (User Defined Derived Data Point) using this formula to display the measured distance in Multi-Instrument directly.

The result is shown below. The measured time delay is 2.063 ms and the measured distance is 0.35m. The result is clearly wrong. Why?
WrongDistanceMeasurementWithoutFilteringTheNaturalFrequency.png
WrongDistanceMeasurementWithoutFilteringTheNaturalFrequency.png (77.13 KiB) Viewed 19675 times


As mentioned previously, unlike white noise and MLS, the impact stimulus contains a strong periodic component-the natural frequency 3411.5Hz. It is this periodic component that creates periodic peaks in the auto-correlation function. The interval of these peaks is 0.293 ms as shown in the above figure. We can apply a low pass filter in the Oscilloscope to remove this periodic component (cutoff at: 2000Hz) and then do auto-correlation, we get the correct time delay 59.333 ms and distance 10.21m.

LowpassFilterToRemoveNaturalFrequency.png
LowpassFilterToRemoveNaturalFrequency.png (21.8 KiB) Viewed 19675 times


CorrectDistanceMeasurementWithFilteringOutTheNaturalFrequency.png
CorrectDistanceMeasurementWithFilteringOutTheNaturalFrequency.png (70.76 KiB) Viewed 19675 times


It is possible to use a speaker or sound transmitter to generate the stimulus to form a complete distance measurement system using sound.