Soumyadeep Saha
Published

Bidirectional Visitor Counter

This project can be used to count and display the limited number of visitors entering in the room or crowded stores.

IntermediateShowcase (no instructions)10 hours2,009
Bidirectional Visitor Counter

Things used in this project

Hardware components

Buzzer
Buzzer
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

CIRCUIT DIAGRAM

u can use this diagram for message printing on LCD 16X2 display,for various codes using IR sensor or other sensor.

Code

bham.ino

C/C++
As for security measures, counter, overcrowded minimization
#include<LiquidCrystal.h>
LiquidCrystal lcd(4, 5, 6, 7, 8, 9);
int in = A1;
int out = A0;
int speaker = A2;
int buzzer = 0;
int count=0;
int led= A4;

void setup()
{
  lcd.begin(16,2);
  lcd.setCursor(1,0);
  lcd.print("!!! WELCOME !!");
  delay(3000);
  lcd.setCursor(1,0);
  lcd.print("BIDIRECTIONAL");
  lcd.setCursor(0,1);
  lcd.print("VISITOR COUNTER");
  delay(5000);
  if(count>=10){  
   lcd.clear();
   lcd.print("!!! WARNING !!!");
   delay(100);
   lcd.setCursor(0,1);
   lcd.print("  BOAT IS FULL");
   delay(200);
   }
  pinMode(in, INPUT);
  pinMode(out, INPUT);
  pinMode(speaker, OUTPUT);
  pinMode(buzzer, OUTPUT);
}
void loop()
{  
  int i;
  if(digitalRead(in) == LOW){
    count++;
    for(i=0;i<2;i++){
      digitalWrite(buzzer, HIGH);
      delay(80);
      digitalWrite(buzzer, LOW);
      delay(80);
    }
    if(count>=10)
    {
    
      count=10;
  
    digitalWrite(buzzer, HIGH);
   
      }
    lcd.clear();
    lcd.print("PASSENGER IN");
    lcd.setCursor(0,1);
    lcd.print("BOAT:  ");
    lcd.print(count);
    delay(800);
  }
  if(digitalRead(out) == LOW){
    count--;
    for(i=0;i<2;i++){
      digitalWrite(buzzer, HIGH);
      delay(80);
      digitalWrite(buzzer, LOW);
      delay(80);
    }
    if(count<=0)
    {
      count=0;
      }
    lcd.clear();
    lcd.print("PASSENGER IN ");
    lcd.setCursor(0,1);
    lcd.print("BOAT:  ");
    lcd.print(count);
    delay(1000);
  }
  
  if(count<=0)
  {
    lcd.clear();
    digitalWrite(speaker, LOW);
    lcd.clear();
    lcd.print("NO PASSENGER IN THE BOAT");
    lcd.setCursor(0,1);
    lcd.print(" BOAT ");
    delay(200);
  }
   if(count>=10){  
   lcd.clear();
   lcd.print("!!! WARNING !!!");
   delay(100);
   lcd.setCursor(0,1);
   lcd.print("  BOAT IS FULL");
   delay(200);
   }
  else
  
    digitalWrite(speaker, HIGH);
  
}

Credits

Shubham Kumar

Posted by Soumyadeep Saha
Thanks to SOUMYADEEP SAHA,SUBRATA SAHA,NILADITYA.

Comments