Klef Department of Electrical and Electronics Engineering A Project Based Lab Report On Water Level Controller Using Microcontroller BATCH-12
Klef Department of Electrical and Electronics Engineering A Project Based Lab Report On Water Level Controller Using Microcontroller BATCH-12
Klef Department of Electrical and Electronics Engineering A Project Based Lab Report On Water Level Controller Using Microcontroller BATCH-12
On
BATCH-12
SUBMITTED BY:
KL UNIVERSITY
Green fields, Vaddeswaram – 522 502
Guntur Dt., AP, India.
1
DEPARTMENT OF ELECTRICAL AND ELECTRONICS
ENGINEERING
CERTIFICATE
2
ACKNOWLEDGEMENTS
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
7
Block Diagram
8
Circuit Diagram
9
Flow Chart
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
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
14
CODE
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
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
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
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");
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)
while(1)
PORTC = 0x01;
PORTD = seg[8];
PORTC = 0x01;
_delay_ms(500);
PORTC = 0x00;
22
_delay_ms(500);
PORTD = seg[7];
PORTC = 0x00;
PORTD = seg[6];
PORTC = 0x00;
PORTD = seg[5];
PORTC = 0x00;
PORTD = seg[4];
PORTC = 0x00;
PORTD = seg[3];
23
PORTC = 0x00;
PORTD = seg[2];
PORTC = 0x00;
PORTD = seg[1];
PORTC = 0x00;
PORTD = seg[0];
24
ADVANTAGES:
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