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
#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
    digitalWrite(led, LOW);//the led will light up  
 //and if nobody in the room 
      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

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

For more Watch this video


Popular posts from this blog

diy relay module

TFT Game by Areeb

pov display