Water Level Detector Using 8051 Microcon
Water Level Detector Using 8051 Microcon
Water Level Detector Using 8051 Microcon
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.
• 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
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
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 .