hrsajjad844
Published © MIT

Bidirectional Visitor Counter with Automatic Light Control

Bidirectional Visitor Counter with Automatic Light Control using Arduino, IR sensors. Where you can easily count the person.

AdvancedShowcase (no instructions)11,572
Bidirectional Visitor Counter with Automatic Light Control

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
IR Transceiver (Generic)
×1
Relay Accessory, Relay Module
Relay Accessory, Relay Module
×1
Breadboard (generic)
Breadboard (generic)
×1
Alphanumeric LCD, 16 x 2
Alphanumeric LCD, 16 x 2
×1
Jumper wires (generic)
Jumper wires (generic)
×1

Story

Read more

Schematics

circuit diagram

Here is the circuit diagram.

Code

Code

C/C++
This is the project code
//Visitors Counter and Automatic Room Light

#include<LiquidCrystal.h>
int Contrast = 60;
LiquidCrystal lcd(12,11,5,4,3,2);

#define in 14
#define out 19
#define relay 1

int count=0;

void IN()
{
    count++;
    lcd.clear();
    lcd.print("Person In Room:");
    lcd.setCursor(0,1);
    lcd.print(count);
    delay(1000);
}

void OUT()
{
  count--;
    lcd.clear();
    lcd.print("Person In Room:");
    lcd.setCursor(0,1);
    lcd.print(count);
    delay(1000);
}

void setup()
{
  analogWrite(6, Contrast);
  lcd.begin(16,2);
  lcd.print("Visitor Counter");
  delay(2000);
  pinMode(in, INPUT);
  pinMode(out, INPUT);
  pinMode(relay, OUTPUT);
  lcd.clear();
  lcd.print("Person In Room:");
  lcd.setCursor(0,1);
  lcd.print(count);
}

void loop()
{  
  
  if(digitalRead(in))
  IN();
  if(digitalRead(out))
  OUT();
  
  if(count<=0)
  {
    lcd.clear();
    digitalWrite(relay, LOW);
    lcd.clear();
    lcd.print("Nobody In Room");
    lcd.setCursor(0,1);
    lcd.print("Light Is Off");
    delay(200);
  }
  
  else
    digitalWrite(relay, HIGH);
  
}

Credits

hrsajjad844

hrsajjad844

1 project • 16 followers

Comments