Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Water Level Detector Using 8051 Microcon

Download as pdf or txt
Download as pdf or txt
You are on page 1of 12

Page |1

TOPIC: Liquid/Water Level Indicator with Alarm using


8051 Microcontroller

DESCRIPTION/OBJECTIVE OF THE PROJECT:


This article illustrates the construction and working of a liquid/water level indicator.
Such an indicator is used in tanks to indicate the level of liquids and alert us when the tank is
full. So by this circuit we can monitor the various levels of the tank and can avoid spillage of
water and also we can configure our supplies according to the various levels of tank. Such
module or circuit can be installed in big buildings where manual monitor of tanks is difficult
and its indicator can be placed at some centralized place.

METHODOLOGY:
This water level indicator circuit works on the principle that water conducts electricity. A
wire connected to VCC and four other wires are dipped in tank at different levels namely
quarter, half, three-fourth, full and their output are taken on pins P3.0, P3.1, P3.2, P3.3 via a
transistor BC547. Port P2 is connected to data pins of LCD and P1.0, P1.1, P1.2 are
respectively connected to RS, RW, and EN pins of LCD.

Initially when the tank is empty LCD will show the message VACANT. As the tank starts
filling up wire at different levels get some positive voltage, due to conducting nature of
water. This voltage is then fed to their corresponding pins on controller. When level reaches
to quarter level, LCD displays the message QUARTER. On further rise of level, HALF and 3/4
QUARTER are displayed on LCD. When tank gets full LCD shows the message FULL CLOSE
TAP. A buzzer is also provided to produce a alert the user when the tank gets filled. This
buzzer can be made off by pressing the switch connected between pin 15 of controller and
VCC.

HARDWARE & SOFTWARE TO BE USED:

• LCD (LM016L)
• AT89C52 Microcontroller
• Switches
• LED
• Resistors (10K)
• Capacitor (33pF,10microF)
• Crystal oscillator
• Voltage regulator(7805)
• Potentiometer
• Keil
Page |2

• Proteus
• Connecting wires
• Bread Board

Algorithm for Water Level Controller Circuit:


• First configure the controller pins P1.0, P1.1, P1.2 and P3.0, P3.1, P3.2, P3.3, P3.4 as
inputs and P3.4, P2.0, P2.1, P2.2, P2.3, P2.4, P2.5, P2.6, P2.7 as output.
• Now initialize the LCD.
• Continuously check the water level input pins P3.0, P3.1, P3.2, P3.3 and P3.4
• If all the pins are low then display tank is vacant on LCD automatically.
• High pulse on the pin P3.0 indicates Filling Start, display the same thing on LCD.
• If P3.1 is high then water level is Quarter.
• High pulse on P3.2 indicates Half full of the tank.
• If P3.3 is high then tank is 3/4th full.
• If P3.3 is high then tank is Full and LED glows.

How to Operate Water Level Controller Circuit using 8051/AT89C52


Microcontroller?
1. Initially burn the program to the controller.
2. Now give the connections as per the circuit diagram.
3. While giving the connections, make sure that there is no common connection between AC
and DC supplies.
4. Place the 4 water level indicating wires into the small tank.
5. Switch on the supply.
6. Now pour the water, when it reaches to quarter level then LCD displays QUARTER on LCD.
7. For further levels it will displays HALF and ¾ FULL on LCD.
8. Still if you pour the water then LCD displays FULL and LED turns on automatically when
the tank full.
Page |3

I/O Port Pin and microcontroller connection diagram:

LCD Connection diagram:


Page |4

CIRCUIT DIAGRAM:

Keil CODE:

org 00h
rs equ p1.0; //register select pin
rw equ p1.1; //read/write pin
en equ p1.2; //enable pin
quat equ p3.0; //pin connected to quater level of tank
half equ p3.1; //pin connected to half level of tank
quat_3 equ p3.2; //pin connected to three -fourth level of tank
Page |5

full equ p3.3; //pin connected to full level of tank


spkr_on equ p3.5
spkr_off equ p3.4; // pin to off speaker

SETB spkr_off
SETB full
SETB quat_3
SETB half
SETB quat
clr spkr_off
clr full
clr quat_3
clr half
clr quat
SETB spkr_on
acall lcd_init
start:JB quat,next
JB half,next
JB quat_3,next
JB full,next
JB spkr_off,next
acall lcd_init
acall vacant
sjmp start

next:
JNB quat,next2
JB half,next2
JB quat_3,next2
JB full,next2
Page |6

JB spkr_off,next2
acall lcd_init
acall filling_start
sjmp next

next2:
JNB quat,next3
JNB half,next3
JB quat_3,next3
JB full,next3
JB spkr_off,next3
acall lcd_init
acall quarter
sjmp next2

next3:
JNB quat,next4
JNB half,next4
JNB quat_3,next4
JB full,next4
JB spkr_off,next4
acall lcd_init
acall half_fill
sjmp next3

next4:
JNB quat,next5
JNB half,next5
JNB quat_3,next5
JNB full,next5
Page |7

JB spkr_off,next5
acall lcd_init
acall three_four_full
sjmp next4

next5:
JNB quat,next6
JNB half,next6
JNB quat_3,next6
JNB full,next6
JNB spkr_off,next6
acall lcd_init
acall full_fill
setb spkr_on
sjmp next5

next6:
JB quat,l2
LJMP start
l2:JB half,l3
LJMP start
l3:JB quat_3,l4
LJMP start
l4:JB full,l5
LJMP start
l5:JB spkr_off,l6
LJMP start
l6:JB spkr_on,l7
LJMP start
l7: clr spkr_on
Page |8

sjmp next6

vacant:
mov dptr,#m1
v1: clr a
movc a,@a+dptr
acall data1
acall delay
inc dptr
jz v2
sjmp v1
v2:
ret

filling_start:
mov dptr,#m6
fs1: clr a
movc a,@a+dptr
acall data1
acall delay
inc dptr
jz fs2
sjmp fs1
fs2:
ret

quarter:
mov dptr,#m2
q1: clr a
movc a,@a+dptr
Page |9

acall data1
acall delay
inc dptr
jz q2
sjmp q1
q2:
ret

half_fill:
mov dptr,#m3
h1: clr a
movc a,@a+dptr
acall data1
acall delay
inc dptr
jz h2
sjmp h1
h2:
ret

three_four_full:
mov dptr,#m4
aa1: clr a
movc a,@a+dptr
acall data1
acall delay
inc dptr
jz tf2
sjmp aa1
tf2:
P a g e | 10

ret

full_fill:
mov dptr,#m5
f1: clr a
movc a,@a+dptr
acall data1
acall delay
inc dptr
jz f2
sjmp f1
f2:
ret

delay:
mov r0,#0ffh
d1: mov r1,#08h
d2: djnz r1,d2
djnz r0,d1
ret

lcd_init:
mov a,#80h
acall cmd
mov a,#38h
acall cmd
mov a,#0eh
acall cmd
mov a,#01h
acall cmd
P a g e | 11

ret

cmd:
acall delay
mov p2,a
clr rs
clr rw
setb en
acall delay
clr en
ret

data1:
acall delay
mov p2,a
setb rs
clr rw
setb en
acall delay
clr en
ret

org 400h
m1: db "VACANT",0
m2: db "QUARTER",0
m3: db "HALF",0
m4: db "3/4 FULL",0
m5: db "FULL-SWITCH OFF",0
m6: db "FILLING START",0
end
P a g e | 12

ADVANTAGES:
• Human effort is reduced as the system controls the motor automatically based on
the water level.
• This system consumes less power.
• Simple and more reliable.

APPLICATIONS:
• Automatic Water level Controller can be used in hotels, factories, homes
apartments, commercial complexes, drainage ,etc.
• It will automatically START the pump set as soon as the water level falls below the
predetermined level and shall SWITCH OFF the pump set as soon as tank is full.
• Fuel level indicator in vehicles.
• Liquid level indicator in huge containers in the companies.

CONCLUSION:
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 in an over-head tank storage system and has the ability to
detect the level of water in a tank, switch on/off the pump accordingly and display the
status on an LCD screen. This research has successfully provided an improvement on
existing water level controllers by its use of calibrated circuit to indicate the water level .

You might also like