Water Level Indicator Using 8051
Water Level Indicator Using 8051
Water Level Indicator Using 8051
MINI PROJECT
Submitted in fulfilment of the requirement of University Of Mumbai for the
Degree of Engineering
(Electronics Engineering)
By
AUMKAR JANGAM (TU1S1718002)
NIKHIL KEMPWADE (TU1S1718004)
SAMIKSHA MAYEKAR (TU1F1617038)
NUTAN DONGARE (TU1S1718006)
The motor is switched OFF when the overhead tank or container is FULL. Here,
the water level of the tank is indicated on LCD (Liquid crystal Display). Using
this system, we can avoid the overflow of the water.
Here we are designing the circuit which is used to detect and control the water
level automatically in overhead tank using 8051 microcontroller.
In this system, water sensing can be done by using a set of 4 wires, which are
placed at different levels in tank. DC supply probe is placed at the base of the
tank.
Components Required for Water Level Controller using 8051
Microcontroller
2 x 33pF Capacitor
10µF Capacitor
Push Button
16 x 2 LCD Display
5V Relay
10KΩ Potentiometer
Programming cable
Connecting wires
Power Supply
Description:
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.
The heart of the Water Level Controller using 8051 Microcontroller project is
the AT89C51 Microcontroller. The water level probes are connected to the P0.0,
P0.1 and P0.2 through the transistors (they are connected to the base of the
transistors through corresponding current limiting resistors). P0.0 for LOW
level, P0.1 for HALF Level and P0.2 for HIGH Level.
The Collector terminals of the Transistors are connected to VCC and the Emitter
terminals are connected to PORT0 terminals (P0.0, P0.1 and P0.2).
PORT1 of the microcontroller is connected to the data pins of LCD and the
control pins RS, RW and EN of the LCD Display are connected to the P3.6,
GND and P3.7 respectively.
First configure the controller pins P0.0, P0.1 and P0.2 as inputs and P0.7
as output.
Now, initialize the LCD.
Continuously check the water level input pins P0.0, P0.1 and P0.2.
If all the pins are low, then display tank as “EMPTY” on the LCD and
make P0.7 pin HIGH to run the motor automatically.
If the level is low i.e. if P0.0 is HIGH, display the water level as “LOW”
and continue to run the motor.
A HIGH pulse on the pin P0.1 indicates that water has reached half level.
So, display the same thing on LCD and run the motor normally.
Now, make the P0.7 pin as LOW to turn off the motor automatically.
PROGRAM CODE:
#include<reg51.h
sbit RS=P0^0;
sbit RW=P0^1;
sbit EN=P0^2;
sbit in0=P1^0;
sbit in1=P1^1;
sbit in2=P1^2;
sbit in3=P1^3;
sbit LED=P3^0;
void delay();
void lcdcmd(unsigned char);
void lcddat(unsigned char);
void delayled();
void delay()
{
int i;
for(i=0;i<=1275;i++);
}
void delayled()
{
int i,j;
for(i=0;i<=1275;i++)
for(j=0;jj<=10;j++);
void lcdcmd(unsigned char val)
{
P2=val;
RS=0;
RW=0;
EN=1;
Delay();
EN=0;
}
void lcddat(unsigned char val)
{
P2=val;
RS=1;
RW=0;
EN=1;
delay();
EN=0;
}
void main()
{
char i;
char a[]={"WATER INDICATOR "};
char b[]={"TANK : EMPTY "};
char c[]={"TANK : 25% "};
char d[]={"TANK : 50% "};
char e[]={"TANK : 75% "};
char f[]={"TANK : 100% "};
P2=0x00;
lcdcmd(0x38);
lcdcmd(0x10);
lcdcmd(0x0c);
lcdcmd(0x80);
LED=1;
in0=0;
in1=0;
in2=0;
in3=0
while(1)
{
if(in0!=1 && in1!=1 && in2!=1 && in3!=1)
{
for(i=0;a[i]!=0;i++)
{
lcddat(a[i]);
}
lcdcmd(0xc0);
for(i=0;b[i]!=0;i++)
{
lcddat(b[i]);
}
}
else if(in3==1)
{
for(i=0;a[i]!=0;i++)
{
lcddat(a[i]);
}
lcdcmd(0xc0);
for(i=0;f[i]!=0;i++)
{
lcddat(f[i]);
}
while(in3==1)
{
LED=0;
delayled();
LED=1;
delayled();
}
}
else if(in2==1)
{
for(i=0;a[i]!=0;i++)
{
lcddat(a[i]);
}
lcdcmd(0xc0);
for(i=0;e[i]!=0;i++)
{
lcddat(e[i]);
}
}
else if(in1==1)
{
for(i=0;a[i]!=0;i++)
{
lcddat(a[i]);
}
lcdcmd(0xc0);
for(i=0;d[i]!=0;i++)
{
lcddat(d[i]);
}
}
else if(in0==1)
{
for(i=0;a[i]!=0;i++)
{
lcddat(a[i]);
}
lcdcmd(0xc0);
for(i=0;c[i]!=0;i++)
{
lcddat(c[i]);
}
}
}
}
.
How to Operate Water Level Controller Circuit using 8051
Microcontroller?
1. Initially, write the program for Water Level Controller in Keil µVision
IDE and generate the .hex file.
2. Burn the program (.hex file) to the microcontroller using external
programmer and Willar Software.
5. Place the 4 water level indicating wires into the small tank (3 probes for
three different levels and fourth one for common supply)
6. Switch on the supply. Now, the motor will run automatically as there is
no water in the tank. (It will turn on even if the water level is LOW).
7. Now pour the water, when it reaches LOW level, then LCD displays
LOW.
9. Still if you pour the water, then the water level reaches full and the LCD
displays FULL and also the motor is turned OFF automatically.