Ultrasonic Fluid Level Measuring Device

Accurate measurement of fluid level is very vital both in industrial and consumer market. Ultrasonic technology is one of the solutions used by the industry. However, an optimized balance between cost and features are a must for almost all target applications. The ultrasonic level measurement is used mainly when a non-contact measurement is required. Precise measurement of low-range distance (level) is the main objective for this project. This device can measure level in the range of 0.02m to 4m with an accuracy of 1cm. This measuring system is based on ultrasonic sound utilizing an Atmega328P low-power microcontroller. The system transmits a burst of ultrasonic sound waves towards the subject and then receives the corresponding echo. An HC-SR04 ultrasonic Module is used to both generate and detect the ultrasound required for level computation. The time taken for the ultrasonic burst to travel the distance from the system to the subject and back to the system is accurately measured. This level is displayed on an alphanumeric LCD with an accuracy of ± 2.5cm. The minimum depth that this system can measure is 2cm and is limited by the transmitter’s transducer settling-time. The maximum height that can be measured is 4 meters. The amplitude of the echo depends on the reflecting material, shape, and size. Sound-absorbing targets such as carpets and reflecting surfaces less than two square feet in area reflect poorly. The maximum measurable range is lower for such subjects. If the amplitude of the echo received by the system is so low that it is not detectable by the ultrasonic module, the system goes out of range. This is indicated by displaying the error message OOR (Out-of-Range) on the LCD. Keywords—Depth-measurement,echo,sensors, transmitter, Ultrasonic.


I. INTRODUCTION
Accurate, affordable and reliable level measuring technology is of great importance for industrial, domestic and other varieties of applications. Such applications include fuel storage, providing flood warning, in the biochemical industry and simple water level control in homes just to mention a few.
It has been observed that traditional liquid level sensors are based on electromechanical techniques which are said suffer from intrinsic safety concerns in explosive environments [1]. Level measurement control sensors used in many industries fall into two main types: Point level measurement sensors and Continuous level sensors [2].Continuous level sensors unlike point level measurement sensors measure fluid level within a range, rather than at a one point [2]. Various level measurement devices have been developed [2] particularly; optical fibre sensors for liquid level measurement have been extensively studied [3].
There are different methods of implementing level measuring processes among which are mechanical, capacitive, inductive, ultrasonic [4], acoustic [5], or optical [6]. While mechanical and ultrasonic methods are mainly applied in level of solid materials that are in the form of dust, it has been observed that capacitive and optical methods give better results in detecting the level of fluids [6,7,8]. Optical fibre sensors have many well-known advantages such as high accuracy, compact size, costeffectiveness and ease of multiplexing [9]. Many types of liquid level sensors using silica fibre gratings have been demonstrated [14][15][16][17][18][19]. Various literatures have also shown that most of these sensors exhibit some drawbacks such as low sensitivity [11,12], limited range [14,18,19], longterm instability [13], limited resolution [10,11], high cost [10] and complicated manufacturing. This paper presents the architecture and evaluation results for an embedded stand-alone fluid level sensor based on ultrasonic technology remote monitoring on the other hand combines both the features of localized monitoring and the ability to access the system state from a distance. Fluid level monitoring is a critical part of industrial processes, and its importance cannot be over-emphasized due to the criticality of system processes most often designed around such.

II. SYSTEM DESIGN
Ultrasonic non-contact measurement was chosen over other forms of non-contact measurement based on the under-listed reasons: 1. First of all, it is because of its speed. Ultrasonic waves travelled at speed of sound which is, 343 m/s. This kind of speed is not too fast for MCU's in Atmega to measure accurately. So, practically it will take about 20 ns (nanoseconds) for the wavefronts to reflect back from a surface located 3 m away. 2. Ultrasonic waves travels more narrow, like beam than normal sound wave. This actually helps the sensor detect the obstacles that are exactly in line with it only. 3. Ultrasonic waves are not hazardous to humans. 4. Ultrasonic requires very little system complexity to implement successfully.

III. SPEED OF SOUND
The speed which sound travels depends on the medium which it passes through. In general, the speed of sound is proportional (the square root of the ratio) to the stiffness of the medium and its density. This is a fundamental property of the medium. Physical properties and the speed of sound change with the conditions in the environment. The speed of sound in the air depends on the temperature. In the air speed is approximately 345 m/s, in water 1500 m/s and in a bar of steel 5000 m/s. A common use of ultrasound is for range finding. This use is also called sonar. Sonar works similarly to radar. An ultrasonic pulse is generated in a particular direction. If there is an object in the way of this pulse, the pulse is reflected back to the sender as an echo and is detected. Measuring the difference in time between the pulse transmitted and the echo received, it is possible to determine how far away the object is. Bats use a variety of ultrasonic ranging (echolocation) to detect their prey.

A. Sound reflection
To measure the distance of a sound signal transmitted, it needs to be reflected. This sound signal is a longitudinal sound wave that strikes a flat surface. Sound is then reflected, provided that the dimension of the reflective surface is large compared to the wavelength of the sound.

B. Surface
An ideal target surface is hard and smooth. This surface reflects a greater amount of signal than a soft, rough surface. A weak echo is the result of a small or soft object. This reduces the operating distance of an ultrasonic sensor and decreases its accuracy.

C. Distance
The shorter the distance from the ultrasonic sensor to an object, the stronger the returning echo is. Therefore, as the distance increases, the object requires better reflective characteristics to return a sufficient echo.

D. Size
A large object has more surfaces to reflect the signal than a small one. The surface area recognized as the target is generally the area closest to the sensor.

E. Angle
The inclination of an objects' surface facing the ultrasonic sensor affects how the object reflects. The portion perpendicular to the sensor returns the echo. If the entire object is at a greater angle, the signal is then reflected away from the sensor and no echo is detected.

IV. TEMPERATURE
The velocity of sound in a medium varies with temperature. So, the time taken by the sound to echo back to the receiver will vary and since this time of flight is proportional to the measured distance.
The measured distance will vary with the variation in temperature. Thus the variation in temperature introduces errors in the measurement.
The sound wave propagation speed in the air depends on the temperature. So, to measure the distance more correctly, it is necessary to compensate according to the temperature. The sound wave propagation speed can be calculated using this formula: V = 331.5 + 0.6 * T [m/sec] Where T = measured temperature (°C) An HC-SR04 COTS ultrasonic ranging module was used at the level sensing front-end. The module was interfaced with an Atmega328 8-bit microcontroller for computations and display on the LCD human-machine interface (HMI). The ranging module is capable of measurements from 2cm out to 4 meters, with a resounding accuracy. Its flexibility and ease of use compared with other available market offerings made it a choice sensor for use in this endeavor.
The HC-SR04 drives the transmitter transducer with a 12-cycle burst of 40-kHz square-wave signal derived from the crystal oscillator, and the receiver transducer receives the echo. The module sets an output pin high once the wave is transmitted, and keeps it high for the duration corresponding to the distance measured, or high for 38mS in the case of an out-of-range measurement.
The Timer1 in the Atmega328P microcontroller is configured for a 1-μs count resolution, which is more than adequate for this application. The measurement time base is very stable as it is derived from a quartz-crystal oscillator. The captured count is the measure of the time taken for the ultrasonic burst to travel the distance from the system to the subject and back to the system. The distance in inches from the system to the subject is computed by the microcontroller using this measured time and displayed on the LCD. Since the speed of sound is temperature dependent, the measured reading will be less accurate at temperatures other than room temperature. To offer reliability in accuracy of the computed distance, an LM35 temperature sensor is incorporated, and distance compensation was employed to allow the system to measure accurately over a wide range of temperatures. The measured distance and temperature data could also be stored in the flash memory if required. Table I gives an illustration of the spread in the speed of sound in air at different temperatures. This solidifies the argument in support of dynamic temperature-compensated adjustment of the reference sound velocity.

Table I Speed Of Sound In Air At Different Temperatures
The reference speed of sound used for calculating the actual distance between the ranging module and the process fluid surface was that computed from the temperaturecompensating code block shown below. The calculated temperature value was inputted into the temperature-compensation block to calculate the adjusted temperature-influenced speed of sound used for subsequent level calculations.
V. SYSTEM COMPONENTS The measurement system was designed around different subsystems. These subsystems comprise the power supply, microcontroller, liquid crystal display, temperature sensor. A simple 5-volt SMPS power block was used for system power source. The Atmega328p 8-bit microcontroller was adopted as it provides the required features needed for system realization, besides having an ample amount of FLASH memory size and RAM required for the arithmetic operations.
Temperature compensation was effected using the LM35 analog temperature sensor.
This sensor was selected because of its availability and most especially its linear temperature-output scaling, beside its wide-ranging measurement range.
As the speed of measurement was not required to be too fast (1-second interval), floating point operation calculation was used for precision. The ICCAVR High Level Language (HLL) C compiler was used for source code translation to hex files as it enabled the use of standard C functions and features to be used in the firmware.

VI. SYSTEM TESTING
This experiment was done at a 25ºC and that increased the error. It consisted of measuring the distance from the device to a flat wall. Six measurements were done in this experiment. A measuring tape was carefully used to measure the distance 5 times and the average taken then the device was used to measure the same distance. The results were tabulated and error evaluated. low-power temperature-compensated liquid monitoring system using ultrasonic sensors was developed. The system was tested and found to be running as expected. The features of the microcontroller were utilized to build an efficient system which was both low-power and was easy to maintain. The installation of the system is easy and makes it more compatible for different environments.
The temperature-correcting feature of the system was fully tested and worked satisfactorily.