Counter Visitor

the system counts entering and exit of visitor of an auditorium or some other places.the system identifies the entry and exit of visitor with help of IR sensor placed at entry and exit of visitor and delivered the result to LCD.if the people enter it is sensed by ir sensor which in turn sends command to controller. controller then open the entry doors and  increased the counter value of visitor by one. similar operation is performed at the exit side where sensor sensed to decrease the value of counter. one more additional feature of this project is that when number of current people in auditorium touches the mark 10 or above bulb connected to controller via relay glows automatically  and whenever it goes below 10 again the bulb get turn off  

 

Proteus Design

CODE

#include<reg51.h>
#define port P2
sbit rs=P3^0;
sbit rw=P3^1;
sbit e=P3^2;
sbit relay=P1^5;
sbit senin=P1^0;
sbit senout=P1^2;
sbit door1_a=P3^4;
sbit door1_b=P3^5;
sbit door2_a=P3^6;
sbit door2_b=P3^7;

void delay(unsigned int);
void lcd_cmd(unsigned char);
void lcd_data(char);
void lcd_init();
void lcd_string(char*);
void lcd_data_count(int);
void entry_door_open();
void exit_door_open();
void entry_door_close();
void exit_door_close();
void exit_door_stop();
void entry_door_stop();
int num[10];
unsigned int count=0;

void main()
{
senin=0;
senout=0;
relay=0;
port=0x00;
e=0;
rs=0;
rw=0;
P2=0x00;
 lcd_init();

while(1)
{             
                lcd_string("TOTAL VISITORS");
                lcd_cmd(0xc0);
                lcd_string("==>> ");
                if(senin==1)
                {             
                ++count;
                lcd_data_count(count);
                entry_door_open();
                while(senin==1);
                delay(60000);
                delay(60000);
                entry_door_close();
                entry_door_stop();
                delay(5000);
                }
                else if(senout==1)
                {             
                --count;
                lcd_data_count(count);
                exit_door_open();
                while(senout==1);
                delay(60000);
                delay(60000);
                exit_door_close();
                exit_door_stop();
                delay(5000);
                }
                else
                {
                lcd_data_count(count);
                delay(5000);
                }
                if(count>=0&&count<=10)
                {
                                relay=0;
                }
                else
                {
                                relay=1;
                }
}
}
void lcd_init()
{
lcd_cmd(0x38);
delay(100);
lcd_cmd(0x01);
delay(100);
lcd_cmd(0x0e);
delay(100);
lcd_cmd(0x06);
delay(100);
lcd_cmd(0x80);
delay(100);        
}
void lcd_cmd(unsigned char x)
{
rs=0;
port=x;
e=0;
delay(100);
e=1;
}
void delay(unsigned int y)
{
unsigned int i;
for(i=0;i<y;i++);
}
void lcd_string(char *x)
{
while(*x!='\0')
{
                lcd_data(*x);
                x++;
}
}
void lcd_data(char c)
{
rs=1;
port=c;
e=0;
delay(500);
e=1;
}
void lcd_data_count(int i)
{
int p;
int k=0;
                if(i==0)
                {
                                lcd_cmd(0xc5);
                                delay(100);
                                lcd_string("0");
                }
                else if(i==1)
                {
                                lcd_cmd(0xc5);
                                delay(100);
                                lcd_string("1");
                }
                else
                {
                                while(i>0)
                                {
                                                num[k]=i%10;
                                                i=i/10;
                                                k++;
                                }
                                k--;
                                lcd_cmd(0xc5);
                                delay(100);
                                for (p=k;p>=0;p--)
                                {
                                                port=num[p]+48;
                                                rw = 0;
                                                rs = 1;
                                                e = 0;
                                                delay(100);
                                                e = 1;
                                }
                }
}
void entry_door_open()
{
door1_a=1;
door1_b=0;
delay(60000);
delay(60000);
}
void entry_door_close()
{
door1_a=0;
door1_b=1;
delay(60000);
delay(60000);
}
void entry_door_stop()
{
door1_a=0;
door1_b=0;
delay(1000);
}
void exit_door_open()
{
door2_a=0;
door2_b=1;
delay(60000);
delay(60000);
}

void exit_door_close()
{
door2_a=1;
door2_b=0;
delay(60000);
delay(60000);
}
void exit_door_stop()
{
door2_a=0;
door2_b=0;
delay(1000);
}

VIDEO

Category: 

tags: 

Share

Who's new

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

Get Notified

 

Share

We are Social

Syndicate

Subscribe to Syndicate