Вы находитесь на странице: 1из 27


Project Report On

By :
Arati P. Chavan
Mrudula B. Chougule
Trupti V. Desai

Under the Guidance of

Miss.Chaitali Prabhu

Department Of Electronics
College Of Engineering, Kolhapur


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.

Student’s name:
 Arati Chavan.(09)
 Mrudula Chougule.(11)
 Trupti Desai.(12)

Miss. Chaitali Prabhu

Guide Mr.A.R.Nigavekar.

I thankful to God for the blessing he has showed on me for the success
of 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.

Place: Kolhapur


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.

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.
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 water
tank is too low.

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

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 water

level of the tank as required.

3. LED will be on when motor is on .

The present concept implements controlling of pump which pumps water
from the sump (underground tank) to the overhead tank, using 89C2051
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.

1. motor.
RELAY: Relay is used to control the on/off function of

2. DISPLAY DEVICES: This device indicates the water

level in tank and gives the signal. These are as follows:

a. 7-segment display
b. LED

3. TANK:

These are as follows:

There are two tanks were used in this system.

a. Top tank: Two levels can be detected (low and high level).
b. Underground tank: Two levels can be detected(low and high


sensors can be used.

To detect levels of the tank
5. CONTROLLER: The main part of the system is

89C2051 microcontroller chip.

Software to be used:
Assembly language programming tool for programming
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)

2. Mrudula Chougule (11)
3.Trupti Desai (12)

Project Guide:
Miss. Chaitali Prabhu.



R MCP 3202 ) 89C2051 )


Block diagram
ADC(mcp 3202)

The MCP3202 12-bit Analog-to-Digital Converter (ADC) combines high

performance 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:
The timing diagram of ADC :


Parameter Name Mcp 3202

Max Sample Rate (ksamples/sec) 100
Max. INL ± (LSB) 1
Max. Supply Current (µA) 550
Input Type Single-ended
# of Input Channels 2
Resolution (bits) 12
Interface SPI
Temp Range (°C) -40 to +85°C
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
Atmel’s high-density nonvolatile memory technology and is
compatible with the industry-standard MCS-51 instruction set. By
combining 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 software
selectable 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 ..................................... -65°C to +150°C

Voltage on Any Pin
with Respect to Ground .....................................-1.0V to +7.0V
Maximum Operating Voltage ............................................ 6.6V
DC Output Current...................................................... 25.0 mA

TA = -40°C to 85°C, VCC = 2.7V to 6.0V (unless otherwise noted


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 Iol=20mA,Vcc=5V 0.5 V
voltage (ports 1,3)
Voh Output high Ioh=-80 uA, 2.4 V
voltage (ports 1,3) Vcc=5V(+0r-)10%

Ioh=-30uA 0.75Vcc V

Ioh=-12uA 0.9Vcc V

Iil Logical 0 input Vin=0.45V -50 uA

current (ports 1,3)
Itl Logical 1 to 0 Vin=2V, Vcc=5V(+or -750 uA
transition current -)10%
(ports 1,3)
Il1 Input leakage 0<Vin<Vcc (+or-)10 uA
current (port
Vos Comparator input Vcc=5V 20 mV
offset voltage
Vcm Comparator input 0 Vcc V
common mode
RRST Reset pull-down 50 300 K(ohm
resistor s)
Cio Pin capacitance Test freq.=1Mhz, 10 pF
TA=25degree C
Icc Power supply Active 15/5.5 mA
current mode,12Mhz,Vcc=6V/
Idle mode, 5/1 mA
p1.0 &p1.1=0V or
Power down mode Vcc=6V,p1.0&p1.1=0 100 uA
V or Vcc
Vcc=3V,p1.0&p1.1=0 20 uA
V or Vcc
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 not desired.
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
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
0oC to +70oC
-65oC to
Storage Temperature Range

Symbol Parameter Min

Vcc Supply Voltage 4.75
Vih HIGH Level Input Voltage 2
Ta Free Air Operating Temperature 0


7 Segment displays are are basically7 LED's

Basically there are two types of 7-Seg displays:

1. Common cathode display: All cathode terminals are shorted and

2. Common anode display: All anode terminals are shorted and connected to

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.


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

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 BACK EMF
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.
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 of BEL187 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.
Circuit diagram:
+ 5 V

U 2

+ 5 V U 3

C a

C a
2 1 2 7 1 3 R 1 7
P 3 . 0 / R P X 1 D . 0 / A 1 I 3N 0 1 A a

3 1 1 2 R 2 6

J 1
6 P 3 . 1 / T PX 1D . 1 / A 1 I 4 N 1 2 2 B 1 1 R 4 4 b
1 8 + 5 V P 3 . 2 / I N T PO 1 . 12 5 4 C c
2 7 6 1 0 R 5 2
2 7 8 P 3 . 3 / I N T P1 1 . 13 6 4 8 D 9 R 6 1 d
R 3 3 6 9 P 3 . 4 / T 0 P 1 . 14 7 5 B I / R B O E 1 5 R 7 9 e
4 5 1 P 3 . 5 / T 1 P 1 . 15 8 R B I F 1 0 f

1 3 1 4 R 8
P 3 . 7 P 1 . 16 9 L T G g
P 1 . 7 5
+ 5 V7 4 L S 4 8
d p

1 2 0
+ 5 V R S T / V P P V C C


C 1
+ 5 V U 1



R 1 0
R 9

U 5

C a

C a
A T 8 9 C Y 2 10 5 1 7 1 3 R 1 1 7

1 A a

1 1 2 R 1 2 6
2 B b

2 1 1 R 1 3 4
6 4 C 1 0 R 1 4 2 c
C 2 C 3 4 8 D 9 R 1 5 1 d
5 B I / R B O E 1 5 R 1 6 9 e
R B I F 1 0 f
3 1 4 R 1 7
R 1 +8 6 V L T G g
+ 5 V7 4 L S 4 8
d p
K 1 J 2

D 2 5
3 1
2 U 4
D 1 4
1 3
2 C O N 3
R 1 9
Q 1

J 3
R 2 0
1 + 6 V
2 + 5 V
C O N 3

The model will work in following different steps:

1. Sensors will sense the level of tank (low or high). Instead of sensors
potentiometers 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 programming
it(i.e, sending required sequence of 0’s and 1’s).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.0
to 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.

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 0’s and 1’s 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.
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.
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
Thus 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.