You are on page 1of 20

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION,

MUMBAI

A Project
Report

On

“Water Leval Controller Using 801 Microcontroller”

DIPLOMA

In
ELECTRONIS &COMPUTER ENGINEERING

Submitted by

MR. PRATIK PARASHRAM YADDUKAR

MR.ABDULREHMAN NAIKWAD
MR.MARUTI KRUSHNA PATIL

MR.OMKAR SHIVAJI PATIL

UNDER THE GUIDANCE OF

Mr.H.A.Panari

DEPARTMENT OF ELECTRONICS &COMPUTER ENGINEERING

SANT GAJANAN MAHARAJ RURAL POLYTECHNIC,


MAHAGAON ACADEMIC YEAR 2023-2024
SANT GAJANAN MAHARAJ RURAL HOSPITAL &RESEARCH CENTER,
MAHAGAON

“SANT GAJANAN MAHARAJ RURAL POLYTECHNIC”


A/P –MAHAGAON, SITE –CHINCHEWADI, TAL-GADHINGLAJ, DIST-KOLHAPUR

Certificate
This is to that the following students of FIFTH semester of Diploma in
ELECTRONICS &COMPUTER ENGINEERING of Institute SANT GAJANAN
MAHARAJ RURAL
POLYTECHNIC,MAHAGAON-416503. (CODE-0965) has completed Micro project
“Water Leval Controller Using 8051 Microcontroller
” satisfactory in subject ESY subject Code 22516 academic year 2023to 2024as
prescribed in the curriculum.

ROLL NO ENROLLMENT NO SEAT NO STUDENT NAME

20 2209650460
MR. PRATIK PARASHRAM YADDULKAR

09 2109650195 MR.MARUTI KURSHNA PATIL

20 2209650463 MR. OMKAR SHIVAJI PATIL

03 2109650180 MR.ABDULREHMAN NAIKWAD

DATE: - -2023 PLACE:


MAHAGAON

MR.H.A.PANARI Mr.M.P.Patil Mrs.R.S. Patil


(Project Guide) (Head of Department) (Principal)
Index
SR.NO CONTENT PAGE NO
1 INTRODUCTION 06
2 CIRCUIT PRINCIPAL 07
3 CIRCUIT DIAGRAM 08
4 COMPONENT REQURIED 09
5 Q&A 10-12
6 ADVANTEGES &APPLICATION 13
7 CODE 14-18
8 CONCLUSION 19
 INTRODUCTION:-
Water Level Controller will help in automatically controlling the
water motor by sensing the water level in a Tank. This project explains you how to detect and
control the water level in an overhead tank or any other Container. This system monitors the
water level of the tank and automatically switches ON the motor whenever Tank is empty.
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. Initially when the tank is empty, LCD will display the
message LOW and motor runs automatically. When water level reaches to half level, now
LCD displays HALF and still motor runs. When the tank is full, LCD displays FULL and
motor automatically stops. Again, the motor runs when water level in the tank becomes
LOW. This project is concerned with the use of Microcontroller for the water level controller.
The heart of the Water Level Controller using 8051 Microcontroller project is the AT89C51
Microcontroller. The different pins of the Microcontroller are responsible for the indication
of LOW, HALF or FULL level of water. One port is Connected to the collector of transistor
for the input of current and the other port is connected to the data pins of LCD and control
pins. The LCD is programmed to display the levels of water in a tank. This explains the use
of A programmable LCD as a indicator of water level as well as the relay connected to the
LEDs which in turn Causes the water motor to turn ON and OFF depending upon the level of
water.
Water Level Controller using 8051 Circuit Principle:-

 This system mainly works on a principle that “water conducts electricity”. The four
wires which are dipped into the tank will indicate the different water levels. Based on
the outputs of these wires, microcontroller displays water level on LCD as well as
controls the motor.
 Initially when the tank is empty, LCD will display the message LOW and motor runs
automatically. When water level reaches to half level, now LCD displays HALF and
still motor runs.
 When the tank is full, LCD displays FULL and motor automatically stops. Again, the
motor runs when water level in the tank becomes LOW.

Block diagram:-
 Water Level Controller using 8051 Microcontroller
Circuit Diagram:-
 Components Required for Water Level Controller using
8051 Microcontroller:-

 AT89C51 Microcontroller (or any 8051 based Microcontroller)


 8051 Programmer (Programming Board)
 11.0592 MHz Quartz Crystal
 2 x 33pF Capacitor
 2 x 10KΩ Resistor (1/4 Watt)
 10µF Capacitor
 Push Button
 1KΩ x 8 Resistor Pack (for Pull – up)
 16 x 2 LCD Display
 5V Relay
 4 x 2N2222 (NPN) Transistors
 DC Motor (for demonstration)
 10KΩ Potentiometer
 1N4007 PN Junction Diode
 Programming cable
 Connecting wires
 Power Supply
 Keil µVision IDE
 Willar Software (for burning code)
 Proteus (for circuit diagram)
 How to Design Circuit for Water Level Controller using
8051 Microcontroller?

 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.
 For demonstration purpose, we have used a simple DC Motor Pump. It is connected to
the Relay and the input to the relay is fed from P0.7 through a transistor.
 Algorithm for Water Level Controller Circuit :-

 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.
 If P0.2 is HIGH, then the water level in the tank is FULL.
 Now, make the P0.7 pin as LOW to turn off the motor automatically.
 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.
3. Now give the connections as per the circuit diagram.
4. While giving the connections, make sure that there is no common connection between
AC and DC supplies (if you are using an AC Motor)
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.
8. For middle level, it will display as HALF on the LCD.
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.
10. Switch off the motor supply and board supply.
 Water Level Controller Circuit 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 of Water Level Controller Circuit using 8051:-

 Used in big buildings where the manual monitoring is difficult.


 Used in industries to control the liquid level automatically.
 C code for water level controller using 8051:-

#include <REGX51.H>
//Led Represent water level
#define ON 1
#define OFF 0
sbit LED0=P1^0;
sbit LED1=P1^1;
sbit LED2=P1^2;
sbit LED3=P1^3;
sbit LED4=P1^4;
//Switch represent the
//Five wire
#define PRESS 1
#define NOT_PRESSED 0
sbit SW1=P3^3;
sbit SW2=P3^4;
sbit SW3=P3^5;
sbit SW4=P3^6;
sbit SW5=P3^7;
// Motor and buzzer
#define HIGH 1
#define LOW 0
sbit M_a=P1^5;
sbit M_b=P1^6;
// Lcd
#define LCD P2
sbit RS =P3^0;
sbit EN =P3^1;
//Prototype for Lcd
void lcdCommand(const char command);
void displayOnLcd(const char *pszMessage);
void lcdStart(void);
void delay(unsigned int);
/*Function to write command on Lcd*/
void lcdCommand(const unsigned char command)
{
LCD = command;
RS = 0;
EN = 1;
delay(300);
EN=0;
}
void lcdData(const unsigned char dataPrint)
{
LCD = dataPrint;
RS=1;
EN=1;
delay(400);
EN=0;
}
/*Function to Display string on Lcd*/
void displayOnLcd(const char *pData)
{
while(*pData)
{
lcdData(*pData);
++pData;
delay(300);
}
}
/*Function to Provide delay*/
void delay(unsigned int time)
{
unsigned int i;
for(i=0; i<=time; i++);
}
/*Initialize the LCD*/
void lcdStart(void)
{
delay(500);
lcdCommand(0x01);
delay(500);
lcdCommand(0x80);
delay(500);
lcdCommand(0x0C);
}
// Water Level Status
unsigned char checkWaterLevel(void)
{
if(SW1==0)
{
LED0 = ON;
if(SW2==0)
{
if(SW3 ==0)
{
if(SW4==0)
{
if(SW5==0)
{
return 100;
}
return 80;
}
return 60;
}
return 40;
}
return 20;
}
return 0;
}
void showStatusofWaterLevel(unsigned char status)
{
switch(status)
{
case 0:
LED0 = OFF;
LED1 = OFF;
LED2 = OFF;
LED3 = OFF;
LED4 = OFF;
displayOnLcd("0%");
break;
case 20:
LED0 = ON;
LED1 = OFF;
LED2 = OFF;
LED3 = OFF;
LED4 = OFF;
displayOnLcd("20%");
break;
case 40:
LED0 = ON;
LED1 = ON;
LED2 = OFF;
LED3 = OFF;
LED4 = OFF;
displayOnLcd("40%");
break;
case 60:
LED0 = ON;
LED1 = ON;
LED2 = ON;
LED3 = OFF;
LED4 = OFF;
displayOnLcd("60%");
break;
case 80:
LED0 = ON;
LED1 = ON;
LED2 = ON;
LED3 = ON;
LED4 = OFF;
displayOnLcd("80%");
break;
case 100:
LED0 = ON;
LED1 = ON;
LED2 = ON;
LED3 = ON;
LED4 = ON;
displayOnLcd("100%");
break;
}
}
void motorRun()
{
M_a=1;
M_b=0;
M_a=1;
M_b=0;
}
void motorStop()
{
M_a=0;
M_b=0;
M_a=0;
M_b=0;
}
int main()
{
unsigned char waterStatus = 0x00;
unsigned char tmpWaterStatus = 0x01;
while(1)
{
waterStatus = checkWaterLevel();
if(waterStatus != tmpWaterStatus)
{
lcdStart();
showStatusofWaterLevel(waterStatus);
tmpWaterStatus = waterStatus;
if(tmpWaterStatus != 100)
{
motorRun();
}
else
{
motorStop();
}
}
}
}
 Conclusion:-
Water Level Controller using 8051 Microcontroller project will help
in automatically controlling the water motor by sensing the water level in a tank. This article
explains you how to detect and control the water level in an overhead tank or any other
container. This system monitors the water level of the tank and automatically switches ON
the motor whenever tank is empty. Water Level Controller using 8051
Microcontroller project will help in automatically controlling the water motor by sensing the
water level in a tank. This article explains you how to detect and control the water level in an
overhead tank or any other container. This system monitors the water level of the tank and
automatically switches ON the motor whenever tank is empty.

You might also like