Evaluation of Ultrasonic Sensor for Precision Liquid Volume Measurement in Narrow Tubes and Pipes

.


Introduction
The autonomous measurement of liquid volume has multiple applications in the fields of precision agriculture and precision livestock farming, both in operations and development of new technologies.Such technologies could include water intake monitoring in livestock, sprayer nozzle analysis, and chemical tank level monitoring [1][2][3][4].Of particular interest is the liquid volume measurement for sprayer nozzle patternator tables.These tables measure the lateral pattern of a sprayer nozzle in the direction of travel, which is a crucial component of plant protection in chemical application [5,6].Historical versions of such tables rely on manual volume measurement with low pattern resolution from 50 to 25 mm of width [3,5,7].While there have been versions of spray tables utilizing automated mass measurement to determine spay pattern and flow, the implementation of higher resolution tables presents costs and implementation challenges [8].Increasing the patternator's resolution results in added need for automatic volume measurement, as each segment of the resolution must be measured, with lower volumes in each resolution.A measurement application with the ability to measure the volume of the liquid has the best implementation potential for a high-resolution patternator.
Accurately measuring the volume of a liquid in a container can be achieved by measuring the liquid level in a container with a known cross-sectional area.It is common to utilize level-measurement techniques such as mechanical floats, electrical methods, or non-contact measurement, with ultrasonic sensors being the preferred option [9,10].Ultrasonic sensors are the preferred noncontact sensor as the frequency spectrum of the ultrasonic signal is highly reflective off the surface of a liquid and will minimize measurement errors that could occur with sensor frequencies that penetrate the air-liquid boundary [9,10].Ultrasonics offer the ability to sense liquids without the use of physical objects as a float; however, the sensing pattern of an ultrasonic can present challenges due to the size of the pattern and the fact that if multiple objects are introduced in the sensing cone, errors occur [11].The additional downside of ultrasonics is what is referred to as the "Dead Zone", which is an area immediately in front of the sensor face where detection is impossible [10].Lasers are unable to sense liquid surfaces with shallow heights as the laser wavelength will penetrate the liquid surface and reflect off the bottom of the measurement vessel, due to the low reflectivity of water [9,12].The ultrasonic option carries much less risk for unpredictable errors as it is naturally capable of sensing liquid surfaces and is the preferred liquid level measurement option.
For the highest accuracy possible when utilizing a sensor, the calibration process must be completed and evaluated against the system requirements for the sensor.The process of calibrating a sensor commonly references two main factors that relate to sensor performance, intrinsic, and extrinsic factors, and thus intrinsic and extrinsic calibrations [13,14].Intrinsic factors are factors relating to the sensor itself (materials, lenses, etc.) and how that impacts its measurement [13].It is common for sensors to be intrinsically calibrated by the manufacturer for basic installations [14].Extrinsic factors are those related to how the sensor is deployed in the applications and how those factors impact the sensor's measurements [13,14].The process of extrinsic calibration is the most successful at removing errors when performed under the similar conditions the sensor will perform in the application [10,[14][15][16][17].This process is also referred to as a static calibration, where the sensor's output is measured in respect to known or "true" values [18].These true measurements are determined based on the specific sensor and application being evaluated.Thus, without accurate calibration prior to operation of a sensor in any given application, unknown errors will exist in the measurement system, reducing the accuracy and precision on the system.
In the quest for the development of high accuracy and high throughput measurement of liquid volumes in a nozzle patternator table, an evaluation of an ultrasonic sensor was undertaken with the overall goal of evaluating the ability to sense in narrow tubes and pipes that are smaller than the specified rating by the manufacturer and select which tubes and pipes may be best suited for liquid volume sensing.The following objectives were derived to achieve this goal and to test the hypothesis according to which the selected ultrasonic sensor would perform differently in various sizes of tubes and pipes: (1) to develop calibration curves for the same ultrasonic sensor across various narrow tubes and pipes selected and compare them to the curve for the pipe in the manufacturer's specifications, (2) to evaluate the calibration curves on an operational set of data, and (3) to quantify the uncertainty associated with each tube and pipe; to ultimately identify the highest accuracy and precision option for use with the ultrasonic sensor.

Experimental Set-Up and Instrumentation
A combination of three unique diameter round pipes and three unique square tubing sizes (Figure 1, Table 1) were evaluated in this study.Pipe B is the diameter stated in the manufacturer's specification for the ultrasonic sensor and serves as the control in each test for comparison.The additional pipes were selected due to commercial availability and were one size larger and smaller than Pipe B. Each tube and pipe was prepared by cutting a 610 mm section, sealing one end of the pipe or tube.Initial attempts to calibrate the sensor by adding water through the open end of each tube and pipe presented significant issues with non-typical sensor response caused by condensation on the pipe and tube walls.Due to this, all experiments were completed by adding water through the bottom of the tubes and pipes through a secondary tube.A plastic hose barb to NPT threads 6 mm, 90 • fitting was installed in the sealed end by drilling a 11 mm hole and threading the fitting with liquid thread sealant, Figure 1a.This was performed on all six experimental units to provide identical conditions in the bottom of the units.The water was added through the bottom of the tube, as the water droplets created by pouring water through the top of the tube or pipe created sensor errors in reading.Each tube and pipe were individually attached to a support structure to hold it upright, Figure 1b.A clear, flexible hose, 600 mm length minimum, was attached to the barb fitting and a 60 mL disposable syringe was installed on the other end of the hose.
The ultrasonic sensor (UM30-213113, SICK, Inc., Waldkirch, Germany) was installed with a mounting bracket such that the face of the sensor was 15 mm above the end of the tube or pipe when taking measurements.This specific ultrasonic sensor was selected as the manufacturer claimed a viewing pattern suitable for a 27 mm diameter pipe.The same sensor was utilized for collecting data for all tubes and pipes.The analog voltage output of the sensor was measured using a digital storage oscilloscope (DSO, Model 2510, BK Precision, Yorba Linda, CA, USA).This analog signal is preconditioned to the range specified by the manufacturer (200 mm to 1300 mm) During all tests, the sensor was sampled at 2 Hz, with the DSO recording the instantaneous voltage reading and time stamp for each sample.

Calibration Data
Data were collected using the following procedures to perform a static calibration of the sensor for each tube and pipe.Static calibration is the process of regressing sensor measurements against known "true" values [18].The liquid volume was added in set intervals to the pipe or tube to serve as the "true" standard to calibrate the sensor to.Water was measured in a 100 mL, ±1 mL, graduated cylinder.The specified volume was poured into the flexible tubing by using a funnel.The funnel was removed from the tubing and a 60 mL syringe full of air was attached to the tubing.Air was pushed into the tubing until all water was pushed into the tube or pipe, with a visual indication of no water in the flexible tubing.Prior to any measurements, increments of 10 mL were added until the water levels were above the fitting in the bottom of each pipe or tube to give the ultrasonic sensor a flat-water surface to read.During the calibration, water was added in 15 mL increments until the water level entered the ultrasonic sensor's no-read zone (200 mm from the face of the sensor).Regardless of tube or pipe size, the same volumetric increments were utilized for the calibration and 15 mL was selected such that the smallest tube would have a minimum of a five-point calibration curve.Data were recorded for 45 s at 2 Hz starting at five seconds.
After, all the water was pushed out of the flexible tubing with the DSO.The statistical analysis will be discussed in later sections.

Operational Performance
Following the previously mentioned data collection procedure for data recording and adding water to each tube, each tube and pipe was evaluated for operational performance.This was completed by measuring the baseline level of the tube then adding a known volume of water, starting at 25 mL, and increasing in 25 mL increments up to the limit of the calibration.Between each measurement of a known volume of water, the tube was emptied back to the base level of water and a base level reading was recorded.The aforementioned calibration equations were applied to the data collected.The residual value of the prediction was calculated.

Data Processing and Analysis
Data processing was completed in Python using a PyCharm IDE for software development [19].For the calibration data points, a randomly initiated, consecutive 30 s sample (n = 60) was averaged from each 45 s recorded sample.The change in the sensor's voltage was calculated as the average of the base reading minus the calibration increment's average reading.The change of height of water was calculated using the known total volume from the graduated cylinder at each calibration increment and the cross-sectional area which was determined based on the manufacturer's specification of the inside width or diameter, see Table 1, for the respective pipe or tube and using standard geometric equations for the volume of a cylinder or rectangular prism.Linear regression coefficients were determined using the Scikit Learn package within Python [20].This was achieved by fitting the change in height of the water as the independent variable (y-axis) and the change in voltage reading as the dependent variable (x-axis) [18].
The root mean square error (RMSE) of the calibration, standard error (SE) of the regression and of the calibration were calculated; the SE of the calibration was calculated by dividing the SE of the regression by the slope of the regression.The calibrated height of fluid was calculated from the change of voltage using the inverse of the previously described calibration equation (Equation (1)), [18].The slope coefficients were compared using analysis of covariance (ANCOVA) in statistical software [21] to test whether the slopes of the calibrations were statistically different.ĥ where ĥ = calibrated height difference in tube (mm) The calibration equation for each tube or pipe previously discussed was applied to the operational performance data.The volume calculation was determined by multiplying the calibrated height by the cross-sectional area for the respective tube or pipe, as seen in Equation (2).The residuals were calculated as the predicted height minus the known height (calculated from the volume added).The average residuals were calculated by tube and pipe.A residual plot, known height from volume (x axis), and residual value (y axis) was created to visualize trends in residuals from each tube/pipe.
where V = Calculated volume (mL)

Uncertainty Analysis
The final standard uncertainty of the volume measurement was calculated from the standard uncertainty obtained from the ultrasonic measurement and the cross-sectional area of the tube or pipe by propagating both through the respective volume equation.A zeroth-ordered uncertainty budget was created for input ultrasonic measurement pre D pre and post D post addition of the liquid and the cross-sectional area CSA T/P , which included the sensor manufacturer's accuracy and long-term stability and quantization error from the DSO (Table 2) and the standard error (SE) from the experimental data (operational performance), the SE was removed from the table as it changes with each experiment [22].The standard uncertainty ∆d i of the tube width or pipe diameter was determined as one half the reading scale set by the manufacturer's tolerance of the inside width or diameter (see Table 1 for manufacturer's information), Table 3.The combined standard uncertainty in the cross-sectional area was calculated by Equation ( 3), the methodology is based on the component error analysis [18].The operation data set for each tube and pipe, excluding P-A, were used to calculate the uncertainty.The combined standard uncertainty in the volume was calculated using Equation (4) [18].
where ∆A i = combined standard uncertainty in cross-sectional area (CSA) tube or pipe.
where ∆V 2 = combined standard uncertainty volume RMSE = root mean square error of the calibration (Equation (1))

Results and Discussion
The calibration of all tubes and pipes were successful with all combinations showing a linear response, as seen in Figure 2 and Table 4.All pipes and tubes tested resulted in linear characteristics in relationship to the distance to the water surface, which is expected for intrinsically calibrated ultrasonic sensors [10].The ANCOVA analysis showed that the slopes of the six linear regressions were significantly different, p < 0.05 as seen in Figure 3.The only pair of calibration that were not significantly different was the T-C and P-C p = 0.11, which notably have very similar CSA values.As all regression slopes were significantly different than P-B, the pipe for which the sensor is rated for, this demonstrates that the extrinsic factors under which an ultrasonic sensor is expected to perform can have a significant impact on the sensor's response.This result support the justification for performing static calibrations of the ultrasonic sensor under operational conditions with each tube or pipe, which is a suggested practice for such ultrasonic sensors [10,16,18].Based on the calibration data, the P-A is advisably not a well-suited vessel for liquid volume measurement using the ultrasonic sensor approach due to the farthest linear regression values from the sensor manufacturer's calibration.The P-B and P-C have calibrations that are closest in values to the sensor manufacturer's specifications, and thus have an advantage for liquid volume measurement.Similar studies have shown the use of ultrasonic sensors to be well fitted and accurate for the liquid level in similar type of containers, though with much larger diameters relative to the sensors' cone pattern [4].The operational performance data show how well the calibration, described previously, can be applied to new data for each tube and pipe, as seen in Figure 4.The exception was P-A, which was excluded due to catastrophic issues with the ultrasonic sensor failing to read any distances in the pipe.This is likely an issue with the sensor's cone angle interacting with the geometry of the pipe to cause errors in the sensor's readings resulting in the failure to measure.As the sensor is not rated for such diameter of pipe, it can be assumed that this interaction is not accounted for in the sensor's intrinsic calibration.Based on the average residual value, T-B is the top performing option with no bias or non-normality noted in the residuals, while P-B has a slightly higher average residual value with no bias or non-normality observed.The other options exhibit some type of pattern or abnormality in the residuals that raise concerns about their operational performance.
Based on the results of the calibration and the operational performance, it is evident that the use of this ultrasonic distance sensor in conjunction with tubes or pipes that are narrower than its cone angle violates some type of assumption in the intrinsic calibration conducted by the manufacturer and used to produce the sensor's analog output.Such ultrasonic sensors require an intrinsic calibration for the preconditioning of the analog signal [16].These results show that while the sensor worked well in the 27 mm pipe, it stills requires a calibration in the installed environment to maximize accuracy.
The relative expanded (coverage factor = 2; ~95% confidence level) uncertainty ranged from 10.2 to 10.5 mL depending on the tube/pipe for volumes ranging from 350 to 25 mL, respectively, as seen in Figure 5. Two major factors were identified as contributing the majority of the uncertainty: sensor accuracy and uncertainty in CSA.The sensor accuracy is equivalent to ± 11 mm of measurement, which is determined via the intrinsic calibration.Without selecting a different sensor or evaluating over-sampling methods, this source of uncertainty cannot feasibly be reduced in the system.The uncertainty in CSA increases with area linearly due to the tolerances from the pipe and tube manufacturers as the tolerances were inconsistent between manufacturers.Thus, the larger the tube or pipe, the large the uncertainty in the measurements.Addressing the CSA uncertainty in the future is the only feasible option for reducing the uncertainty in measurement.Utilizing a higher tolerance pipe or tubing would be the best approach.However, the overall holding capacity must be factored in as it will impact the system performance overall.

Conclusions
An ultrasonic distance sensor was calibrated for water level sensing to three square tubes and three pipes ranging from larger to smaller than the pipe the sensor manufacturer rated it for in the end use of water volume measuring.While all calibrations were successful showing linear characteristics and had high R 2 values (R 2 > 0.999), P-A (25.2 mm, smaller than rated size of 27 mm) had the slope that was farthest from the sensor manufacturer's specifications.This pipe also created significant issues for the sensor to read distances in following the calibration data collection and thus was not tested further.The operational performance of the sensor indicated that T-B and P-B had the highest accuracy based on the resulting residuals.The calibration and operational performance data indicate that using these vessels that are narrower than the sensor's cone angle violate assumptions in its intrinsic calibration that are resulting in the varying results noted here.This is likely due to the fact that the tubes and pipes created different extrinsic factors that lead to the errors noted.These calibration and operational performance results support the need to extrinsically calibrate an ultrasonic distance sensor.The relative uncertainty ranges from 2.9 to 42%, depending on the tube or pipe across a volume range of 350-25 mL.The largest factors impacting the uncertainty are the sensor accuracy and the CSA uncertainty.The larger the tube or pipe, the higher the uncertainty in the volume.Based on the results of this study, the top options for liquid volume measurement with the specific ultrasonic sensor used in this study are T-B (22.23 mm width smaller than the rated 27 mm pipe) and P-B (27 mm, same as the sensor manufacturer's rating).The use of a different ultrasonic distance sensor would require a re-evaluation of all tubes and pipes tested as it would most likely have different extrinsic factors than the sensor used in this study.

Figure 1 .
Figure 1.(1a) Experimental set-up sketch, (1b) picture of experimental set-up with (A) DSO and (B) ultrasonic sensor.All tubes and pipes are labeled with specifications provided in Table1.

Figure 2 .
Figure 2. Linear regression of height of water added (x axis) vs. change in voltage from the sensor (y axis) of each tube and pipe.The black line represents the manufacturer's calibration values.

Figure 3 .
Figure 3. Cross-section area of tube/pipe (x axis) versus the calibration slope (y axis).Points not connected by the same letter are statistically significant, p < 0.05.The black line represents the manufacturer's provided slope.

Figure 4 .
Figure 4. Residual values from the operational performance data set.

Figure 5 .
Figure 5. Absolute and relative uncertainty associated with the liquid volume measurements from each tube and pipe from the operational performance data.

Table 1 .
1. Tubes and pipes selected to evaluate the ultrasonic sensor on.
[a] Manufacturer stated accuracy 1% assumed to be full-scale accuracy.[b] Manufacturer stated accuracy of DSO analog voltage input.

Table 3 .
Standard uncertainty of the width and diameter and resulting cross-sectional area of the tubes and pipes.See Table1for manufacturer's information from which the inside width or diameter was collected as well as the respective tolerance of the measurement.