8/7/2019 report of wlc
1/27
A
Project Report On
WATER LEVEL CONTROLLER
By :
Arati P. Chavan
Mrudula B. Chougule
Trupti V. Desai
T.E.(ELECTRONICS)
Under the Guidance of
Miss.Chaitali Prabhu
Department Of Electronics
College Of Engineering, Kolhapur
8/7/2019 report of wlc
2/27
KOLHAPUR INSTITUTE OF TECHNOLOGYS
COLLEGE OF ENGINEERING
KOLHAPUR.
CERTIFICATE
This is to certify that, project report entitled
Water Level Controller
has been successfully completed under the guidance of
Miss. Chaitali Prabhu.
Electronics Engineering Department.
Students name:
Arati Chavan.(09)
Mrudula Chougule.(11)
Trupti Desai.(12)
Miss. Chaitali Prabhu
Guide Mr.A.R.Nigavekar.
. H.O.D.(ELECTRONICS)
8/7/2019 report of wlc
3/27
ACKNOWLEDGEMENT
I thankful to God for the blessing he has showed on me for the successof this project. This project entitled WATER LEVEL CONTROLLER
was a formidable task, but for active guidance and help of my Lecturers who
helped me to complete it.
I would like to put on record deep gratitude towards my Lecturers for
their valuable guidance and encouragement, which has played an important
role in the preparation of this project.
I am thankful to the H.O.D. Prof. Nigavekar, my guide
Miss. Chaitali Prabhu for providing all facilities and to other professors of
the Electronic Department for their valuable suggestions and co-operation
during the completion of this project.I would also like to thank my friends for their constant
Encouragement and timely help for this report.
Date:
Place: Kolhapur
8/7/2019 report of wlc
4/27
CONTENTS
SR.NO
POINTS PAGE NO.
1. Introduction .
2. Traditional water level controller.
3. Synopsis.
4. Block diagram.
5. Methodology.
6. Circuit diagram.
7. Working.
8. Methodology used for Testing.
9. Test report.
10. Code sheet.
11. Problems.
12. Conclusions.
13. Reference.
Introduction
8/7/2019 report of wlc
5/27
For the residents who live in high buildings, low water pressure is a very
common problem, especially when many people use the water at the same
time. Therefore, many people install a water tower on the roof of the
building. The water is stored at a water tank at the basement first. Then it is
pumped into the water tower on the roof using a pumping motor. In this
manner, the low water-pressure problem can be improved and the water can
be used in a more efficient way.
8/7/2019 report of wlc
6/27
Traditional Water Level Controller
Traditional water level controller uses floating balls as the sensors for level
detection, which is depicted in Figure 1. As shown in the figure, the
controller has two floating balls (will be called ball A and ball B hereafter)placed at two levels (will be called level H and level L hereafter). According
to the positions of the two balls, the switch of the pumping motor is set to be
on or off.
Using floating balls as the sensors for water level control has the advantages
of simple structure and low cost. However, as mentioned above, since the
contact switch of the pumping motor is usually placed at the top of water
tower, the humidity may corrode the contact point of the switch. This will
cause the switch to mal-function. Meanwhile, since there are no means to
detect the water level of the basement water tank, it is possible that the
pumping water will be burned if there is water level in the basement watertank is too low.
8/7/2019 report of wlc
7/27
Synopsis
Water level controller
Project Statement :To design an automatic system which will display the water level of a
tank and control the ON/OFF function of motor.
Why particular topic is chosen?
To solve the problem related to water management in household
systems.
Objective and scope of project:
The proposed system will be able to do the following:
1. Indicate the water level of a tank.
2. The system automatically on/off motor to control waterlevel of the tank as required.
3. LED will be on when motor is on .
Methodology:
The present concept implements controlling of pump which pumps water
from the sump (underground tank) to the overhead tank, using 89C2051
microcontroller.
The control panel, i.e. the main control unit of the system which
consists of the primary control pump indicator and level indicators.
The heart of the system is microcontroller(89C2051) and the program
in it. The system will read, indicate and control water level on the tank.
8/7/2019 report of wlc
8/27
HARDWARE TOOLS USED:
1. RELAY: Relay is used to control the on/off function ofmotor.
2. DISPLAY DEVICES: This device indicates the waterlevel in tank and gives the signal. These are as follows:a. 7-segment display
b. LED
3. TANK: There are two tanks were used in this system.These are as follows:a. Top tank: Two levels can be detected (low and high level).
b. Underground tank: Two levels can be detected(low and high
level).
4.LEVEL DETECTORS: To detect levels of the tank
sensors can be used.
8/7/2019 report of wlc
9/27
5.CONTROLLER: The main part of the system is
89C2051 microcontroller chip.
Software to be used:
Assembly language programming tool for programming
microcontroller.
Contribution of the project:
This project will be useful to solve the problems related to
water management in residencies, hotels, hospitals etc.
Project by:
1. Arati Chavan (09)
8/7/2019 report of wlc
10/27
2. Mrudula Chougule (11)
3.Trupti Desai (12)
Project Guide:
Miss. Chaitali Prabhu.
H
e
a
d
o
f
d
ep
ar
t
m
e
nt
M
r.
A
.
R
.
N
ig
a
v
e
k
ar
8/7/2019 report of wlc
11/27
Block diagram
UPPER
TANK
UNDERG
ROUND
TANK
MOTO
R
TANK LEVELDETECTOR
(USING ADC
MCP 3202 )
CONTROLLERCIRCUIT
USING (CHIP
89C2051 )
DISPLAY
DEVICES
8/7/2019 report of wlc
12/27
ADC(mcp 3202)
The MCP3202 12-bit Analog-to-Digital Converter (ADC) combines highperformance and low power consumption in a small package, making it ideal
for embedded control applications. The MCP3202 features a successive
approximation register (SAR) architecture and an industry-standard SPI
serial interface, allowing 12-bit ADC capability to be added to any
PICmicro microcontroller. The MCP3202 features 100k samples/second, 2
input channels, low power consumption (5nA typical standby, 550 A max.
active), and is available in 8-pin PDIP, SOIC and TSSOP packages.
Applications for the MCP3202 include data acquisition, instrumentation and
measurement, multi-channel data loggers, industrial PCs, motor control,
robotics, industrial automation, smart sensors, portable instrumentation and
home medical appliances.
The ADC operates in two modes as shown in table:
8/7/2019 report of wlc
13/27
The timing diagram of ADC :
Specifications
Parameter Name Mcp 3202
Max Sample Rate (ksamples/sec) 100
Max. INL (LSB) 1
Max. Supply Current (A) 550
Input Type Single-ended
8/7/2019 report of wlc
14/27
# of Input Channels 2
Resolution (bits) 12
Interface SPI
Temp Range (C) -40 to +85C
Input Voltage Range (V) 2.7 to 5.5
Controller chip(89C2051):
The AT89C2051 is a low-voltage, high-performance CMOS 8-bit
microcomputer with 2K bytes of Flash programmable and erasable
read-only memory (PEROM). The device is manufactured using
Atmels high-density nonvolatile memory technology and is
compatible with the industry-standard MCS-51 instruction set. Bycombining a versatile 8-bit CPU with Flash on a monolithic chip, the
Atmel AT89C2051 is a powerful microcomputer which provides a
highly-flexible and cost-effective solution to many embedded control
applications. The AT89C2051 provides the following standard
features: 2K bytes of Flash, 128 bytes of RAM, 15 I/O lines, two 16-
bit timer/counters, a five vector two-level interrupt architecture, a full
duplex serial port, a precision analog comparator, on-chip oscillator
and clock circuitry. In addition, the AT89C2051 is designed with static
logic for operation down to zero frequency and supports two softwareselectable power saving modes. The Idle Mode stops the CPU while
allowing the RAM, timer/counters, serial port and interrupt system to
continue functioning. The power-down mode saves the RAM contents
but freezes the oscillator disabling all other chip functions until the
next hardware reset.
Storage Temperature ..................................... -65C to +150C
Voltage on Any Pin
with Respect to Ground .....................................-1.0V to +7.0VMaximum Operating Voltage ............................................ 6.6V
DC Output Current...................................................... 25.0 mA
TA = -40C to 85C, VCC = 2.7V to 6.0V (unless otherwise noted
8/7/2019 report of wlc
15/27
Specifications
symbol parameter condition min max Units
Vil Input low voltage -0.5 0.2Vcc-0.1 V
Vih Input high voltage (except XTAL1,RST) 0.2Vcc+0.9 Vcc+0.5 V
Vih1 Input high voltage (Xtal1,RST) 0.7Vcc Vcc+0.5 V
Vol Output low
voltage (ports 1,3)
Iol=20mA,Vcc=5V
Iol=10mA,Vcc=2.7V
0.5 V
Voh Output high
voltage (ports 1,3)
Ioh=-80 uA,
Vcc=5V(+0r-)10%
2.4 V
Ioh=-30uA 0.75Vcc V
Ioh=-12uA 0.9Vcc V
Iil Logical 0 input
current (ports 1,3)
Vin=0.45V -50 uA
Itl Logical 1 to 0
transition current
(ports 1,3)
Vin=2V, Vcc=5V(+or
-)10%
-750 uA
Il1 Input leakage
current (port
p1.0,p1.1)
0
8/7/2019 report of wlc
16/27
current mode,12Mhz,Vcc=6V/
3V
Idle mode,12Mhz,Vcc=6V/3V
p1.0 &p1.1=0V or
Vcc
5/1 mA
Power down mode Vcc=6V,p1.0&p1.1=0V or Vcc
100 uA
Vcc=3V,p1.0&p1.1=0
V or Vcc
20 uA
8/7/2019 report of wlc
17/27
Decoder ic 7447:
1. BI must be high when output functions 0 through 15 are desired. RBI
must be high if blanking of a decimal zero is notdesired.
2. If BI is low, all 7 segments are off, regardless of any other inputs (such as
A, B, C, or D).3. The RBO is typically high. If A, B, C, D, and RBI are all low, and the
lamp test (LT) is high, then all 7 segments
are off. In this situation, the RBO goes low.
4. If BI is high, and LT is low, all 7 segments are on. This function can be
used to see if all the LED segments are
working.
5. Note that the BI and RBO share pin #4. It is both an input and an output.
Absolute Maximum Ratings
Supply Voltage 7V
Input Voltage 5.5V
Operating Free Air
Temperature0oC to +70oC
Storage Temperature Range-65oC to
+150oC
8/7/2019 report of wlc
18/27
Specifications
Symbol Parameter Min
Vcc Supply Voltage 4.75
Vih HIGH Level Input Voltage 2
Ta Free Air Operating Temperature 0
7-SEGMENT DISPLAY
7 Segment displays are are basically7 LED's
Basically there are two types of 7-Seg displays:
8/7/2019 report of wlc
19/27
1. Common cathode display: All cathode terminals are shorted and
grounded.
2. Common anode display: All anode terminals are shorted and connected to
vcc.
Here we will be only discussing the Common Anode type. In common
Anode in order to turn ON a segment the corresponding pin must be set to 0.
And to turn it OFF it is set to 1.
RELAY
Sugar cube relay
Relays are devices which allow low power circuits to switch a
relatively high Current/Voltage ON/OFF. For a relay to operate a suitable
pull-in & holding current should be passed through its coil. Generally
relay coils are designed to operate from a particular voltage often its 5V or
12V.
An NPN transistor BEL187 is being used to control the relay. The
transistor is driven into saturation (turned ON) when a LOGIC 1 is written
on the PORT PIN thus turning ON the relay. The relay is turned OFF by
writing LOGIC 0 on the port pin.
A diode (1N4007/1N4148) is connected across the relay coil, this is
done so as to protect the transistor from damage due to the BACKEMF
generated in the relay's inductive coil when the transistor is turned
OFF.When the transistor is switched OFF the energy stored in the inductor
is dissipated through the diode & the internal resistance of the relay coil.
8/7/2019 report of wlc
20/27
As you can see we have used a pull up resistor at the base of the
transistor. AT8951/52/55 has an internal pull up resistor of 10k so when the
pin is pulled high the current flows through this resistor so the maximum
output current is 5v/10K = 0.5ma, the DC current gain ofBEL187 is 100 so
the maximum collector current we can get is 0.5ma x 100 = 50ma, but most
of the relays require more than 70ma-130ma current depending on the relay
that we have used, 0.5ma of base current is not suitable enough for turning
ON the relay, so we have used an external pull up resistor. When the
controller pin is high current flows through the controller pin i.e.
5v/10k=0.5ma as well as through the pull up resistor. We have used 4.7k
pull up resistor so 5v/4.7k=1.1ma so maximum base current can be 0.5ma +
1.1ma=1.6ma i.e. collector current =1.6ma x 100 = 160ma which is enough
to turn ON most of the relays.
8/7/2019 report of wlc
21/27
Circuit diagram:
C 2R 1 6
U 2
A T 8 9 C 2 0 5 1
1
1
0
1 21 31 41 51 61 71 81 9
2 0
236789
1 1
54
R S T / V P P
G
N
D
P 1 . 0 / A I N 0P 1 . 1 / A I N 1
P 1 . 2P 1 . 3P 1 . 4P 1 . 5P 1 . 6P 1 . 7
V C C
P 3 . 0 / R X DP 3 . 1 / T X DP 3 . 2 / I N T OP 3 . 3 / I N T 1P 3 . 4 / T 0P 3 . 5 / T 1P 3 . 7
X
T
A
L
1
X
T
A
L
2
R 2 0
R 5
R 1 5
R 1 7
U 1
12
3
4
5
67
8
91 0
ed
C
a
c
d p
ba
C
a
fg
U 5
7 4 L S 4 8
7126453
1 31 21 11 091 51 4
1
6
8
1248B I / R B OR B IL T
ABCDEFG
V
C
C
G
N
D
+ 5 V
R 2
+ 5 V
Q 1
R 1 8
R 1 2
R 7
+ 5 V
R 1 1
+ 5 V
+ 6 V
J 3
C O N 3
123
U 3
7 4 L S 4 8
7126453
1 31 21 11 091 51 4
1
6
8
1248B I / R B OR B IL T
ABCDEFG
V
C
C
G
N
D
J 1
1234 5
678 + 5 V
D 1
Y 1
+ 6 V
D 2
C 1
R 1 4
R 1 9
R 3
1
3
2
R 1 3
C 3
R 6
R 8
K 1
35
412
+ 5 V
+ 5 V
J 2
C O N 3
123
U 4
12
3
4
5
67
8
91 0
ed
C
a
c
d p
ba
C
a
fg
R 1
R 4
+ 5 V
R 1 0R 9
1
3
2
8/7/2019 report of wlc
22/27
Working:
The model will work in following different steps:
1. Sensors will sense the level of tank (low or high). Instead of sensorspotentiometers are used to give the levels of tank . Two separate pots
are used for two tanks(upper tank and lower tank). By varying the pot
the voltage at input of adc can be varied in the range (0-5)v.
2. To convert this analog input into digital format which is used for
displaying purpose, 12 bit ADC MCP 3202 is used.
This adc can operate in two modes as mentioned above. In this
model adc is configured in single ended mode i.e,ch0 and ch1 can be
used separately for reading level of tanks.
It requires clock(>10khz), Di and CS signal to produce proper
output. This signals are provided through controller by programmingit(i.e, sending required sequence of 0s and 1s).Di bit is programmed
in two modes for CH0 and CH1.The output of adc are 12bits for Ch0
and Ch1,which are given to controller .
3. Controller is the heart of the whole system. It provides control signals
to each block , as per the requirement. For this purpose
microcontroller chip 89C2051 is used which is programmed in
assembly language . It will read adc output and convert it into proper
format which can be used for display.
Port 3 is used for reading and Port 1 is used for displaying. P1.0to P1.3 are used for CH0 and P1.4 to P1.7 are used for CH1.
P3.7 pin is used to provide input to relay ,which controls the
functioning of pump. Instead of pump one LED is used.
LED on -> Motor on
LED off -> Motor off
4. 7447 decoder IC driver is used to drive 7-segment display .Input to
decoder IC is 4bit and output is 7 bit ,which is given to 7-segment
display(common anode display).
5.Seven segment display is used to display the levels of both tanks.
8/7/2019 report of wlc
23/27
Methodology of testing
ADC mcp 3202:
By applying sine wave at the channels and square wave of 100kHz at
clock pin of ADC, we have observed a square wave at Do pin.
Microcontroller 89C2051:
By applying supply voltage we have checked VCC and GND pins.
By writting small test codes we have checked port pins.
7-segment decoder and display:
By applying combinations of 0s and 1s at the input of decoder, we
have observed numbers on display.
Testing of code: We have first tested code for reading one channel of
ADC with the help of asm and adsim.
Finally we have tested whole code for reading both channels and
controlling ON/OFF function of motor.
8/7/2019 report of wlc
24/27
Problems faced during project
The input pins of decoder 7447 (A1 and A3) are interchanged in
hardware, we have corrected it through program.
The P3.7 port pin is not working properly, so instead of it we have
used P3.0 port pin for controlling function of motor.
8/7/2019 report of wlc
25/27
Test report
Sr. No. Input Voltage Level of tank in %
1 0
2 10
3 20
4 30
5 40
6 50
7 60
8 70
9 80
10 90
8/7/2019 report of wlc
26/27
ConclusionThus we can indicate and control the water level of tank in household
systems and save the water.
Variety of sensors can be used to detect the water level.
8/7/2019 report of wlc
27/27
References
Websites:
http://www.atmel.com
www.microchip.com/cn
interface.ti.com
microcontroller.ti.com
http://www.atmel.com/http://www.microchip.com/cnhttp://www.atmel.com/http://www.microchip.com/cn