Development of Non-Contact Liquid Level Measurement and Data Storage System

The normal contact type liquid measurement devices have some drawbacks since they have potential damage due to the sensor fouling or corrosion since those are continuously exposed to the liquid. Especially flash flood may cause the damage of liquid level sensor. So that, it is important to design a non-contact device for liquid level measurement in order to avoid this constrain. Distance can be measured without contact such as laser, ultrasonic and radar. In this research, ultrasonic sensor is used to provide non-contact feature of the device since it is low cost and uses ultrasound waves rather than light. This vital sensing device is able to sense uneven surfaces, liquids, clear objects, and objects in dirty environments. This paper discussed the measurement of liquid level in a tank as well as storing historical data.


INTRODUCTION
This project is aimed at designing a device that can provide non-contact level measurement of a liquid tank.The meaning of non-contact here is that the device, which is used, for liquid level measurement is not put directly in liquid.Therefore, it will reduce the potential damage of device due to the sensor fouling or corrosion while it continuously exposed to the liquid.The damage might also occur because debris when there is flood.Besides, the non-contact device also allows for easy installation on a bridge or structure over the liquid as safe and easy position.
To provide non-contact feature of the device, ultrasonic sensor is used since it uses sound waves rather than light.It has different sensing capability like as uneven surfaces, liquids, clear objects, and objects in dirty environments.The cone-shape wave sound has transmitted by ultrasonic sensors where wave through in air.These sound pulses make echo and sound come back from the liquid surface and are in turn received by the sensor, which measures the time interval between the transmitted and received signal.Electronics device can be measured this distance based on sound speed where it in air [6].Additionally, distance can be measured various way like as laser and radar.However, because of their expensive price, they are only set on the minority of instruments.Thus, the research of the distance measurement system that consider the high ratio of ability and decreased value has ended at ultrasonic sensor.
9V battery has been used for PIC Microcontroller power, a 2X16 Liquid Crystal Display (LCD), and two MaxSonar-EZ1 ultrasonic Sensor.With a LCD, it will immediately display the height of the liquid level.With the RS232 personal computer (PC) link and Windows software, the data also can be logged into PC and a graph of the liquid level can be plotted.The proposed sensor is low-cost and reliable would be a useful device to measure the liquid level in a tank either at homes, open channel and waste reservoir.It also might be a prodigious agreement and required for the budding buyers.
2 OVERVIEW OF SONAR SYSTEM Sound Navigation and Ranging (Sonar) is a technique that uses sound propagation to steer, interconnect with or sense other vessels.Sonar might be used as a means of aural location and measurement of the echo characteristics of object in the liquid.Before the introduction of radar, acoustic location in air was used.There are two types of sonar technology which are passive and active sonar.Passive sonar devices will only receive the signal without transmit any signal.It is often used in military settings and in science applications such as fish location and various marine environments.On the other hand, active sonar device consists of a sound transmitter and receiver.A wave of sound could be called a "ping" is created, and then echo or reflections of the pulse will be measured.Sonar Projector has been generated sound wave by electronically.Signal generator, power amplifier and electro-acoustic transducer has been used for this projector.Sonar system had generated sound frequency from lower level to extremely high level.Humans are able to hear sound frequency from 20kHz to 20,000 kHz, where ultrasonic sound frequency range is higher.Music and common sounds that are considered pleasant are typically 12 kHz or less.Ultrasonic waves consist of frequencies which is larger than human lower frequency and it is exist in excess of 25 MHz and this range have used for several applications such as including plastic welding, medicine, jewelry cleaning, and nondestructive test.In nondestructive test, ultrasonic sound frequency has ability to travel in deep "see through" for detecting solid material or any other surface without affecting the material harmfully [1].The flowchart for appropriate selection of ultrasonic sensor is given below [6]: 3 SYSTEM DESIGN 3.1 System Architecture In Figure 3, a block diagram of the whole system architecture is presented.The system consists of a PIC 16F877 Microcontroller, two ultrasonic sensors, and a LCD for display.The system also provides a serial communication between the microcontroller and personal computer.The PIC Microcontroller will continuously take the analog signals from the sensors and will directly convert them to digital signal.In this system, no external analog to digital (ADC) is needed since it is already built in the PIC Microcontroller.

Liquid Level Calculation
The value that input by the sensors is the distance between the sensor and the liquid level and is denoted by d1 as shown in the figure below.So that, a calculation is needed in order to get the true liquid level of the tank and denoted as d2.The calculation is as follow: It is also very important to note that the values that given by the analog port of the PIC Microcontroller are not directly show the liquid level.It needs to multiply by a constant and in order get this constant, a simple calibration needs to be done.First, the sensor will put 50 cm above the liquid level or in other words when the liquid is full tank.The constant that need to be multiplied by current reading then calculated.Microcontroller would be used for controlling purpose which is PIC16F877.Data acquisition system will take data from sensors, convert them to analog, calculate the liquid level, and display on LCD as well as on the personal computer.The PIC16F877 has a 25 MHz processor and this compiler runs the processor at 20 MHz, where it has 33 input and output pins, FLASH program memory (8K*14words), RAM (368*8bytes), EEPROM (256*8bytes).This microcontroller runs the program form its own memory because it does not have any operating system.Additionally, PIC16F877 has several hardware features such as an analog to digital converter (ADC), interrupts, timers, and capture/compare/PWM channels.

The Max Sonar-EZI Ultrasonic Sensor
The MaxSonar EZ1 has specific detection range which is very short to long-range.Moreover, it required ultra-low power consumption.It has explicit object detection range, where the range starts from 0-inches to 254-inches and offers sonar range information from 6-inches out to 254-inches with 1-inch resolution.Objects from 0-inches to 6inches range as 6-inches.It has pulse width output, analog voltage output, and serial digital output for interface with output.The specifications of the sensor are given in the table below (Maxbotix, 2006).For any ultrasonic range finder, the beam width is a function of the sensor used and the system gain following the sensor.Gain capability of the MaxSonar EZ1 is actively and continuously adjusted with its system software where it has a long comparatively narrow beam.Figure 6 shows the specification of the MaxSonar EZ1.Majority of the objects are detecting in the central 36-degree zone.The authentic detection zone is look like a cone that extends from the front of the detector face (Maxbotix, 2009).

LCD Display
A (2X16) Liquid Crystal Display (LCD) is used to immediately display the reading from ultrasonic sensors.Two lines of the display space are suitable for the project since there two sensors reading.A total of 7 I/O pins of the PIC Microcontroller are used to communicate with the LCD.The specifications of the LCD display are given in the table below.

PIC Microcontroller Programming Flowchart
The PIC Microcontroller programming will be developed in C language and its flowchart is shown in the figure below.When the system is on, immediately the LCD will be initialized.The system then will take reading from ultrasonic sensor through analog pins of the PIC Microcontroller and convert them to digital.After that, the level of the liquid will be calculated and the result will be display on LCD as well as on personal computer.

PCW C Compiler
PCW C compiler is a most effective software for design and write the programming code of the project in C++ language.After writing a vital code for the sensor then it is essential to compile this code as a .hexfile and upload this file into the Microcontroller.Most benefits of this compiler is to provide higher level programming designer to solve their problem faster and more efficient.4 RESULTS AND DISCUSSIONS Firstly, there was a big challenge of using ultrasonic sensor to measure the level of liquid, because it was required to know the how many percent of signal is bounce back to sensor.The surface of the liquid is not suitable reflector of the transmitted signal.For that reason, a piece of polystyrene board (solid surface) is placed on the surface of the liquid as shown in the Figure 4.This will make the surface of liquid work as solid surface.
In system design part, it is shown how the level of the liquid in a tank is calculated.However, the value given does not present the real level of the liquid in centimeter (cm) unit rather than it shows the corresponding value to the voltage change.It is important to note that the value that comes from the analog port of microcontroller is always proportional to the distance of sensor from the liquid surface.After some experiments, we found that in order to get the liquid level in cm, the reading needs to be multiplied by 6.25 as below: Liquid level = analog reading X 6.25 Furthermore, the MaxSonar-EZ1 ultrasonic Sensor has some limitations that need to be considered when use it.In Figure 6, we can see that objects are detected mostly in the central 36 degree zone.So that, the sensor must be put freely without any obstacle in this region to make sure that it gives the correct value.The obstacles can be the wall of the liquid tank or other sensor that put close together.In addition, it should be noted that the sensor is not effective for the range below approximately 30 cm to 40 cm.Any measurement below this range should be avoided.

CONCLUSIONS
The objective of this project is to design and implement an ultrasonic sensor based liquid level measurement system.However, due to the sensor limitation, the maximum allowable height of the tank is only up to 6 meters.But changing sensor type, range can be increased accordingly.This research showed: 1.The system is able to detect liquid surface (polystyrene) within the sensing range.2. The system can calculate the liquid level with accepted accuracy.3. The system can also communicate with PC through its serial port and a real time graphs is formed.4. The system provides a lower cost and effective solution for noncontact type level measurements and historical data storage.
In addition, beside liquid level measurement, the device has numerous applications such as in automatic guided vehicles, measuring objects distances, and measuring the depth of pools or banks.It also can serve as a motion detector in production lines.The ultrasonic distance measurement has the great capability to adapt to various

3. 4 . 3
PIC Bootloader + PIC Bootloader + has a specific role which is being used to download the .hexfile of the source code into PIC Microcontroller.This software has a window to display the output of the code.The original of the Bootloader was made by Petr Kolomaznik (Czech Republic).PIC boot Plus is based on the Delphi sources (1.0.8.0 25.7.2001)provided by (C) 2000-2001 EHL elektronika.All enthusiasts developing PIC applications are free to use this software.