Visitor Counter

This Arduino project will automate the lights of the room and also count the person in the rooms 

it also have self-intelligence that if there is no body in the room it will turn of the light
for example if 3 person enters the room then three person should exit also to turn the lights off

  Material needed:-
  • Arduino board
  • 2 IR sensor 
    IR sensor
  • Jumper wire
  • Chassis (optional) 


Connect the IR sensor output on pin 14&19 (I am using Arduino Mega that's why I have connected  it to 14&19 you can change it as your needs in the program)

and the connect led or Relay module on pin 2 (you can change this also as per your need)

Then upload the code 
/*
 * This Code is For Visitor Counter
 * made by Diy-Areeb
 * http://bit.ly/diyareebyoutube
 */
#define in 7      //defining the in sensor
#define out 6    //defining the out sensor 
#define led 13  //you can connect relay module also

int count=0;  


void setup()
{
  Serial.begin(9600);                    //start Serial moniter
  
  Serial.println("Visitor Counter");    //print the title of te project
  delay(2000);                         //as serial moniter starts
  
  pinMode(in, INPUT);                 //describe the
  pinMode(out, INPUT);               //pins 
  pinMode(led, OUTPUT);             //as OUTPUT or INPUT
  
  Serial.print("Person In Room:");//it will first
  Serial.println(count);         //print the 0 number of member
}
void loop()
{  
  
  if(digitalRead(in))       //it works very
  IN();                    //simply if anybody 
  if(digitalRead(out))    //enters the room it will +1
  OUT();                 //and if anybody exit it -1



  //if there is anybody is in the room
  if(count<=0)         
  {
    digitalWrite(led, LOW);//the led will light up  
    
  }
 //and if nobody in the room 
  else                          
  {
      digitalWrite(led, HIGH);//led will be turned off
  }

  
}

void IN()  //Function for Adding person
{
    count++; //increase the number of people
    Serial.print("Person In Room:");            //it will print 
    Serial.println(count);                     //+1 if a person enter in the room
    delay(1000);
}


void OUT()//function for Decrease person
{
    count--;//decrease the number of people
    Serial.print("Person In Room:");         //it will print 
    Serial.println(count);                   //-1 if a person exit out the room
    delay(1000);
} 


For more Watch this video

Comments

  1. Hello there. Gratings. If I wanna use a 16X2 LCD then what will be the program? Plz help.

    ReplyDelete
  2. Please contact me @
    sovon.giri@yahoo.com

    ReplyDelete

Post a Comment

Popular posts from this blog

How to use TV as Arduino display || Arduino TVout Library || Hindi

Arduino Keypad

diy relay module