Water Pump Control PDF
Water Pump Control PDF
Science &Technology
College of Graduate Studies
By
HOZUIFA ABD ELKARIEM YAGOB BAKHEET
Supervisor
Dr. ZAKARIA ANWAR ZAKARIA
June 2016
1
2
3
4
بسم اهلل الرحمن الرحيم
By:
HOZUIFA ABD ELKARIEM YAGOB BAKHEET
Supervisor
Dr. ZAKARIA ANWAR ZAKARIA
June 2016
i
بسم اهلل الرحمن الرحيم
اآلية
ii
Dedication
I dedicate my dissertation work to my family, my friends, and to
all who have supported me throughout the implementation of this
research.
iii
Acknowledgement
Praise be to God who helped me to complete this study, then I
would like to extend my gratitude to my supervisor Dr. Zakaria Anwar
Zakaria, for his constant guidance and the encouragement throughout the
endeavor, his support, motivation and innovative ideas that helped me
tremendously whenever I met a roadblock.
iv
Abstract
Pump control system is designed to monitor the level of water in
the overhead and underground tank through water level sensors, and run
the pump only when the water level in the underground tank is up to the
position of the water level sensor as long as the overhead tank is empty
and automatically turn off the pump after the fullness of the overhead
tank where its has two water level sensors. The circuit is made up of
(microcontroller Atmega16), three sensors for water level (Float Switch),
display (LCD 16), Driver (ULN2003A), alarm (buzzer), three light
emitting diodes (LED) and Relay (5 V).Where the microcontroller keeps
track of the exact level of water in the tanks and display it in the LCD
display as well as running pump or shutdown it through the driver and
relay, And according to the water level it is turned the suitable LED, and
when the water level in the underground tank is less than the sensor level
the buzzer is turned on.
v
المستخلص
تم تصميم نظام التحكم فى المضخة ليقوم بعملية مراقبة مستوى الماء فى الخزانين
العلوى واالرضى عن طريق حساسات مستوى الماء وتشغيل المضخة فقط عندما يكون مستوى
الماء فى الخزان االرضى يصل لموضع حساس الماء طالما الخزان العلوى فارغاً وايقاف
المضخة تلقائياً بعد امتالء الخزان العلوى حيث يوجد به حساسان لمستوى الماء,وتتكون الدائرة
المتحكم الدقيق بتتبع مستوى الماء فى الخزانين وعرضه فى الشاشة وكذلك عملية تشغيل
المضخة وايقافها عن طريق القائد والمرحل.ووفقاً لمستوى الماء يتم تشغيل الصمام الثنائى
الباعث للضوء ذو اللون المناسب وعندما يكون مستوى الماء فى الخزان االرضى أقل من
vi
Table of Contents
اآلية............................................................................................................. ii
Dedication ................................................................................................ iii
Acknowledgement ................................................................................... iv
Abstract ..................................................................................................... v
المستخلص.................................................................................................... vi
Table of Contents .................................................................................... vii
List of Tables ............................................................................................ x
List of Figures .......................................................................................... xi
List of Abbreviations .............................................................................. xii
List of Symbols ...................................................................................... xiv
List of Appendices .................................................................................. xv
(CHAPTER ONE) ......................................... 1
Introduction.................................................... 1
1.1 Background ......................................................................................... 1
1.2 Importance .......................................................................................... 3
1.3 Methodology ....................................................................................... 4
1.4 Objectives............................................................................................ 4
1.5 Overview of The Thesis ...................................................................... 4
(CHAPTER TWO) .................................... 6
Literature Review .......................................... 6
2.1 Pump Control System ......................................................................... 6
2.2 Control Architectures .......................................................................... 9
2.2.1 Analog Circuits ........................................................................... 10
2.2.2 Digital Circuits............................................................................ 10
2.2.3 Programmable Logic Controller ................................................. 11
2.2.4 Single-Board Computer .............................................................. 13
2.2.5 Personal Computer (PC) ............................................................. 13
vii
2.2.6 Digital Signal Processing (DSP) ................................................ 14
2.2.7 Microcontrollers ......................................................................... 14
2.3 Pumps ................................................................................................ 29
2.3.1Positive Displacement Pumps ..................................................... 30
2.3.2 Centrifugal Pumps ...................................................................... 30
2.4 Level Sensor ...................................................................................... 31
2.4.1 Continuous level Measurement .................................................. 31
2.4.2 Detection of Threshold Values (limits) ...................................... 35
2.5 ULN2003A driver ............................................................................. 36
2.6 The Relay .......................................................................................... 37
(CHAPTER THREE) ............................. 39
Case Study .................................................... 39
3.1 Introduction: ...................................................................................... 39
3.2 Components Used ............................................................................. 39
3.2.1 Solder Board ............................................................................... 40
3.2.2 Float Switch ................................................................................ 40
3.2.3 Atmega16 Microcontroller ......................................................... 40
3.2.4 ULN 2003 Driver........................................................................ 40
3.2.5 5v Relay ...................................................................................... 40
3.2.6 Buzzer ......................................................................................... 40
3.2.7 LCD16 Display ........................................................................... 40
3.2.8 Various Resistors (3K ,330) Ω ................................................... 42
3.2.9 Various LED (red , yellow , green) ............................................ 42
3.2.10 Variable Resistance 1K ............................................................ 42
3.2.11 Wires ......................................................................................... 42
3.3 Welding Process................................................................................ 43
3.3.1 Microcontroller Welding ............................................................ 43
3.3.2 LCD Display Welding ................................................................ 43
3.3.3 ULN 2003 Welding .................................................................... 43
viii
3.3.4 Relay Welding ............................................................................ 44
3.3.5 Pump Welding ............................................................................ 44
3.3.6 Variable Resistance .................................................................... 44
3.3.7 Buzzer Welding .......................................................................... 44
3.4 Welding Test .................................................................................... 44
3.5 Programming Process ....................................................................... 46
3.6 Software Design ................................................................................ 47
3.6.1 Text Editor .................................................................................. 48
3.6.2 Translator .................................................................................... 48
3.6.3 Linker/Locator ............................................................................ 48
3.6.4 Loader ......................................................................................... 48
3.6.5 Testing ........................................................................................ 49
3.6.6 Debugging................................................................................... 49
3.7 Development Process ........................................................................ 49
3.8 Choice of Programming Language ................................................... 49
3.9 Pump Control System Program Steps ............................................... 49
(CHAPTER FOUR) ................................ 52
The Results ................................................... 52
4.1 Results ............................................................................................... 52
(CHAPTER FIVE) ................................. 58
Conclusion and Recommendation.............. 58
5.1 Conclusion ........................................................................................ 58
5.2 Recommendations ............................................................................. 59
REFERANCES ....................................................................................... 60
ix
List of Tables
TABLE NO TITLE PAGE NO
x
List of Figures
xi
List of Abbreviations
xii
SISC Specific Instruction Set Computer
IDE Integrated Development Environment
CAN Controller Area Network
USB Universal Serial Bus
RF Radio Frequency
SRAM Static Read Access Memory
USART Universal Synchronous Asynchronous Receiver Transmitter
SPI Serial Peripheral Interface
JTAG Joint Test Action Group
VCR Video Cassette Recorder
H2S Ahydrogen Sulfide
FMCW Frequency Modulated Continuous Wave
COM Common
NC Normally Closed
NO Normally Open
DC Direct Current
AC Alternating Current
SPST Single pole, single throw
SPDT Single pole, double throw
DPDT Double Pole, Double Throw
LCD Liquid Crystal Display
MDS Micro-controller Development Systems
BASIC Beginners All-purpose Symbolic Instruction Code
xiii
List of Symbols
h Fluid level
hmax Sensor level
D Tank diameter
d Sensor diameter
C1 Air capacitive
C2 Fluid capacitive
tf Time of travel
sensor L Sensor at the low level of the overhead tank
sensor H Sensor at the high level of the overhead tank
sensor U Sensor at the low level of the underground tank
xiv
List of Appendices
Appendix NO TITLE
1 The pump control system programme steps
xv
CHAPTER ONE
Introduction
1.1 Background
Throughout history mankind has tried to control the world in
which he lives. From the earliest days he realized that his puny strength
was no match for the creatures around him. He could only survive by
using his wits and cunning. His major asset over all other life from flint,
stone and bone and discovered that it was possible to train other animals
to do his bidding and so the earliest form of control system was
conceived. Before long the horse and ox were deployed to undertake a
variety of tasks, including transport. It took a long time before man
learned to replace animals with machines [1].
Automatic control is one of today’s most significant areas of
science and technology. This can be attributed to the fact that automation
is linked to the development of almost every form of technology. By its
very nature, automatic control is a multidisciplinary subject; it
constitutes a core course in many engineering departments, such as
electrical, electronic, mechanical, chemical, and aeronautical. Automatic
control requires both a rather strong mathematical foundation, and
implementation skills to work with controllers in practice.
Automatic control has developed rapidly over the last 60 years.
An impressive boost to this development was provided by the
technologies that grew out of space exploration and the second World
War. In the last 20 years, automatic control has undergone a significant
and rapid development due mainly to digital computers. Indeed, recent
1
developments in digital computers especially their increasingly low cost
facilitate their use in controlling complex systems and processes.
Automatic control is a vast technological area whose central aim is
to develop control strategies that improve performance when they are
applied to a system or a process. The results reported thus far on control
design techniques are significant from both a theoretical and a practical
perspective. From the theoretical perspective, these results are presented
in great depth, covering a wide variety of modern control problems, such
as optimal and stochastic control, adaptive and robust control, and
system identification. From the practical point of view, these results have
been successfully implemented in numerous practical systems. And
processes—for example, in controlling temperature, pressure, and fluid
level; in electrical energy plants; in industrial plants producing paper,
cement, steel, sugar, plastics, clothes, and food; in nuclear and chemical
reactors; in ground, sea, and air, transportation systems; and in robotics,
space applications, farming, biotechnology, and medicine.
A close examination of the various machines and apparatus that
are manufactured today leads to the conclusion that they are partially or
entirely automated; this lead to the conclusion that automatic control is
used in all facets of human technical activities and contributes to the
advancement of modern technology.
The distinct characteristic of automatic control is that it reduces,
as much as possible, the human participation in all the aforementioned
technical activities. This usually results in decreasing labor cost, which
in turn allows the production of more goods and the construction of more
works. Furthermore, automatic control reduces work hazards, while it
contributes in reducing working hours, thus offering to working people a
better quality of life (more free time to rest, develop hobbies, have
fun,etc.).
2
Control systems have been in existence since ancient times. A
well-known ancient automatic control system is the regulator of Heron
of Alexandria this control system was designed to open the doors of a
temple automatically when a fire was lit at the altar located outside the
temple and to close the doors when the fire was put out.
Until about the middle of the 18th century, automatic control has
no particular progress to show. The use of control started to advance in
the second half of the 18th century, due to James Watt, who, in 1769,
invented the first centrifugal speed regulator. In particular, this regulator
was used to control the speed of the steam engine.
The period until about the middle of the 19 th century is
characterized by developments based on intuition, i.e., there was no
mathematical background for control design [2].
1.2 Importance
Sustainability of available water resource in many reason of the
world is now a dominant issue. This problem is quietly related to poor
water allocation, inefficient use, and lack of adequate and integrated
water management. Water is commonly used for agriculture, industry,
and domestic consumption. Therefore, efficient use and water
monitoring are potential constraint for home or office water management
system. Last few decades several monitoring system integrated with
water level detection have become accepted. Measuring water level is an
essential task for government and residence perspective. In this way, it
would be possible to track the actual implementation of such initiatives
with integration of various controlling activities. Therefore, water
controlling system implementation makes potential significance in many
applications. The existing automated method of level detection is
described and that can be used to make a device on/off. Moreover, the
3
common method of level control for underground tank appliance is
simply to start the feed pump at a low level and allow it to run until a
higher water level is reached in the water tank. This is not properly
supported for adequate controlling system. Besides this, liquid level
control systems are widely used for monitoring of liquid levels,
reservoirs, silos, and dams etc. Usually, this kind of systems provides
visual multi level as well as continuous level indication. Audio visual
alarms at desired levels and automatic control of pumps based on user’s
requirements can be included in this management system. Proper
monitoring is needed to ensure water sustainability is actually being
reached, with disbursement linked to sensing and automation [3].
1.3 Methodology
The programmatic approach entails microcontroller based
automated water level sensing and controlling have been used .
1.4 Objectives
Main objective is to design device that for control the submersible
pump by monitoring the water level in the tanks through water level
sensors, which are placed in three places in the tanks using a
microcontroller, and the objectives are:
1. To Design an automatic pump control and water monitoring system.
2. To Reduce the user effort and increasing safety.
3. To Prevent over labor of the pumping machine (dry running).
4
chapter three presents a case study, chapter four presents a result and
discussion, chapter five presents a conclusion and recommendations.
2
CHAPTER TWO
Literature Review
7
level of the overhead tank or slightly more than this. Not only the Light
Emit Diode (LED) will switch on but also the buzzer when the fill of the
overhead tank. Figure (2.1) show the block diagram of pump control
system.
8
the via a Zigbee antenna. The signal receives by Zigbee receiver then
[4]
accordingly main valve or motor control automatically . The research
result was a flexible, low cost easy maintainable wireless system.
(Muktha et al.,2013) in this approach water level sensing and controlling
with wireless communication and radio frequency transceivers used for
send signal to microcontrollers placed at each tank to control the pump.
The setback in this approach the large number of circuit components,
[5]
which makes it high cost . (Khaled et al., 2010) introduced the notion
of water level monitoring and management within the context of
electrical conductivity of the water. The motivated by the technological
affordances of mobile devices, investigated the microcontroller based
water level sensing and controlling in a wired and wireless environment.
The research result was a flexible, economical and easy configurable
system designed on a low cost PIC16F84A microcontroller.
9
2.2.1 Analog Circuits
Many simple Mechatronic designs require a specific actuator
output based on an analog input signal. In some cases, analog signal
processing circuits consisting of operational amplifier or and transistors
can be employed to effect the desired control. Operational amplifier can
be used to perform comparisons and mathematical operations such as
analog addition, subtraction, integration, and differentiation. They can
also be used in amplifiers for linear control of actuators. Analog
controllers are often simple to design and easy to implement and can be
less expensive than microprocessor-based systems.
11
(PALs) and programmable logic arrays (PLAs), an field programmable
gate array(FPGA) contains a large number of reconfigurable gates that
can be programmed to create a wide range of logic functions. Field
programmable gate arrays (FPGAs) are different from programmable
array logics (PALs) and programmable logic arrays (PLAs) because they
also can include memory, input/output (I/O) ports, arithmetic functions,
and other functionality found in microcontrollers. Furthermore, field
programmable gate arrays (FPGAs) are usually programmed with a high-
level software language (e.g., Very High Speed Integrated Circuit
(VHSIC) (VHDL Hardware Description Language) field programmable
gate array that allows for fairly sophisticated functionality.
Sometimes, it may be economically feasible to design an
application specific integrated circuit (ASIC) that provides unique
functionality on a single integrated circuit(IC).Logic functions, memory,
computation, signal processing, and other digital and analog features can
be custom built onto a single application-specific integrated
circuit(ASIC). Design and setup for manufacturing can be expensive, but
in high volume manufacturing applications, an application specific
integrated circuit (ASIC) solution can be cheaper in the long run.
Application specific integrated circuits (ASICs) are also attractive
because the integrated solution will usually be smaller in size and
consume less power.
11
between system inputs and outputs. Programmable logic controllers
(PLCs) are designed with industrial control and industrial environments
specifically in mind. Therefore, in addition to being flexible and easy to
program, they are robust and relatively immune to external interference.
The National Electrical Manufacturers Association (NEMA) has
defines a programmable logic controller as: A digitally operating
electronic apparatus which uses a programmable memory for the internal
storage of instructions for implementing specific functions such as logic,
sequencing, timing, counting, and arithmetic to control, through digital
or analog input/output modules, various types of machines or processes.”
In essence, the programmable logic controller consists of
computer hardware, which is programmed to simulate the operation of
the individual logic and sequence elements that might be contained in a
bank of relays, timers, counters, and other hard-wired components.
Early Programmable logic controllers (PLCs) that were developed
during the late 1960s were difficult to program. These early devices were
merely relay replacements and could do very little else, in recent years
rapidly developed into a sophisticated and highly versatile control
system component. Units today are capable of performing complex math
functions including numerical integration and differentiation and operate
at the fast microprocessor speeds now available. Today's systems can
accept and generate analog voltages and currents as well as a wide range
of voltage levels and pulsed signals, Programmable logic controllers
(PLCs) are also designed to be rugged. Unlike their personal computer
cousin, they can typically withstand vibration, shock, elevated
temperatures, and electrical noise to which manufacturing equipment is
exposed. As more manufacturers become involved in Programmable
logic controllers' production and development, and Programmable logic
12
controller capabilities expand, the programming language is also
expanding.
13
approach, personal computer controlled mechatronic systems are
especially common in Research and Development (R&D) testing and
product development laboratories, where fast prototyping is required but
where large-quantity production and miniaturization are not concerns.
2.2.7 Microcontrollers
Microcontrollers were first considered at Intel in 1969 when a
Japanese company approached Intel to build some integrated circuits for
calculators. Marcian Huff used his previous experience on the
Programmed Data Processor PDP-8 to propose an alternate solution a
programmable integrated circuit(IC). Frederico Faggin transformed this
idea to reality and Intel bought the license from the Japanese company
(BUSICOM) to create the 4004 4-bit microprocessor capable of 6000
operations per second. This was soon followed by the 8-bit 8008 in
1972. Intel’s efforts were soon followed by Motorola with the 8-bit 6800
series and MOS Technology introduced the 6501 and 6502 for only $25
each. It was all downhill from there.
A single chip microcontroller and 900 MHz radio known as
(“Spec”) was designed by Jason Hill at UC Berkeley for a new field in
engineering known as “sensor networks.” Because microcontrollers and
14
radios are so cheap and easy to use today, you could fill a building with
thousands of them, all talking together over low power radios. By
sensing their environment, these small sensors could control lighting,
temperature, as well as numerous other environmental controls.
The needs of embedded control are very different from those of
the standard personal computers. For the life of the device, usually it will
run only one program, apart for the occasional program update. Because
there is little support hardware; Visual Display Unit (VDU), keyboard,
hard-drive or floppy disk there is little need for mass storage. User-
machine, machine-user interaction is also limited. They are often
required to operate in hostile environments such as high temperatures,
dust/corrosive atmospheres and perhaps both mechanically and
electrically noisy.
Microcontroller is a highly integrated chip that contains all the
components comprising a controller. Typically this includes a Central
Process Unit (CPU), Random Access Memory (RAM), some form of
Read Only Memory (ROM), input/output (I/O) ports, and timers. Unlike
a general purpose computer, which also includes all of these
components, a microcontroller is designed for a very specific task to
control a particular system. As a result, the parts can be simplified and
reduced, which cuts down on production costs.
Microcontrollers are sometimes called embedded
microcontrollers, which just mean that they are part of an embedded
system that is, one part of a larger device or system.
2.2.7.1 Microcontroller Advantages
Microcontrollers are widely used in today’s control systems for
the following reasons:
12
1. Design and Simulation
Because can programmed with software, detailed simulations may
be performed in advance to assure correctness of code and system
performance.
2. Flexibility
Ability to reprogram using Flash, Electrically Erasable
Programmable Read Only Memory (EEPROM) or Erasable
Programmable Read Only Memory (EPROM) allows straightforward
changes in the control law used.
3. High Integration
Most microcontrollers are essentially single chip computers with
on-chip processing, memory, and input/output. Some contain peripherals
for serial communication and reading analog signals with (an analog to
digital converter or analog to digital converter). This differentiates a
microcontroller from a microprocessor. Microprocessors require that this
functionality be provided by added components.
4. Cost
Cost savings come from several locations. Development costs are
greatly decreased because of the design/flexibility advantages mentioned
previously. Because so many components are included on one integrated
circuit(IC), board area and component savings are often evident as well.
5. Easy to Use
Just program and go! While in the past, programming has often
involved tedious assembly code, today C compilers are available for
most microcontrollers. Microcontrollers often only require a single 5V
supply as well which makes them easier to power and use.
2.2.7.2 Microcontroller architecture
The Atmel ATmega16 microcontroller for example integrates
memory, clock, a central processing unit, input/output, timers, and an
12
analog to digital converter figure (2.2) show ATmega16 microcontroller
architecture.
17
Random Access Memory (RAM) can be either read or written,
and this usually happens quite fast. Data stored on a microcontroller is
often stored in Random Access Memory Random Access Memory
(RAM) However, the data stored in Random Access Memory (RAM) is
volatile which means that it is lost when power is turned off. Read Only
Memory (ROM) is non-volatile and therefore stored between power
cycles, but may not be written to.
Programmable Read Only Memory (PROM) is therefore a
compromise between these two types of memory. Programmable Read
Only Memory (PROM) is nonvolatile and also allows a user to program
it Ultra Volatile (UV) light, but more common today is Electronically
Erasable Programmable Read Only Memory (EEPROM). Erasable
Programmable Read Only Memory allows read and write access and is
also non volatile, but the sacrifice here is that data transfers take much
longer than with Read Only Memory.
Flash memory is a type of Erasable Programmable Read Only
Memory. Program memory (where the program is stored) on the
ATmega16 is Flash memory. This is also the same as the memory used
in digital cameras and cell phones. Data transfer using flash is much
faster than Erasable Programmable Read Only Memory because it works
in blocks of bytes instead of single bytes. This makes it perfect for
program memory in that case.
2- Clock
18
3- Central Process Unit (CPU)
This is brains of the microcontroller – the Central Process Unit
(CPU) executes instructions such as add, move, jump, multiply, etc. To
do so, it must first fetch the instruction and any required data over its
data bus.
4- Input/Output (I/O)
Timers are internal clocks (2 for 8-bit timers and 1 for 16-bit timer
is included in the ATmega16). Each timer can be scaled by some factor
from the system clock (8MHz). These timers can then give a sense of
time and duration information of great importance in digital control
systems. In most cases, just use a timer to count from 0 to 255 for an
8-bit timer, or 0 to 65536 for a 16-bit timer.
In addition, many interrupts can be triggered off of timers. An
interrupt is a piece of code triggered by a particular event. That event
might be a timer overflowing, or reaching a particular value.
6- Analog-to-Digital Converter (ADC)
In most cases, the real world gives analog signals. Reading light
levels from a photoresistor will give an analog voltage relating to the
19
current light falling on the photoresistor. For the microcontroller to deal
with this information, it must be converted to a digital format. An analog
to digital converter does exactly that.
The ATmega16 provides an 8-channel 10-bit analog-to-digital
converter. The number of channels is the number of pins supporting the
analog-to-digital converter functionality (this is one of the secondary
functions mentioned earlier in input/output). The number of bits tells us
the resolution with which can read the analog data.
2.2.7.3 Types of Microcontrollers
Microcontrollers can be classified on the basis of internal bus
width, architecture, memory and instruction set. Figure (2.3) shows the
various types of microcontrollers.
21
2- Embedded and external memory microcontrollers
i- Embedded microcontrollers
ii- External memory microcontrollers
3- Microcontrollers architecture Features
i- Von-Neuman architecture
ii- Harvard architecture
iii- Complex Instruction Set Computer (CISC) Architecture
microcontroller
iv-Reduced Instruction Set Computer (RISC) architecture
v-Specific Instruction Set Computer (SISC)
2.2.7.4 Microcontrollers Selection
Choosing a microcontroller from a number of different
microcontrollers is a very critical decision for the designers. Three are
the vital major criteria for selecting them. These are wide availability
and reliable sources, meeting the requirements efficiently and cost
effectively, availability of the software development tools like compilers,
Assemblers and debuggers etc. The main criteria in selecting a
microcontroller are given below in the order of importance.
1- System Requirement
22
Programmed. Atmel 89C51 and Mega AVR families have the segmented
Flash blocks which allows reprogram one segment under control of
another segment, without removing the power. Lastly it is best to choose
a device from a family which provides sufficient or more memory space
than the expectation of need.
3- Availability
23
7- Power Management
24
9- Manufacturer’s Support
system cost in some great extent. For high volume applications most
users prefer Read Only Memory (ROM) based devices due to their lower
cost and code security [8].
According to these criteria the microcontroller has been selected is
ATmega16 has the following features:-
The device is manufactured using Atmel’s Mega AVR family with
low power consumption an 8-bit high performance microcontroller four
8-bit ports designated as PORTA, PORTB, PORTC and PORTD.
Atmega16 is based on enhanced Reduced Instruction Set Computing
(RISC). Most of the instructions execute in one machine cycle.
Atmega16 can work on a maximum frequency of 16MHz and has 16 KB
programmable flash memory, Static Read Access Memory (SRAM) of 1
KB and Electronically Erasable Programmable Read Only Memory
(EEPROM) of 512 Bytes. ATmega16 is a 40 pin microcontroller. There
are 32 input/output (I/O) lines which are divided into in-built peripherals
like Universal Synchronous Asynchronous Receiver Transmitter
(USART) analog to digital converter, Analog Comparator, Serial
Peripheral Interface (SPI), Joint Test Action Group (JTAG) etc. Each
22
input/output pin has an alternative task related to in-built peripherals.
Figure (2.4) shows the pin configuration of ATmega16.
27
on pins PC5(TDI), PC3(TMS) and PC2(TCK) will be activated even if a
reset occurs selected, also serves the functions of the interface and other
special features of the ATmega16,serves the functions of various special
features of the ATmega16.
Port D :
is an 8-bit bi-directional input/output (I/O) port with internal pull-
up resistors (selected for each bit). also serves the functions of various
special features of the ATmega16.
RESET:
Reset Input. A low level on this pin for longer than the minimum
pulse length will generate a reset, even if the clock is not running.
XTAL1 :
Input to the inverting oscillator amplifier and input to the internal
clock operating circuit.
XTAL2 :
Output from the inverting oscillator amplifier.
AVCC :
is the supply voltage pin for Port A and the analog to digital
converter. It should be externally connected to VCC, even if the analog
to digital converter is not used. If the analog to digital converter is used,
it should be connected to VCC through a low-pass filter.
AREF :
is the analog reference pin for the analog to digital converter [9].
2.2.7.6 Microcontroller Applications
In addition to control applications such as the home monitoring
system, microcontrollers are frequently found in embedded applications.
Among the many uses that can find one or more microcontrollers:
automotive applications, appliances (microwave oven, refrigerators,
television and Video Cassette Recorders VCRs, stereos), automobiles
28
(engine control, diagnostics, climate control), environmental control
(greenhouse, factory, home), instrumentation, aerospace, and thousands
of other uses. Microcontrollers are used extensively in robotics. In this
application, many specific tasks might be distributed among a large
number of microcontrollers in one system. Communications between
each microcontroller and a central, more powerful microcontroller (or
microcomputer, or even large computer) would enable information to be
processed by the central computer, or to be passed around to other
microcontrollers in the system.
A special application that microcontrollers are well suited for is
data logging. By stick one of these chips out in the middle of a corn field
or up in a balloon, one can monitor and record environmental parameters
(temperature, humidity, rain, etc). Small size, low power consumption,
and flexibility make these devices ideal for unattended data monitoring
and recording [10].
2.3 Pumps
The purpose of a hydraulic pump is to supply a flow of fluid to a
hydraulic system. The pump does not create system pressure, since
pressure can be created only by a resistance to the flow. As the pump
provides flow, it transmits a force to the fluid. As the flow encounters
resistance, this force is changed into a pressure. Resistance to the flow is
the result of a restriction or obstruction in the pass of the flow. This
restriction is the normally work accomplished by the hydraulic system,
but can also be restriction of lines, fittings, and valves within the system.
Thus, the pressure is controlled by the load imposed on the system or the
action of a pressure regulating device. Pumps are in general classified as
centrifugal pumps or positive displacement pumps.
29
2.3.1Positive Displacement Pumps
The positive displacement pump operates by alternating of filling
a cavity and then displacing a given volume of fluid. The positive
displacement pump delivers constants volume of liquid against varying
discharge pressure or head. The positive displacement pumps can be
classified as:
2.3.1.1 Reciprocating pumps
2.3.1.2 Power pumps
2.3.1.3 Rotary pump
2.3.1.4 Steam pumps
31
the outer portions of the volute by means of centrifugal force (thus, its
name centrifugal pump). As this water collects in the outer regions of the
volute, it is directed to the outlet. The water leaving the outlet causes the
water pressure to drop at the inlet. To match the rate with which water is
leaving the outlet, the pump sucks in new water at the inlet. These pumps
must be primed before starting, which in this case is already done
because of its underwater application. Figure (2.5) show the Submersible
pump.
31
2.4.1.1 Capacitive Sensors
Filling the space between electrodes with a material having a
relative permittivity more than one increases capacitance of the sensor
proportionally to the relative permittivity and the level figure (2.6) show
the capacitive sensor with planar electrodes for level measurement.
Fig (2.6) Capacitive sensor with planar electrodes for level measurement
The first expression corresponds to the capacity of the empty
container. Variation of the permittivity value causes systematic errors
which could be compensated for by using an additional capacitive sensor
which measures the permittivity. Capacitance of level sensor also
depends on density, concentration, temperature and humidity. There are
other type is capacitive level sensor with cylindrical coaxial electrodes
where the capacitance of the cylindrical coaxial capacitor is dependent
on the fluid level (h) ,tank diameter (D),and the sensor diameter (d)
figure (2.7) show the capacitive sensor with cylindrical coaxial
electrodes.
32
Fig (2.7) Capacitive sensor with cylindrical coaxial electrodes
2.4.1.2 Ultrasonic Sensors
The transducer emits pulses of ultrasonic waves which are then
reflected from interfaces between materials with different mechanical
properties (discontinuities of acoustical impedance). The piezoelectric
transducer can operate alternatively either as transmitter or a receiver.
The distance (d) between the transducer and the level is found from the
sound velocity and the travel time of the ultrasonic pulses. Compensation
of temperature effect on sound velocity is carried out using data from an
outside temperature sensor. The sensor axis must be perpendicular to the
reflecting surface and reflections from tubes and bracing have to be
avoided in order to produce an echo without disturbances (false echoes).
Installation of the sensor in the focus of a parabolic tank cap increases
the level of disturbing signals. The optimal position would generally be
at half of the container radius in the center. The principle of operation of
ultrasonic sensors is shown in Figure (2.8).
33
Fig (2.8) The principle of ultrasonic sensors for level measurement
2.4.1.3 Microwave Sensors (radar)
Regarding pulse-radar, the travel time of microwave signals is
measured. Due to the high value of light velocity c0, the duration of the
pulses is only 1 ns, otherwise the transmitted and received pulse would
overlap. Short pulses pose high requirements on time interval Δt
measurement. Therefore, most of the level sensors use Frequency
Modulated Continuous Wave (FMCW) principle .Microwave sensors are
used in cases of high temperature, mist or dust, for rapidly moving
objects or for long distance measurement. Their disadvantage is the
relative high cost of sensors compared to other types of level
measurement principles. The microwaves can penetrate non conducting
materials such as glass or nylon with low reflection, thus measurement
can be made through the nylon container side without contact with the
inner side of the container system. It is possible to choose the thickness
of the penetrated material, so that the reflection of waves entering and
leaving the material will cancel each other out. The resulting reflecting
disturbance will then be zero. This is called wave cancellation and is
based on the same principle as antireflection coating used for optical
components.
2.4.1.4 Pressure Difference (hydrostatic) Sensors
The pressure of a liquid is the difference between the hydrostatic
pressure in the liquid on the bottom of the container and in the space
34
above the liquid level is proportional to the specific weight and the
level(h).
32
conductive container can serve as a common electrode and in this case
the sensor consists of only one electrode.
2.4.2.5 Fiber Optics Level Switches
The function of these switches is based on the change of the
optical fiber properties when the level of a liquid with appropriate
refraction index reaches the end of the fiber immersed in the fluid
2.4.2.6 Floating Switch
Due to the higher fluid density, the float (buoy) floats on the
surface of the liquid. The float may carry a permanent magnet, which
produces a magnetic field strong enough to activate a reed switch located
at the position of the level being detected. Using two floats with different
buoyancy, it is possible to measure the respective level of immiscible
[11]
liquids such as water and oil in a storage tank . Figure (2.9) show the
float switch.
32
are pinned opposite the outputs to simplify board layout and the interface
use with is commons (COMS) or 5V Transistor Transistor
Logic (TTL)[12] . Figure (2.10) show ULN2003A driver.
A relay switch can be divided into two parts: input and output.
The input section has a coil which generates magnetic field when a small
voltage from an electronic circuit is applied to it. This voltage is called
the operating voltage. Commonly used relays are available in different
configuration of operating voltages like (5 V, 6V, 9V, 12V, 24V etc).
The output section consists of contactors which connect or disconnect
37
mechanically. In a basic relay there are three contactors: Normally Open
(NO), Normally Closed (NC) and common (COM). At no input state, the
COM is connected to NC. When the operating voltage is applied the
relay coil gets energized and the COM changes contact to NO. Different
relay configurations are available like Single pole, single throw(SPST),
Single pole, double throw (SPDT), Double pole, double
throw(DPDT) etc, which have different number of changeover contacts.
By using proper combination of contactors, the electrical circuit can be
switched on and off [13] . Figure (2.11) show 5V relay.
38
CHAPTER THREE
Case Study
3.1 Introduction:
There are many methods of designing an automatic water level
control system with switching device but all these methodologies require
human assistance. Pump control system is designed using electronic
control to refill the water without human intervention. The system design
was carefully arranged to refill the water overhead tank, when the water
arrive to certain level in the overhead tank if and only if the water level
in the underground tank is over than the submersible pump sensor level,
finally the system will automatically stop the submersible pump when
the overhead tank is full.
39
3.2.1 Solder Board
All the components of the circuit is connected by it to form
welding joint rugged and durable.
3.2.5 5v Relay
The relay will act as a switch to control the pump.
3.2.6 Buzzer
Device that converts electrical energy into sound and is used in the
audio notification when the underground tank is empty. Buzzer model
works on 6-12 volts effort and carries a constant stream of approximately
25 mA.
41
very basic module and is very commonly used in various devices and
circuits. LCDs are economical, easily programmable, have no limitation
of displaying special characters and animations.
A 16x2 LCD means it can display 16 characters per line and there
are 2 such lines. In this LCD each character is displayed in 5x7 pixel
matrix. This LCD has two registers, namely, Command and Data.
The command register stores the command instructions given to
the LCD. A command is an instruction given to LCD to do a predefined
task like initializing it, clearing its screen, setting the cursor position,
controlling display etc.
The LCD displays status of the pump and sensors as well as the
water level in the tanks according to the microcontroller signal. Figure
(3.1) shows the LCD16 display pins.
41
DB4 ~ DB7: input/output 4 lines of low order data bus. Bi-directional
transfer of data between microcontroller unit and module is done through
these lines. In 4 bit operation, these are not used and should be grounded
Vss: Power Supply 0V (GND)
Vcc: Power Supply +5V
Vee: Power Supply terminal for LCD drive power source.
RS : Input microcontroller unit Register Select.
R/W : Input microcontroller unit Signal to select Read or Write.
E : Input microcontroller unit Enable - Operation start signal for data
read/write
3.2.11 Wires
Used to connect the circuit components.
42
3.3 Welding Process
The welding process include two stage, first stage welding
elements on the board, this process will applied to the microcontroller
,driver, LCD display, constant or variable resistances, LEDs and the
relay. Taking into account the direction of the parties that will be
connected with other elements.
The second stage includes welding elements to each other by
connecting wires through the pins designed for that purpose.
43
microcontroller connected to IN4, IN5 so that the output pin OUT12
connected to the normal open of the rely pin and the output pin OUT13
connected to the buzzer.
44
Fig (3.2) Pump control system circuit
42
3.5 Programming Process
Programming is the process of developing and implementing
various sets of instruction to enable a programmer device to do a certain
task. A sensitive automatic detector of water level through
microcontroller as programmer device cans the design process
characterized by the following steps:
1. Definition of task.
2. Requirement.
3. Factor that influence choice.
In defining a task, every design comes from an idea or a problem
that require a solution. Questions may be generated on what exactly that
is required to be achieved and the feasibility of the ideas as regards to the
implementation. If these questions are analyzed critically with tangible
solutions to the problem, a development of this idea into a reality is the
next step. Requirement for design process have to be considered once an
idea has been establish. The need to determine whether or not the idea
require a computer or not depends on complexity of the circuitry, or
whether the circuit to be designed needs to make a complex data. The
compare of these factors with topic. Three float switch as the input point
to detect the water level at tanks, proportion to the cheap price and its
availability, a micro-controller will be the option base on the circuit to be
design with less hardware connection and flexibility. The adapter fed the
circle through (5V) voltage of which requires a broker to raise the
current in order to become enough to run the buzzer and relay for this
purpose ULN2003 driver been used. Also it is known that the relay and
driver voltages must be equal to the source voltage (5V). This requires
5V relay and ULN2003 driver also. Then the pump consume about 220V
42
this require not only other electric source but also a broker to connect the
circuits so that a relay must be used.
47
or high level language into machine code (interpreter or compiler). It
also include programs that facilitate modifications (edition), the
computer aided development methodology, which is essential for
software development is summarized below.
3.6.2 Translator
There are two types of translators, assembler, interpreter and
compiler. An assembler translate assembly language in the form of
ammonic (memory aids) into machine code. A good feature of assembler
is creating a list that shows the machine code and the assembly language
of the programs side by side. A compiler on the other hand translates a
high-level language into machine code. An interpreter reads the source
code of the programs one line at a time and performs the specified
instructions contained in that line.
3.6.3 Linker/Locator
This is used to join the different modules that make up the
programs together in the correct sequence and this is to be bound to
addresses. The linker/locator pair works together to co-ordinate between
the separate modules for smooth programs execution.
3.6.4 Loader
The loader aids in loading an object code into RAM.
48
3.6.5 Testing
After the programs is written, it was tested, this involve executing
the programs with selected input called test cases, the result shows
whether or not the program is functioning as desired.
3.6.6 Debugging
This involves detecting out and removing errors in the program.
49
microcontroller decide to run the pump or stop it and display the status
of water at the two tanks, sensors, and the pump at the display unit,
also according to the water level the microcontroller switching the
appropriate LED and the buzzer alarm. The operation of pump control
system based on the micro-controller and water level sensors is
summarized as follows;
When sensor U is 0 the LCD display (underground tank empty),
and the pump is off. With neglecting the status of sensor L and
sensor H this is the main condition. The buzzer and red LED will
turned on.
When sensor H and sensor U are both 0 the LCD display
(overhead tank is empty), and the pump running.
When sensor H is 0 and sensor U is 1 the LCD display (overhead
tank Quarter level), the pump is off, and yellow LED will turned
on.
When sensor H is 1 and sensor U is 1 the LCD display (overhead
tank full), the pump is off, and green and yellow LED will turned
on.
When sensor H is 1 and sensor U is 0 the LCD display (sensors
error), the pump is shut down, and all LED will turned on and off
for small time.
Otherwise the pump is shut down. Figure (3.3) show the flow
chart that explains the Pump Control System Program Steps.
21
Fig (3.3) The flow chart of the Pump Control System Programming Steps.
CHAPTER FIVE
21
CHAPTER FOUR
The Results
4.1 Results
After the completion of the programming process and testing of
the program, comes stage of the overall test to the system to ensure that
there is no deviation in the results and then compatibility with the
expected design results. Table (4.1) shows the experimental results.
Table (4.1) the experimental results of the system
Sensors
Yellow Green Red Buzzer Pump
NO Status Tanks Status LCD
LED LED LED Status Status
U H L Head Ground
Underground
1 0 0 0 - Empty 0 0 1 1 0
tank empty
Underground
2 0 0 1 - Empty 0 0 1 1 0
tank empty
Underground
3 0 1 0 - Empty 0 0 1 1 0
tank empty
Underground
4 0 1 1 - Empty 0 0 1 1 0
tank empty
Over Head
5 1 0 0 Empty Full 0 0 0 0 1
Tank
Empty
Over Head
6 1 0 1 Low Full 1 0 0 0 1
Tank Quarter
level
Sensors
7 1 1 0 - Full 1 1 1 0 0
Error
Over Head
8 1 1 1 Full Full 1 1 0 0 0 Tank
Full
22
According to the results table (4.1) in the first four columns when
the underground tank is empty (sensor U) is 0, ignored the case of
the over head tank as well as (sensor H, sensor L), the red LED
and the buzzer are switched on and stop the pump and the LCD
display (underground tank empty).figure (4.1) show the status of
the LCD display and the red LED.
Fig (4.1) show the status of the LCD display and the red LED
23
In the fifth columns when the over head tank is empty the pump
will start running and the LCD display (over head tank empty),
and figure (4.2) show the status of the LCD display and the LED.
Fig (4.2) show the status of the LCD display and the LED
24
In the sixth columns when the water reaches the low level of the
over head tank the pump will continue running and the yellow
LED is switched on the LCD display (over head tank quarter
level).figure (4.3) show the status of the LCD display and the
yellow LED.
Fig (4.3) show the status of the LCD display and the yellow LED
22
In the seventh columns when the water reaches the high level of
the over head tank and the water don’t reaches the low level of the
over head tank the pump will stop running for un expected signal
and the all LED is switched on and off looks like flash the LCD
display (sensor error!! pump shut down) and the pump will shut
down. Figure (4.4) show the status of the LCD display and the
LED.
Fig (4.4) show the status of the LCD display and the LED
22
In the eighth columns when the water reaches the high level of the
over head tank (full) the pump will shut down. And the yellow
LED is still on and the green LED is switched on the LCD display
(over head tank full) and the pump will shut down. Figure (4.5)
show the status of the LCD display and the green LED.
Fig (4.5) The status of the LCD display and the green LED
27
CHAPTER FIVE
5.1 Conclusion
Extensive growth of population development and technology has
leads to the need of proper utilization of the natural resources especially
water. Thus the proposed system and the review of all the possible
implementation of technology is the first step toward prevention and
proper utilization of water. Automatic water pump control system
employs the use of different technologies in its design, development, and
implementation. The system used microcontroller to automate the
process of water pumping, it is observed that domestic and offices are
one of the major areas of water polling. So implementing the low cost
easy maintainable system is one among the solutions.
The experimental model was made according to the circuit
diagram and the results were as expected. The submersible pump doesn't
start until water reaches a certain level in the underground tank, the
pump switched ON when the overhead tank was about to go quarter
level and switched OFF when the overhead tank is full. Since the pump
is not running when the underground tank is empty or the water level is
low and operated only in the case of the water reaching the sensor level
in the underground tank that leads to a lack of the dry running for the
pump thus avoiding the pump self heating, increasing its operating life.
And also the pump turned off when the overhead tank is filled or the
arrival of the water level in the overhead tank to the upper sensor, this
limiting the amount of water flowing from the reservoir after it is full
and provides amount of the power that had previously been wasted
because of the operation of the pump after the fullness of the overhead
28
tank, As long as the microcontroller operation is to process of the run
and stop the pump without the human intervention that reduces safety
risks, as well as the effort to process operation and monitoring.
5.2 Recommendations
1. The use of wireless sensors or sensor is suitable for operation of
centrifugal pumps.
2. The use of PLC
29
REFERANCES
21
8. Manas Kumar Parai, Banasree Das, and Gautam Das, January
(2013). An Overview of Microcontroller Unit: From Proper
Selection to Specific Application, International Journal of Soft
Computing and Engineering, Volume-2, Issue-6,
ISSN: 2231-2307.
9. Atmega16 microcontroller data sheet
10. D.S. Yadav ,Arun Kumar Singh (2004). Microcontroller Features
and Applications, New Age, New Delhi, ISBN: 81-224-1569-5.
11. Jacob Fraden (2004). Hand Book of Modern Sensors Third
Edition, Springer -Verlag, New York, ISBN 0-387-00750-4.
12. ULN2003A driver data sheet.
13. Relay 5V data sheet.
21
Appendix (1)
The pump control system programme steps
$regfile = "m16def.dat"
$crystal = 8000000
Config Pina.1 = Input 'DANGER LEVEL
Config Pina.2 = Input
Config Pina.3 = Input
Config Portc.0 = Output 'green
Config Portc.1 = Output 'yellow
Config Portc.2 = Output 'red
Config Lcd = 16 * 2
Config Lcdpin = Pin , Db4 = Portd.3 , Db5 = Portd.4 , Db6 = Portd.5 ,
Db7 = Portd.6 , E = Portd.2 , Rs = Portd.1
Config Portb.2 = Output 'relay
Config Portb.3 = Output 'buzzer
Cls
Cursor Off
Locate 1 , 1
Lcd "PUMP CONTROL ..."
Wait 2
Cls
Portc.0 = 1
Portc.1 = 1
Portc.2 = 1
Wait 1
Portc.0 = 0
Portc.1 = 0
Portc.2 = 0
Do
22