Abstract

In ultrasonic ranging system, the time-of-flight (TOF), which acquired by the determination of two special points of ultrasonic echo, is important for accuracy and speed. The published calculation of TOF processing methods is too enormous to affect the real-time performance. To improve its measurement accuracy and speed, we proposed a new algorithm called “moving sine-wave fitting” to calculate the envelope of ultrasonic echo for each calibration point. Then, the absolute feature point (AFP) corresponding to half of the envelope peak can be defined and used to find out the relative feature point (RFP); the linear relationship between the RFPs and the known distances should be obtained referring to calibration points. At last, the distance on the measure can be acquired by using linear interpolation according to the above relationship. The measurement experiments have been performed on a set of distances, which shows a good measurement resolution that the overall measurement accuracy is 0.513 mm, and the linear correlation coefficient between the RFPs and the obtained distances is R2 = 0.806.

1. Introduction

As its advantages of nondestructive and rapidity, ultrasonic ranging has been widely used in architecture, metal industry, automobile reverse anticollision systems [14], and so on. Its basis is analyzing the variation of phase or time-of-flight (TOF) between the transmitted and reflected ultrasonic wave from the object in the ultrasonic distance measuring system [5, 6]. The former method based on phase analysis requires a whole period of sampling for Fourier transform and is not suitable for real-time measurement. In comparison, the latter one TOF-based is easy and simple to handle [7, 8], which can be classified as variable threshold detection and cross-correlation function method [911]. The working principle of the TOF method is to calculate the duration of propagation of the ultrasonic signal between the transmitter and the receiver. Since the energy of the ultrasonic signal wave is extremely weakened during transmission, the signal-to-noise ratio (SNR) of the echo signal is low. Therefore, accurately locating the position of the echo signal is significant for the ultrasonic signal processing of the measurement. A number of scholars have deeply researched in this area and proposed many signal processing methods.

Considering the measurement accuracy of distance largely depends on the quality of the determined TOF, aiming at these problems above, Wu et al. [12] proposed a method easy to implement in hardware; however, it shows a good measurement result only if the signal-to-noise ratio (SNR) is relatively low. Liang et al. [13] and Brassier et al. [14] proposed to extract the stable feature of points located in echo signals based on cross-correlation algorithm, but it needs large computation and also cannot work in real time. Recently, data envelopment analysis (DEA) has been introduced to calculate TOF by extracting the feature points of echo signals. For example, Angrisani et al. [15] gave a model based on unscented Kalman filtering to estimate TOF by the start and end time of the envelope. Although it can provide a wealth of information, the measurement accuracy and range are unsatisfactory due to the starting point of the echo signal being regarded as the feature position, and the small amplitude of starting point will be disturbed by noise.

In this paper, we propose to improve the measurement accuracy of TOF based on moving sine-wave fitting (MSWF) and linear interpolation algorithm. Figure 1 shows the echo signals of known distance, the half-peak point of the envelope curve is defined as the absolute feature point (AFP), and a peak point near the AFP is expressed as the relative feature point (RFP). The mathematical relationship between the distance l and the sampling sequence of RFP can be established, which converts the distance measurement to the calculation of RFP’s sampling sequence value, thus making the measurement result more noise-resistant and accurate. Owing to the limitation of sampling frequency and noise jamming, average values of repeated measurements at the same distance are used to eliminate random error. The RFP’s sampling sequence can be calculated using the average one of AFP and the average feature offset (FO) [16]. In the ranging process, the AFP is obtained from the envelope curve which is calculated by the MSWF algorithm. The FO, computed by the linear interpolation with AFP, is applied to the calculation of the RFP’s position. After the final compensation of phase method, the accurate distance can be obtained by the mathematic relation between the RFP’s sampling sequence and the distance. This method combines both the high accuracy advantage of phase detection and the absolute measurement advantage of TOF [1217].

2. Theory

2.1. Echo Envelope Calculation Using Moving Sine-Wave Fitting Algorithm

In the ultrasonic ranging, the echo signal reflected from an object is a modulated sine-wave [18], hence the measurement data Y with interval Δ = 2π/n and length N can be fit recursively according to the moving sine-wave fitting algorithm.

For measurement data, Yk = {yk, yk+1, yk+2, …, yk+n} in data Y, the amplitude of the sample data can be considered as constant within one cycle. Therefore, the formulation of the Yk can be expressed aswhere Ak, θk, ck, and εi represent the amplitude, the phase angle, the offset, and the random error, respectively. Obviously, equation (1) can be also be rewritten aswhere parameters a and b satisfied the following constraint condition as

The problem to calculate the echo envelope, therefore, is converted to determine a and b, and they can be obtained by using the least square method as

The optimal solution in the fitting problem can be obtained at the extreme point in the function of the right part in equation (4). Hence, by taking the partial derivative on ak, bk, and ck, we can obtainwhere the transmission matrix S and T can be expressed as

Once the parameters ak, bk, and ck are calculated, the formulation of the measurement data in one cycle are determined, and by moving the measurement data from y1 to yNn+1, all the expression curves of the measurement data can be represented, as shown in Figure 2.

In order to reduce the amount of calculation in the fitting process, the parameters ak and bk are calculated recursively with the moving sine-wave fitting algorithm, since the transmission matrix Sk of the Yk can be described as

Then, the transmission matrix Sk+1 of the Yk+1 can be formulated as follows:

According to the proposed method, all the measurement data and amplitude A2, A3, …, AN, of the echo can be obtained reclusively once the Y1 is calculated. Therefore, the proposed method can be well applied to avoid the redundant calculation, and the echo envelop is obtained once all the amplitude is determined.

2.2. Determination of the Relationship between RFPs and Distances

Generally, there is the fluctuation of the echo signal in any position, and the range of fluctuation can be as large as one sampling interval. Therefore, the position of AFP should be located at the half of the peak with the largest inclined rate point, which gets the closest fluctuation range in the X-axis. From the calculated amplitudes of echo envelope including A1, A2, …, An, the half of peak Amax is determined as AFP, whose sampling sequence is denoted by M.

Because the sampling sequence of AFP is easily disturbed by random noise or the other echo, for a given group of calibrated distances L = {l1, l2, …, lj, lj+1, …, lN} with the same step of ∆l, the sampling sequences M = {M1, M2, …, Mj, …,MN} corresponding AFPs can be determined. When the RFP1 of l1 is selected as the value nearest AFP1 in echo, the next RFP2 will move a distance ∆x = ∆l · f/ (f and are the sampling frequency and ultrasonic velocity, respectively) and also locate in a specific peak theoretically. Then, the sampling sequences MR = {MR1, MR2, …, MRj, …, MRN} of RFPs are linear related to the distance on the measure, which can be calculated according to the above rule.

If the calculated RFP of the distance on measure does not coincide with a peak located in echo, equation (9) based on linear interpolation is utilized to acquire the feature offset FOx, which equals to the difference between the sampling sequence of RFP and AFP, as shown in Figure 3.where Mx denotes the sampling sequence for the distance on measure. Further, wrapped phases of echo are analyzed to improve the accuracy of measurement distance, whose description is expressed aswhere ai and bi are the coefficients of the sine and cosine waves described in equation (2), respectively, as shown in Figure 4. In the last, the sampling sequence MRx of RFP corresponding to the distance on the measure can be obtained bywhere θc is calculated by equation (10), c = Mx + Fox, f is the sampling frequency, and F is the transmitted frequency of ultrasound.

3. Experiments and Result Analysis

The sketch of the ultrasonic ranging system applied here is shown in Figure 5. A signal Nsig. with the frequency of 1 Hz is generated to control MCU A and B simultaneously, and then a square wave containing eight pulses with the frequency of 40 kHz is excited from the transducer Tx. By sampling the echo signal with the frequency of 1 MHz, the distance between two transducers can be successfully calculated.

In order to determine the distance effectively, a calibration process is conducted to define the formulation between the distance and the sample sequence. Measurement is performed at every 5 mm and distance group l = {l1, l2, l3, …, l25} is recorded correspondingly. Hence, according to the proposed model which shows the relationship between Mex and lx, the distance measurement can be easily obtained by linear interpolation.

During the experiment, the sound velocity is assumed as 346 m/s under a temperature of 25.7°C, and ∆x is about 15. In order to reduce the interference of noise, the AFP and RFP sequences are averaged with ten measurements, as shown in Table 1.

The relationship between the feature offset (FO) and the AFP’s sample sequence is shown in Figure 6. It can be seen from Figure 6 that the FO obtained in each measurement does not exceed two ultrasonic cycles, namely, the RFP will not be too far from the AFP. Meanwhile, an obvious relationship between the FO and the AFP’s sampling sequence value can be perceived with the similar correspondence at each measurement, so the average measurement data in Figure 6 can be used as the sample of the linear interpolation. Furthermore, a good reproducibility can be verified from the consistent figures.

Substituting the sampling sequence value of the randomly measured 48 AFP (M) into equation (11) to calculate the RFP’s compensation value MR, the RFP-distance relationship and the AFP-distance relationship can be established, which is presented in Figure 7.

As shown in Figure 7, the linear correlation coefficient (LCC) between MR and the distance is 0.806, and the LCC between the M and the distance is 0.682. Besides, though the sampling sequences of both the AFP and the RFP overlap at some specific distance, the higher LCC can be reached at the RFP sampling sequence. The result proves that the RFP’s sampling sequence value is much closer to the actual distance and verifies the proposed method effectively.

By fitting the curve in Figure 7, the equation between the standard distance and the RFP’s sampling sequence value can be expressed as

Therefore, the distance ln can be easily calculated once the RFP sampling sequences are determined. Compared with the standard distance measured by the grating ruler ls, the distance error can be represented as Δl = ln − ls, and the error distribution of 48 random RFP sampling sequences is shown in Figure 8 in percentage form. The results measured using RFP are significantly better than those using AFP. In addition, the error fluctuation of the measurement system is random, and the standard deviation of the results of the 48 groups measured using RFP is δ = 0.171 mm. According to the 3δ evaluation principle, the measurement accuracy of this method is ±3δ = 0.513 mm. By contrast, the standard deviation of the distance error obtained by fitting the AFP’s sampling sequence value (M) with standard distance is 0.387 mm and the measurement accuracy is 1.161 mm. Therefore, the measurement accuracy is improved by 55.8% within our proposed method, and a great potential advantage is discovered in the application of high-precision ultrasonic measurement.

4. Conclusions

In this work, we proposed MSWF to extract the envelope curves rapidly from echo signals without iteration. Then, the AFP was described as half-peak point in the ultrasonic ranging TOF based, which can be determined in the measurements, and the FOx is interpolated from AFP and the feature offsets on the known distances obtained ahead during the calibration test. Then, the RFP can be located quickly, and we readjusted the position of RFP applying phase analysis further. When the measurement distance is within 50 mm∼170 mm, the measurement accuracy is 0.513 mm, and the LCC is 0.806. Experiments show that the localization method of RFP has the capability of noise suppression and the ranging method has higher accuracy and application potential [19–21].

Data Availability

The data used to support the findings of this study have been deposited in the UltrasonicData repository (https://github.com/XBCMZ-kaka/UltrasonicData).

Conflicts of Interest

The authors declare that they have no conflicts of interest.

Acknowledgments

This work was supposed by the Educational Commission of Hubei Province of China (D20201401) and the open fund from the Hubei Key Laboratory of Manufacture Quality Engineering (KFJJ-2020004 and KFJJ-2020012).