0% found this document useful (0 votes)
123 views

Microprocessor Project

This document describes a water level controller project using an 8051 microcontroller that automatically controls a water pump motor based on the sensed water level in a tank. It uses four wires placed at different levels in the tank to detect the water level. The microcontroller displays the water level on an LCD and controls the motor accordingly - turning it on when the tank is empty and off when full. The system aims to prevent overflow by automatically regulating the motor based on the sensed water level.

Uploaded by

shipli
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
123 views

Microprocessor Project

This document describes a water level controller project using an 8051 microcontroller that automatically controls a water pump motor based on the sensed water level in a tank. It uses four wires placed at different levels in the tank to detect the water level. The microcontroller displays the water level on an LCD and controls the motor accordingly - turning it on when the tank is empty and off when full. The system aims to prevent overflow by automatically regulating the motor based on the sensed water level.

Uploaded by

shipli
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Abstract

Water Level Controller using 8051 Micro-controller

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.

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.

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.

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, micro-controller

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.

8051 Circuit Diagram


8051 Pin Diagram
8051 Architecture
Components Required

1. AT89C51 Micro-controller (any 8051


based Micro-controller)
2. 8051 Programmer (Programming Board)
3. 11.0592 MHz Quartz Crystal
4. 2 x 33pF Capacitor
5. 2 x 10KΩ Resistor (1/4 Watt)
6. 10µF Capacitor
7. Push Button
8. 1KΩ x 8 Resistor Pack (for Pull – up)
9. 16 x 2 LCD Display
10. 5V Relay
11. 4 x 2N2222 (NPN) Transistors
12. DC Motor (for demonstration)
13. 10KΩ Potentiometer
14. 1N4007 PN Junction Diode
15. Programming cable
16. Connecting wires
17. Power Supply
18. Keil µVision IDE
19. Willar Software (for burning code)
20. Proteus (for circuit diagram)
Algorithm used
1. Configure the controller pins P0.0, P0.1 and P0.2
as inputs and P0.7 as output.

2. Initialize the LCD.

3. Continuously check the water level input pins
P0.0, P0.1 and P0.2.

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

5. If the level is low i.e. if P0.0 is HIGH, display
the water level as “LOW” and continue to run the
motor.

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

7. If P0.2 is HIGH, then the water level in the tank
is FULL.

8. Now, make the P0.7 pin as LOW to turn off the
motor automatically.
Code
// Program to make a Liquid level indicator using LCD
#include <REGX51.H>
sbit rs=P0^5; //register select pin
sbit rw=P0^6; //read/write pin
sbit e=P0^7; //enable pin

sbit quat=P0^0; //pin connected to quarter level of tank
sbit half=P0^1; //pin connected to half level of tank
//sbit quat_3=P0^2; //pin connected to three -fourth
level of tank
sbit full=P0^3; //pin connected to full level of tank

//sbit spkr_on=P3^4;
//sbit spkr_off=P3^5; // pin to off speaker
sbit Motor =P0^4;

void delay(int k) //delay function
{
int i,j;
for(i=0;i<k;i++)
for(j=0;j<1275;j++);
}

void write(int j) //write function
{
rs=1; //selecting command register
rw=0; //selecting to write
P2=j; //putting value on the pins
e=1; //strobe the enable pin
delay(1);
e=0;
return;
}

void cmd(int j) //command function
{
P2=j; //put the value on pins
rs=0; //selecting command register
rw=0; //selecting to write
e=1; //strobe enable pin
delay(1);
e=0;
return;
}

void puts(char *a) //puts function to print a string
{
unsigned int p=0;
for(;a[p]!=0;p++)
write(a[p]);
}

void lcd_init(void) // function to initialise the LCD
{
cmd(0x38); //setting 8-bit interface, 2 lines, 5*7 Pixels
delay(1);
cmd(0x0e); //turning on underline visible cursor
delay(1);
cmd(0x01); //clearing screen
cmd(0x80); //moving cursor to the beginning of line 1 of LCD
}
void main()
{
quat=half=full=1; //configuring as input pins
quat=half=full=0; //lowering input pins
Motor = 0;
//spkr_on=1; // making speaker on pin high, as it works on
negative logic
while(1)
{
while(quat==0&&half==0&&full==0) //when tank is empty
{
lcd_init(); // initialising LCD
puts(“EMPTY;BUZ ON”);
Motor = 1;
//printing VACANT on lcd
}
while(quat==1&&half==0&&full==0) //when tank is quarter
{
lcd_init();
puts(“QUARTER”); //printing QUATER on lcd
Motor = 0;
}
while(quat==1&&half==1&&full==0) //when tank is half
{
lcd_init();
puts(“HALF”); //printing HALF on lcd
Motor = 0;
}

while(quat==1&&half==1&&full==1) //when tank is full
{
lcd_init();
puts(“FULL;BUZ OFF”);//printing FULL;CLOSE TAP on lcd
Motor = 0;
//spkr_on=0; //Enabling speaker
}
while(quat==1&&half==1&&full==1)//enabling high speaker_off pin
{
// spkr_on=1;//disabling speaker
}
}
}
Operating method
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 micro-controller
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.

Advantages

1. Human effort is reduced as the system


controls the motor automatically based on the
water level.

2. This system consumes less power.
3. Simple and more reliable.

Applications

1. Used in big buildings where the manual monitoring


is difficult.
2. Used in industries to control the liquid level
automatically.
References

1. https://www.electronicshub.org/water-level-
controller-using-8051-microcontroller/

2. www.circuitstoday.com/water-level-controller
-using-8051

3. https://www.elprocus.com/ultrasonic-water-
level-controller-with-8051-microcontroller/

You might also like