Ultrasonic Water Level Indicator and Identification Using AVR Microcontroller
Ultrasonic Water Level Indicator and Identification Using AVR Microcontroller
Ultrasonic Water Level Indicator and Identification Using AVR Microcontroller
CHAPTER 1
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.
Level measurement control sensors used in many industries fall into two main types: Point
level measurement sensors and Continuous level sensors .Continuous level sensors unlike
point level measurement sensors measure fluid level within a range, rather than at a one
point. Various level measurement devices have been developed particularly; optical fibre
sensors for liquid level measurement have been extensively studied .
There are different methods of implementing level measuring processes among which are
mechanical, capacitive, inductive, ultrasonic, acoustic, or optical. 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. Optical fibre sensors have many well-known advantages such as high
accuracy, compact size, cost-effectiveness and ease of multiplexing. Many types of liquid
level sensors using silica fibre gratings have been demonstrated. Various literatures have
also shown that most of these sensors exhibit some drawbacks such as low sensitivity ,
limited range, long term instability, limited resolution, high cost 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 overemphasized due to the criticality of system
processes most often designed around such.
CHAPTER 2
LITERATURE SURVEY
The sensing principle of the POF sensor developed here is well-known and is based on the
loss of total internal reflection of the optical signal as the sensor probe comes in contact
with the liquid. Compared to optical fibre-based sensors reported previously in the
literature, the probe profile used in this study differs in terms of its simplicity in design,
while exhibiting an excellent signal intensity loss ratio without the need for additional
attachments to the probe such as optical prisms. The tests carried out showed that the POF
sensor is capable of detecting a variety of fluids. Exhibiting good signal stability, the sensor
also detects the liquid level reliably when the liquid rises or falls to the predetermined level.
The responsiveness of the optical fibre sensor was evaluated by simulating different rates at
which the liquid rises by immersing the sensor tip into the liquid and vice-versa at various
speeds ranging from 1 mm/min to 500 mm/min.
B. Yun and N. Chen[2](2007) A highly sensitive liquid-level sensor based on etched fiber
Bragg grating (FBG) is proposed and demonstrated. Liquid level sensing is important in various
areas like fuel storage systems, chemical processing, and other applications. Electrical liquid-level
sensors are widely employed, but their applicability is limited if the liquid to be monitored is
conductive, potentially explosive, and erosive. While optical fiber sensors offer many advantages
under these rigorous conditions because they are made of dielectric and thus are nonconducting
and anti-erosion, also they are immune to electromagnetic interference. The transmission dips of
FBG spectra are affected by the fraction of the length of the etched FBG that is surrounded
by the liquid.
The transmission ratios of FBG spectra are modulated by the liquid level. The experiments
show that for a liquid-level variation of 24 mm, the difference between the transmission
ratio of FBG in air and that of FBG in liquid changes about 32 dB. Also in the linear region, a
high sensitivity of 2.56 dB/mm is achieved and the sensor can be configured to be
independent of temperature.
The gauge functions on an optical principle consisting of a single LED and only one
photodiode. LEDs are much less expensive and much easier to replace than the ones in.
Also, it is based on the difference in the intensity of light circulating through an optical fiber,
and thus the mechanism is very simple compared with far more complicated liquid-level
sensor based on the refractive-index sensitivity of long-period fiber-optic gratings. The
overall system is equipped with a visual and audible alarm which can be regulated to any liquid
height. Another specification is that the gauge is controlled by a PC capable of storing the data in the
memory, printing them or sending them in real time by Internet to distant points.
In this paper, we have identified the paths of the acoustic energy at the levels where periodic echoes
are observed. We have found evidence to suggest that mode conversion occurs between A0 -mode
Lamb waves in the tube wall and bulk waves in the water. We find that the thin-walled tube exhibits
similar characteristics to those reported on the thin plate in terms of its support of an, A new A0
wave and its leakage of acoustic energy into water.
G. Betta[5](1996) The paper proposes a digital level transducer based on an optical fiber
from which the cladding was removed in n zones at fixed distances from one another. A
theoretical analysis of the propagation in this type of modified fiber was carried out,
highlighting the good potentiality of the proposed sensor. A 1 m full-scale, 25 mm resolution
prototype was then designed using the results of a numerical simulation, and set up by
optimizing both the sensing element and the conditioning hardware. The static and dynamic
characterization tests carried out show high repeatability, good accuracy, and acceptable
dynamic performance.
In this paper, an optical fiber, digital level transducer was proposed. It exhibits an accuracy
equal to its resolution, no hysteresis, and high repeatability. Its dynamic characteristics,
mainly the maximum liquid-level variation speed, are already acceptable if it is used in tanks
with a height of several meters. It has to be noted that both static and dynamic sensor limits
could be overcome by more sophisticated manufacturing techniques. The resolution could
be easily enhanced using techniques that allow smaller unclad zones on the fiber to be
obtained. Further improvements could be achieved through a suitable integration of the
conditioning hardware.
CHAPTER 3
HC-SR04 distance sensor is commonly used with both microcontroller and microprocessor
platforms like Arduino, ARM, PIC, Raspberry Pie etc. The following guide is universally since
it has to be followed irrespective of the type of computational device used.
Power the Sensor using a regulated +5V through the Vcc ad Ground pins of the sensor. The
current consumed by the sensor is less than 15mA and hence can be directly powered by
the on board 5V pins (If available). The Trigger and the Echo pins are both I/O pins and
hence they can be connected to I/O pins of the microcontroller. To start the measurement,
the trigger pin has to be made high for 10uS and then turned off. This action will trigger an
ultrasonic wave at frequency of 40Hz from the transmitter and the receiver will wait for the
wave to return. Once the wave is returned after it getting reflected by any object the Echo
pin goes high for a particular amount of time which will be equal to the time taken for the
wave to return back to the sensor.
The amount of time during which the Echo pin stays high is measured by the MCU/MPU as it
gives the information about the time taken for the wave to return back to the Sensor. Using
this information the distance is measured .
As shown above the HC-SR04 Ultrasonic (US) sensor is a 4 pin module, whose pin names are
Vcc, Trigger, Echo and Ground respectively. This sensor is a very popular sensor used in
many applications where measuring distance or sensing objects are required. The module
has two eyes like projects in the front which forms the Ultrasonic transmitter and Receiver.
The sensor works with the simple high school formula that
The Ultrasonic transmitter transmits an ultrasonic wave, this wave travels in air and when it
gets objected by any material it gets reflected back toward the sensor this reflected wave is
observed by the Ultrasonic receiver module as shown in the picture below
Now, to calculate the distance using the above formulae, we should know the Speed and
time. Since we are using the Ultrasonic wave we know the universal speed of US wave at
room conditions which is 330m/s. The circuitry inbuilt on the module will calculate the time
taken for the US wave to come back and turns on the echo pin high for that same particular
amount of time, this way we can also know the time taken. Now simply calculate the
distance using a microcontroller or microprocessor.
Ultrasonic level measurement is one of the best technique used for continuous level
measurement. Ultrasonic waves can travel at the 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 20ns (nanoseconds) for the waves to reflect back from a surface located 3 m
away. 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. These
waves are not hazardous to humans. Consequently, ultrasonic sensors are used frequently
for distance measurement applications such as level control. Ultrasonic sensors are capable
of detecting most objects such as metal or non-metal, clear or opaque, liquid, solid, or
granular, that have sufficient acoustic reflectivity. Another advantage of ultrasonic sensors is
that they are less affected by condensing moisture than photoelectric sensors and ultrasonic
requires very little system complexity to implement successfully. A downside to ultrasonic
sensors is that sound absorbing materials, such as cloth, soft rubber, flour and foam, make
poor target objects.
3.3 FEATURES
2 Trigger
Trigger pin is an Input pin. This pin
has to be kept high for 10us to
initialize measurement by sending US
wave.
4 Ground
This pin is connected to the Ground
of the system
There are four major different types of ultrasonic sensors are currently in used,
This sensor consists of 2 points for switching, therefore it is called 2-point proximity
switches. It is almost similar with standard sensor only differ the 2-touch set up key and this
function is called Tech-in function. Its switches Sde1 and Sde2 could be easily programmed
within the sensing range with the help of built in Tech-in button.
CHAPTER 4
ATMEGA 16 MICRONTROLLER
Launched in 1996, the AVR core combines a rich instruction set with 32 general purpose
working registers. All the 32 registers are directly connected to the Arithmetic Logic Unit
(ALU), allowing two independent registers to be accessed in one single instruction executed
in one clock cycle. The resulting architecture is more code efficient while achieving
throughputs up to ten times faster than conventional CISC microcontrollers. AVR
microcontrollers find many applications as embedded systems; they are also used in
Arduino board designs.
AT stands for the company name, MEGA stands for the clock frequency of the micro
controller (1 MHz), 16 is the IC no.
ATmega16 has four eight bit digital IO ports: ƒ PORT A, ƒ PORT B, ƒ PORT C, ƒ PORT D. Each
port has 8 data pins. Every port is bi-directional. Each of the 8 pins can be individually
configured as input or output. For each port, there are three relevant 8-bit registers. Data
Direction Register (DDRx) Input Pins Address (PINx). Data register (PORTx). Here, x denotes
A, B, C or D. Data Direction Register (DDRx) is used to configure a specific port pin as output
(1) or input (0).
4.3 FEATURES
CHAPTER 5
RELAY SWITCH
Relays are switches that open and close circuits electromechanically or electronically. Relays
control one electrical circuit by opening and closing contacts in another circuit. As relay
diagrams show, when a relay contact is normally open (NO), there is an open contact when
the relay is not energized. When a relay contact is Normally Closed (NC), there is a closed
contact when the relay is not energized.
In either case, applying electrical current to the contacts will change their state.
Relays are generally used to switch smaller currents in a control circuit and do not usually
control power consuming devices except for small motors and Solenoids that draw low
amps. Nonetheless, relays can "control" larger voltages and amperes by having an
amplifying effect because a small voltage applied to a relays coil can result in a large voltage
being switched by the contacts.
CHAPTER 6
BLOCK DIAGRAM
In this block diagram output of the ultrasonic sensor is given to the AVR microcontroller as
an input to process them according to codes which are actually feed into the
microcontroller to provide a desired output. The 2*16 LCD screen under four bit mode is
used to display the processed output. The controlled variable is also send to the motor
whenever we need to excite them. This excitation of the motor is done with the help 5v
relay switch. The block diagram for the level measurement process is shown in the Figure 1.
6.1 WORKING
When the circuit is excited the ultrasonic sensor generates the sound signal towards the
bottom of the water tank (target) whose level is to be measured. After the signal is
reflecting from the target these signal are received by the receiver of the ultrasonic sensor.
The time taken by the signal to reach the receiver is the direct measure of the accurate level
in the water tank. Then the output of the sensor is processed by the microcontroller
according to the Formula: us / 58 = centimetres or us / 148 =inch; or: the range = high level
time * velocity (340M/S) / 2; Then the processed output is given to the LCD display to
visualize the readings. Here in our project the objective is not only to measure the level but
also to control it from overflow and emptiness of the water tank. If the level of the tank is
two centimetre means then the motor automatically gets excited via 5V relay switch. Also if
it attains particular maximum level the motor will automatically turn to off. This is the
working principle involved in our project.
CHAPTER 7
CIRCUIT DIAGRAM
Figure 7.1: Circuit diagram for ultrasonic water level indicator and controller using
AVR microcontroller
The circuit is excited by 12V power supply, the HC-SRO4 module is connected to the port A
of the ATmega 16 microcontroller, and the motor is also connected to the port A via 5V
relay switch and the 2*16 LCD module is connected to the port B. The circuit diagram is
shown in the Figure 2.
The Timing diagram is shown below in the Figure 3. You only need to supply a short 10uS
pulse to the trigger input to start the ranging, and then the module will send out an 8 cycle
burst of ultrasound at 40 kHz and raise its echo. The Echo is a distance object that is pulse
width and the range in proportion. You can calculate the range through the time interval
between sending trigger signal and receiving echo signal. Formula: us / 58 = centimetres or
us / 148 =inch; or: the range = high level time * velocity (340M/S) / 2; we suggest to use
over 60ms measurement cycle, in order to prevent trigger signal to the echo signal.
CHAPTER 8
8.1 ADVANTAGES
Minimal maintenance.
8.2 DISADVANTAGES
No warranty or guarantee.
CHAPTER 9
APPLICATIONS
Irrigation
CHAPTER 10
CONCLUSION
The application of the embedded system in various fields in automation has been widely
increased in order to decrease the human intervention and time to complete the process.
As we have already discussed that improper level measurement of hazardous tank can
create harmful effects to both the system and the environment. The main objective of our
project is not only to attain the accurate measurement of level but also to have a safety
control over it. Finally from this seminar we conclude that level measurement in industries
using the concept of embedded system can acquire very low cost, very less man power also
the installation of the system is easy and makes it more compatible for different
environments.
REFERENCE
i. K. S. C. Kuang, S. T. Quek, and M. Maalej, ʊRemote flood monitoring system based
on plastic optical fibres and wireless motes, ۅSensors and Actuators A, vol. 147, no.
2, pp. 449–455,2008.
ii. B. Yun, N. Chen, and Y. Cui, Highly sensitive liquidlevel sensor based on etched fiber
bragg grating,IEEE
iv. K. Shannon, X. Li, Z. Wang, and J. D. N. Cheeke, ʊMode conversion and the path of
acoustic energy in a partially water-filled aluminum tube,ۅUltrasonics, vol. 37, no. 4,
pp. 303–307, 1999.
vii. D. S. Montero and C. Vázquez (2012) Polymer Optical Fiber Intensity-Based Sensor
for Liquid-Level Measurements in Volumetric Flasks for Industrial Application. ISRN
Sensor Networks Volume (2012).