water level indicator

this article  illustrates the working of water level indicator.water tank that is usually placed at the top of multistory building are difficult to monitor manually,the user can configure the water level according to need thus avoid unnecessary spillage of water. as we know water conducts electricity,this principle can be used to construct the circuit.

Proteus Design

two wires from controller pin p1.0 and p1.1 are dipped in water tank one at half level and other at full level respectively via transistor. port P2  is connected to LCD. message will be displayed on lcd according to current status of system. when the tank gets filled buzzer connected to pin P3.6  user will be alert by buzzer.

Code

initially when tank has no water or water below level1(half level), it will show "EMPTY" message on screen. when gradually tank starts filling up it will continuously monitor the status of tank and update the message to be displayed on lcd.  when tank gets full buzzer will start beeping

complete code

#include<reg51.h>
#define lcdport P2
sbit rs=P3^0;
sbit rw=P3^1;
sbit en=P3^2;
sbit half=P1^0;
sbit full=P1^1;
sbit buzzer=P3^6;

void lcdcmd(char);
void lcdint();
void lcddata(char);
void lcdstring(char *);
void delay(unsigned int);
void main()
{
  P1=0x00;
  half=full=0;
  buzzer=0;
   while(1)
  {
    lcdint();
    if(half==0&&full==0)
  {
   lcdcmd(0x85);    
   lcdstring("EMPTY");
  }

   if(half==1&&full==0)
  {
   lcdcmd(0x85);     
   lcdstring("HALF");
  }
    if(half==1&&full==1)
  {
   buzzer=1;
   lcdcmd(0x85);     
   lcdstring("FULL!!!");
   lcdcmd(0xc3);
   lcdstring("close tap");
   buzzer=0;
  }

   }
}
 void delay(unsigned int x)
{
 unsigned int i;
 for(i=0;i<x;i++);
}

void lcdint()
{
  lcdcmd(0x38);
  delay(500);
  lcdcmd(0x01);
  delay(500);
  lcdcmd(0x0c);
  delay(500);
  lcdcmd(0x80);
  delay(500);
  lcdcmd(0x0e);
  delay(500);
}
void lcdcmd(char value)
{
  lcdport = value;
  rw=0;
  rs=0;
  en=1;
  delay(500);
  en=0;
}
void lcdstring(char *p)
{
  while(*p!='\0')
   {
     lcddata(*p);
     delay(10000);
     p++;
   }
}
void lcddata(char value)
{
  lcdport = value;
  rs=1;
  rw=0;
  en=1;
  delay(500);
  en=0;
}

VIDEO

Category: 

Share

Comments

nicely explained

Who's new

  • ravirajpatil871...
  • shubhambajoria
  • yassir
  • demiholyman890954
  • scottgillum51169040

Get Notified

 

Share

We are Social

Syndicate

Subscribe to Syndicate