Next Article in Journal
Energy Saving in an Autonomous Excavator via Parallel Actuators Design and PSO-Based Excavation Path Generation
Previous Article in Journal
Research on the Assembly Sequence Planning of a Construction Machinery Drive Axle Based on Semantic Knowledge
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Proceeding Paper

An Approach for Precise Distance Measuring Using Ultrasonic Sensors †

Faculty of Information Technology and Control, Azerbaijan State Oil and Industry University, 1010 Baku, Azerbaijan
Presented at the 1st International Electronic Conference on Machines and Applications, 15–30 September 2022; Available online: https://iecma2022.sciforum.net/.
Eng. Proc. 2022, 24(1), 8; https://doi.org/10.3390/IECMA2022-12901
Published: 15 September 2022

Abstract

:
Ultrasonic sensors are commonly used as affordable methods to measure distance in industry. However, the accuracy of their measurements is often low, especially when inexpensive sensors and reasonably low-priced equipment are used. In this article, a low-cost ultrasonic-sensor module which is used for threshold-detection techniques is examined. Several numerical techniques, such as the least square method (LSM), piecewise LSM, and the Vandermonde method were applied to the sensor data to increase the accuracy of the distance measurement. Eventually, the smart filter signal detection algorithm was applied to the sensor data and the results were compared. The smart-filter-signal-detection algorithm provides 0.4-millimeter accuracy. In order to achieve this accuracy, the environment temperature is taken into account.

1. Introduction

Of the measurements physical properties, the measurement of distance is often the most important. Distance measurement is essential for many applications, including autonomous robots, vehicle-parking systems, production facilities, fluid-level measurement, and many others.
There are many non-contact sensors currently available to measure distance: laser sensors, infrared sensors, and ultrasonic sensors. In particular, ultrasonic rangefinder sensors provide low-cost solutions and are easy to use. There are two main methods of distance measurement with ultrasonic-range sensors: the pulse-echo method and the continuous-wave method [1]. Distance measuring with the continuous-wave method requires more expensive equipment.
In order to improve the accuracy of ultrasonic-measurement sensors, additional equipment and methods are needed, such as Kalman filters [1], neural networks [2], and probability theory [3].
In a competitive-market environment, companies seek to optimize products and find cost-saving solutions, such as raising the quality of low-cost sensors without increasing the production cost. A few affordable ultrasonic-measurement solutions that increase accuracy up to centimeter level are available [4,5]. The main goal of research is to increase the accuracy up to the millimeter level, often using cost-effective sensors based on the time-of-flight (TOF) threshold-detection approach.
In this study, first, a test setup was assembled and a low-cot-sensor module is analyzed on it. Several numerical methods were then applied to the sensor data to improve accuracy. Each result is shown and discussed in this paper. At the end of the paper, the smart-filter-signal-detection algorithm is explained and the test results are shown.

2. Time-of-Flight Measurement Method with Threshold Detection

TOF is the time taken by an ultrasonic wave to hit an obstacle and return. Ultrasonic-distance measurement with the TOF method is based on the following physical parameters: speed of sound in the air; environmental factors; and time of detection of the reflecting wave. Equation (1) illustrates the relationship between these parameters:
D = V S · T 2
where D is a distance to be measured, V S is the speed of the sound, and T is the time-of-flight (TOF). Speed of the sound ( V S ) is the key parameter in ultrasonic-distance measurement and is sensitive to environmental factors such as humidity and temperature.
V s = 331.2 + ( C × 0.6 )
Equation (2) explains the change in sound speed due to temperature. C is temperature in Celsius. Humidity impact is usually negligible in practice, but temperature must be taken into consideration to measure the distance up to millimeter level. If the temperature changes by about 5 Celsius, the distance changes by about 3 mm in 1000 microseconds (the speed of sound is 342.3 m/s at 20 Celsius and sound distance taken is about 343.2 mm in 1000 microseconds).
Since measuring temperature accurately is not a difficult task, measuring the TOF time accurately is the critical measurement to determine distance using ultrasonic methods.
In the threshold method, TOF is measured as described in Figure 1. The first graphic shows a square wave signal from a pulse generator. The second graphic is TOF time and the third graphic illustrates the fluctuation in echo detector.

3. Test Setup

In the test setup, a 40-kilohertz ultrasonic-sensor module was used. It had two transducers (pulse generator and echo detector). For temperature measurement, analog sensor was used that guaranteed 0.5-Celsius accuracy, as mentioned in the datasheet. Atmega328P microcontroller was utilized to execute ultrasonic sensor and temperature sensor. The system was monitored by PC using MATLAB.
Internal 16-bit timer with 16-megahertz clock frequency was used for TOF-duration estimation. Prescaler value of the timer was set to 8. Therefore, it operated at 2 MHz, which provided 0.5 microseconds (0.01716 mm at 20 Celsius) of resolution. It was sufficiently accurate for the desired measurement.
As an obstacle, 25 cm × 40 cm plate was used and reference measurement was established by ruler, which was accurate to millimeter level, as shown in Figure 2. The ultrasonic sensor was placed 10 cm above the surface and ruler. Devices were placed on the rail system for precise sampling and testing. The length of the rail system was 50 cm.

4. Analysis of the Ultrasonic Sensor Module

The first analysis used the testing sensors without applying an improvement method. This analysis allowed the determination of the sensor-module characteristics. The distance was measured 100 times up to 500 mm and changes in the measurement were observed.
The measurement results showed fluctuations of up to 8 mm, as shown in Figure 3 and Figure 4. This is satisfactory performance if the accuracy needed is at the centimeter level. In order to measure down to millimeter level, it is necessary to increase the accuracy.
It was necessary to calibrate the sensor because the minimum measurement was always slightly more than the actual distance. In order to determine the temperature accurately, the temperature was measured 100 times and an average was taken. Several distance-measurement results (100 measurements for each distance) are shown in Figure 3 and Figure 4.
Sensor performance is not sufficient for millimetric measurements, as noted in previous studies on ultrasonic sensors, which showed fluctuation in measurements [1,3,6,7].
The results obtained using only one measurement (the maximum value was chosen to find the maximum value of the error) are shown in Figure 5.
If the sample data are taken in sufficient quantity, all the distributions approximately resemble a Gaussian distribution [8,9], so that the mean of the sample data gives an accurate result. There are studies on ultrasonic-sensor improvement using Gaussian distributions [3,5,10]. Most often, it was necessary to take 100 samples in order to obtain sufficient accuracy in the mentioned studies. Increasing the number of samples improves the accuracy of the measurement, but taking too many samples (much more than 100) increases the measurement time significantly, and not usefully. Therefore, 100 samples were taken using the sensor module, and the results were examined.
Figure 6 and Figure 7 show the measurement results obtained by averaging 100 samples. The measurements were taken between 100 mm and 500 mm at 1-centimeter intervals. Measurements using the mean value increased the accuracy.
The maximum-error value decreased from 13 mm to 8 mm. Moreover, the sum of squared error (SSE) decreased from 3010 mm2 to 1135 mm2. In addition to this, the results were not in a straight line, as seen in Figure 7. The measurement result that was obtained using the mean value was not sufficient to provide 1-millimeter accuracy. For this reason, additional techniques are necessary in order to achieve the desired precision. Increasing the sample size might increase accuracy, but it is not accurate when using larger numbers of samples, such ass up to 200, 300 or more. If the curve is not as expected, using curve-fitting techniques to fit the measurements to the curve can help to increase the sensitivity. For example, least-square fitting, piecewise-least-square fitting, and Vandermonde data-fitting approaches are preferred to increase the accuracy. The least-squares method (LSM) is the most suitable approach for error reduction, and a first-order equation was chosen to apply the LSM. However, the nonlinearity of the curve obtained from the measurement results caused uncertainty about obtaining 1-millimeter accuracy after the LSM method was applied. For this reason, the piecewise LSM and Vandermonde methods were applied in the measurements to achieve more accurate results.
As shown in Figure 8, the LSM reduced the error rate slightly. However, the measurements still had an unacceptable error rate. The LSM method found the optimal first-order-equation parameters using sample data, but the few sample points shown in Figure 9, below, were not exactly over the polynomial line. The error results from the sample points mentioned above were not over the fitting line. The LSM method decreased the errors but did not sufficiently minimize them in this study. Therefore, the piecewise LSM (PLSM) method was applied to the sample data in order to decrease the error values much more than the LSM method.
As shown in Figure 10, the PLSM method reduced the error value much more than the other methods and reduced the maximum-error rate from 5 mm to 2 mm. The SSE decreased from 1135 to 25.8.
The measurement errors therefore decreased to 2 mm. In addition, 80% of the error values lay in the 1-millimeter range. These measurement results are encouraging. Moreover, the error rates might decrease with additional work, and these results were obtained using sample data. For this reason, real-time testing is necessary to demonstrate the true performance of the PLSM.
The last curve-fitting approach was the Vandermonde Method (VM). The VM method was expected to perform well because an nth order polynomial function was used to fit the curve. As shown in Figure 11, the VM method showed a satisfying performance. The maximum-error value did not exceed 1.5 mm and, as with the LSM, real-time tests were necessary to show the real performance of the VM. Therefore, the PLSM and VM methods were tested in real time. The specified distances were measured repeatedly to determine whether the method was stable.
When the measurements were repeated, the error rate was mostly under 2 mm in the PLSM method and the VM method, but the results were variable. Variable results are unacceptable. In order to increase sensitivity, it is necessary to search for other ways to obtain more accurate results without increasing the number of samples.

5. Smart Filter for Threshold-Detection Technique

The measurement results above were not satisfactory. For this reason, the sample was analyzed again, more thoroughly, to increase the accuracy without increasing the number of samples. In the smart-filter approach, the detected signals were grouped and examined. The correct measurement time was selected by using the previous characteristics of the sensor.
After the smart-filter-true-measurement detection algorithm was applied, the test results and graphs were:
In Figure 12, it is shown that the error rate never exceeded 1 mm. It was mostly below 0.4 mm. The results satisfied the intended sensitivity and accuracy values. At the same time, the measurement results were much better than the datasheet results at the distances targeted. The real-time test results showed the same accuracy. As a result, after filtering, the accuracy of the measurements was increased at a high level. Moreover, the measurement results were sustainable.

6. Conclusions

This research proposes that highly accurate distance measurement can be achieved using a low-cost sensor. The raw data from an ultrasonic sensor that measures distance by a threshold method were examined. The measurement values were modified and compared using the least-squares method, the Vandermonde Method, and the smart-filter-true-measurement method. The least-squares method and the Vandermonde method increased the accuracy of the sensor module up to 1 mm, but not to the desired level. Using the smart-filter-true-measurement detection algorithm, the accuracy of the ultrasonic sensor was increased beyond the specifications of the sensor. In order to achieve 1-millimeter accuracy and better, the ambient temperature has to be continuously measured in real time.

Funding

This research received no external funding.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Informed consent was obtained from all subjects involved in the study.

Data Availability Statement

Not applicable.

Conflicts of Interest

The author declares no conflict of interest.

References

  1. Angrisani, L.; Baccigalupi, A.; Moriello, R.S.L. Ultrasonic-Based Distance Measurement Through Discrete Extended Kalman Filter. In Kalman Filter Recent Advances and Applications; IntechOpen: London, UK, 2009. [Google Scholar]
  2. Carullo, A.; Ferraris, F.; Graziani, S.; Grimaldi, U.; Parvis, M. Ultrasonic distance sensor improvement using a two-level neural-network. IEEE Trans. Instrum. Meas. 1996, 45, 677–682. [Google Scholar] [CrossRef]
  3. Majchrzak, J.; Michalski, M.; Wiczynski, G. Distance estimation with a long-range ultrasonic sensor system. IEEE Sens. J. 2009, 9, 767–773. [Google Scholar] [CrossRef]
  4. Khoenkaw, P.; Pramokchon, P. A software based method for improving accuracy of ultrasonic range finder module. In Proceedings of the 2017 International Conference on Digital Arts, Media and Technology (ICDAMT), Chiang Mai, Thailand, 1–4 March 2017; pp. 10–13. [Google Scholar]
  5. Intharasombat, O.; Khoenkaw, P. A low-cost flash flood monitoring system. In Proceedings of the 2015 7th International Conference on Information Technology and Electrical Engineering (ICITEE), Chiang Mai, Thailand, 29–30 October 2015; pp. 476–479. [Google Scholar]
  6. Licznerski, T.J.; Jaroński, J.; Kosz, D. Ultrasonic system for accurate distance measurement in the air. Ultrasonics 2011, 51, 960–965. [Google Scholar] [CrossRef] [PubMed]
  7. Amiri, R.; Behnia, F. An Efficient Weighted Least Squares Estimator for Elliptic Localization in Distributed MIMO Radars. IEEE Signal Process. Lett. 2017, 24, 902–906. [Google Scholar] [CrossRef]
  8. Khoury, R.; Harder, D.W. Numerical Methods and Modelling for Engineering; Springer: Berlin/Heidelberg, Germany, 2016. [Google Scholar]
  9. Rice, J. Mathematical Statistics and Data Analysis; Nelson Education: Scarborough, ON, Canada, 2006. [Google Scholar]
  10. Xu, L.; Ding, F. The parameter identification method for the over-damping system based on the Newton iteration. In Proceedings of the 2017 29th Chinese Control And Decision Conference (CCDC), Chongqing, China, 28–30 May 2017. [Google Scholar]
Figure 1. TOF measured in the threshold method.
Figure 1. TOF measured in the threshold method.
Engproc 24 00008 g001
Figure 2. Test setup.
Figure 2. Test setup.
Engproc 24 00008 g002
Figure 3. Fluctuations in the measurement results by short distance.
Figure 3. Fluctuations in the measurement results by short distance.
Engproc 24 00008 g003
Figure 4. Fluctuations in the measurement results when measuring a distance of 500 mm.
Figure 4. Fluctuations in the measurement results when measuring a distance of 500 mm.
Engproc 24 00008 g004
Figure 5. Fluctuations of measurement results by one measurement.
Figure 5. Fluctuations of measurement results by one measurement.
Engproc 24 00008 g005
Figure 6. Measurement results obtained by averaging 100 samples.
Figure 6. Measurement results obtained by averaging 100 samples.
Engproc 24 00008 g006
Figure 7. Fluctuations in measurement error.
Figure 7. Fluctuations in measurement error.
Engproc 24 00008 g007
Figure 8. Fluctuations in measurement error by using LSM.
Figure 8. Fluctuations in measurement error by using LSM.
Engproc 24 00008 g008
Figure 9. Measurement results obtained by averaging 3000 samples.
Figure 9. Measurement results obtained by averaging 3000 samples.
Engproc 24 00008 g009
Figure 10. Fluctuations in measurement error by using PLSM.
Figure 10. Fluctuations in measurement error by using PLSM.
Engproc 24 00008 g010
Figure 11. Fluctuations in measurement error by using VM.
Figure 11. Fluctuations in measurement error by using VM.
Engproc 24 00008 g011
Figure 12. Fluctuations in measurement error by using smart-filter approach.
Figure 12. Fluctuations in measurement error by using smart-filter approach.
Engproc 24 00008 g012
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Aliew, F. An Approach for Precise Distance Measuring Using Ultrasonic Sensors. Eng. Proc. 2022, 24, 8. https://doi.org/10.3390/IECMA2022-12901

AMA Style

Aliew F. An Approach for Precise Distance Measuring Using Ultrasonic Sensors. Engineering Proceedings. 2022; 24(1):8. https://doi.org/10.3390/IECMA2022-12901

Chicago/Turabian Style

Aliew, Fuad. 2022. "An Approach for Precise Distance Measuring Using Ultrasonic Sensors" Engineering Proceedings 24, no. 1: 8. https://doi.org/10.3390/IECMA2022-12901

Article Metrics

Back to TopTop