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

KLEF

DEPARTMENT OF ELECTRICAL AND ELECTRONICS


ENGINEERING

A Project Based Lab Report

On

WATER LEVEL CONTROLLER USING MICROCONTROLLER

BATCH-12

SUBMITTED BY:

I.D NUMBER NAME

190069032 CHUNDURU RAJA CHOWDARY

190069033 BODEDLA SRIRAM CHOWDARY

190069034 PULI PRUDHVI

UNDER THE ESTEEMED GUIDANCE OF

Mr. S. RAVI TEJA

KL UNIVERSITY
Green fields, Vaddeswaram – 522 502
Guntur Dt., AP, India.

1
DEPARTMENT OF ELECTRICAL AND ELECTRONICS
ENGINEERING

CERTIFICATE

This is to certify that the project-based laboratory report entitled


“WATER LEVEL CONTROLLER USING MICROCONTROLLER”
submitted by Mr. Ch. Raja Chowdary (190069032), Mr. B. Sriram Chowdary
(190069033), Mr. P.Prudhvi (190069034), to the Department of ELECTRICAL
AND ELECTRONICS ENGINEERING , KL University in partial fulfillment
of the requirements for the completion of a project based Laboratory in
“EMBENDED CONTROLLER’S” course in II B Tech II Semester, is a
bonafide record of the work carried out by him/her under my supervision during
the academic year 2020 – 2021.

PROJECT SUPERVISOR HEAD OF THE D EPARTMENT

Mr. S. Ravi Teja Dr. J. SOMLAL

2
ACKNOWLEDGEMENTS

It is great pleasure for me to express my gratitude to our honorable President


Sri. Koneru Satyanarayana, for giving the opportunity and platform with
facilities in accomplishing the project-based laboratory report.

I express sincere gratitude to our Coordinator and HOD-EEE Dr. J.


SOMLAL sir for her leadership and constant motivation provided in successful
completion of our academic semester. I record it as my privilege to deeply thank
for providing us the efficient faculty and facilities to make our ideas into reality.

I express my sincere thanks to our project supervisor Mr. S. RAVI TEJA


for his/her novel association of ideas, encouragement, appreciation, and
intellectual zeal which motivated us to venture this project successfully.

Finally, it is pleased to acknowledge the indebtedness to all those who


devoted themselves directly or indirectly to make this project report success.

190069032 CHUNDURU RAJA CHOWDARY

190069033 BODEDLA SRIRAM CHOWDARY

190069034 PULI PRUDHVI

3
ABSTRACT

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.

4
INDEX
S.NO TITLE PAGE NO

1 Introduction 6

2 Components used 7

3 Block Diagram 8

4 Circuit Diagram 9

5 Flow Chart 10

6 Operation 11

7 8051 Microcontroller 12

8 LCD Connections 14

8 Programmer Code 22

9 Advantages 25

10 Applications 25

11 Conclusion 25

5
INTRODUCTION

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.

6
Components used

• 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

7
Block Diagram

Block Diagram of Water level controller using Microcontroller.

8
Circuit Diagram

Circuit Diagram of Water level controller using Microcontroller.

9
Flow Chart

Flow chart of Water level controller using Microcontroller.

10
OPERATION

The level sensor probes for the overhead tank are interfaced to the port 2 of the
microcontroller through transistors. Have a look at the sensor probe arrangement
for the overhead tank in Fig1. A positive voltage supply probe goes to the down
bottom of the tank. The probes for sensing 1/4, 1/2, 3/4 and FULL levels are placed
with equal spacing one by one above the bottom positive probe. Consider the
topmost (full level) probe, its other end is connected to the base of transistor Q4
through resistor R16. Whenever water rises to the full level current flows into the
base of transistor Q4 which makes it ON and so its collector voltage goes low. The
collector of Q4 is connected to P2.4 and a low voltage at P2.4 means the overhead
tank is not FULL. When water level goes below the full level probe, the base of
Q2 becomes open making it OFF. Now its collector voltage goes high and high at
P2.4 means the tank is not full. The same applies to other sensor probes (3/4, 1/2,
1/4) and the microprocessor understands the current level by scanning the port pins
P2.4, P2.5, P2.6 and P2.7. All these port pins are high (all sensor probes are open)
means the tank is empty.

Port pin P0.5 is used to control the pump. Whenever it is required, start pumping,
the controller makes P0.5 low which makes transistor Q6 ON which in turn
activates the relay K1 that switches the pump. Also, the LED d6 glows indicating
the motor is ON. LED D7 is the low sump indicator. When the water level in the
sump tank goes low, the controller makes P0.7 low which makes LED D7 to glow.

11
8051 MICROCONTROLLERS

Pin Diagram of 8051 Microcontroller.

12
• 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.

13
LCD CONNCETION

Pin Diagram of LCD.

14
CODE

if(f>v && t>v && h>v && q>v )

lcd.setCursor(0,0);

lcd.print(char(219));

lcd.print(char(219));

lcd.print(char(219));

lcd.print(char(219));

lcd.setCursor(5,0);

lcd.print("FULL");

m=0;

b=0;

else

if(f<v && t>v && h>v && q>v)

lcd.setCursor(0,0);
15
lcd.print(char(219));

lcd.print(char(219));

lcd.print(char(219));

lcd.print("_");

lcd.setCursor(5,0);

lcd.print("3/4th");

b=0;

else

if(f<v && t<v && h>v && q>v)

lcd.setCursor(0,0);

lcd.print(char(219));

lcd.print(char(219));

lcd.print("_");

lcd.print("_");

lcd.setCursor(5,0);

16
lcd.print("HALF");

m=1;

b=0;

else

if(f<v && t<v && h<v && q>v)

lcd.setCursor(0,0);

lcd.print(char(219));

lcd.print("_");

lcd.print("_");

lcd.print("_");

lcd.setCursor(5,0);

lcd.print("1/4th");

b=0;

else

17
if(f<v && t<v && h<v && q<v)

lcd.setCursor(0,0);

lcd.print("_");

lcd.print("_");

lcd.print("_");

lcd.print("_");

lcd.setCursor(5,0);

lcd.print("LOW");

b=0;

else

digitalWrite(motor,LOW);

lcd.setCursor(0,0);

lcd.print("ERROR!");

b=1;

18
}

}}}

if(i==HIGH)

lcd.setCursor(0,1);

lcd.print("Motor ON");

else

lcd.setCursor(0,1);

lcd.print("Motor OFF");

if(s>v && m==1)

digitalWrite(motor,HIGH);

19
}

if(s<v)

digitalWrite(motor,LOW);

lcd.setCursor(11,0);

lcd.print("Low");

lcd.setCursor(11,1);

lcd.print("Sump");

c=1;

if(s>v)

c=0;

if(m==0)

digitalWrite(motor,LOW);

20
}

if(b==1 || c==1)

digitalWrite(buz,HIGH);

delay(500);

digitalWrite(buz,LOW);

else

digitalWrite(buz,LOW);

delay(100);

lcd.clear();

21
MICROCONTROLLER CODE
#define F_CPU 8000000UL

#include <avr/io.h>

#include <util/delay.h>

int main(void)

DDRB = 0x00; // PORTB pins as input

DDRD = 0xff; // PORTD as output

DDRC = 0x01; // Buzzer

unsigned char seg[10] =


{0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x67};

while(1)

if((PINB & 0xff)==0x00) // 8th probe, Tank full

PORTC = 0x01;

PORTD = seg[8];

else if((PINB & 0xff)==0x01) // 7th probe

PORTC = 0x01;

_delay_ms(500);

PORTC = 0x00;
22
_delay_ms(500);

PORTD = seg[7];

else if((PINB & 0xff)==0x03) // 6th probe

PORTC = 0x00;

PORTD = seg[6];

else if((PINB & 0xff)== 0x07) // 5th probe

PORTC = 0x00;

PORTD = seg[5];

else if((PINB & 0xff)== 0x0f) // 4th probe

PORTC = 0x00;

PORTD = seg[4];

else if((PINB & 0xff)==0x1f) // 3rd probe

PORTC = 0x00;

PORTD = seg[3];

else if((PINB & 0xff) == 0x3f) // 2nd probe

23
PORTC = 0x00;

PORTD = seg[2];

else if((PINB & 0xff) == 0x7f) // 1st probe

PORTC = 0x00;

PORTD = seg[1];

else // Tank empty

PORTC = 0x00;

PORTD = seg[0];

24
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 .

25

You might also like