How To Build A Visitor Counter Using Arduino

by | Feb 28, 2023 | Arduino, Basic Coding, Coding

Home » Coding » How To Build A Visitor Counter Using Arduino

Introduction of the Project

Are you looking for a fun and easy project to do with your Arduino board? Why not build a visitor counter! Whether you want to keep track of the number of people entering your home or office or you’re simply looking for a fun way to learn about electronics, building a visitor counter using Arduino is a great place to start.

With just a few simple components and a bit of coding, you can create a device that counts the number of visitors and displays the results in real-time. In this Arduino project guide, we’ll walk you through the steps of building a visitor counter using Arduino so that you can start counting your visitors in no time!

 

Supplies

To make a Visitor Counter using Arduino, we will require the following components, which can be bought online or from a nearby electronic store.

Components

Circuit Diagram

How To Build A Visitor Counter Using Arduino

Steps To Build A Visitor Counter Using Arduino

Step 1: Gather all the components on the Digital Board or Physical Table.

LCD:

Step 2: Connect the Power & the LED anode terminal of it to the 5V pin of the Arduino.

Step 3: Connect the Ground, Contrast, Read/Write & LED cathode terminals of it to the GND pin of the Arduino, as shown in the circuit.

Step 4: Connect the Register Select, Enable, & DB4 to DB7 pins of it to the 2 to 7 number pins of the Arduino, as shown in the figure.

PIR Sensor:

Step 5: Connect the Power terminal of it to the 5V pin of the Arduino.

Step 6: Connect the Ground terminal of it to the GND pin of the Arduino.

Step 7: Connect the Signal pin of it to the A0 number pin of the Arduino.

Source Code

#include <LiquidCrystal.h>
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);


int input = 0;
int count = 0;
void setup()
{
lcd.begin(16,2);


pinMode(A0, INPUT);


}
void loop()
{
input = digitalRead(A0);
if(input == HIGH)
{
lcd.setCursor(0,0);
count = count + 1;
lcd.print(count);
delay(1000);
}
}

Explanation of the Code

1. At the beginning, we included the LiquidCrystal library for LCD display purposes.

2. Then, we have created its object with the name LCD, in which we have initialized it with the number of pins to which it is connected to the Arduino starting from the Register select pin.

3. After that, we have initialized two variables input and count to 0.

4. In the setup function, we have configured pin number A0 for input purpose, and LCD will have 16 columns and 2 rows in which each cell can have one character.

5. In the loop function, we are reading the value from input pin A0 and storing it in the input variable.

6. After this, we use the if statement, in which if the value of the input is High, we increase the count variable by one and print it on the LCD display.

7. The delay function used here will take time in milliseconds.

Output

We will get the following output on the successful completion of this Arduino project.

Visitor Counter Using Arduino

On starting the simulation, the number of visitors will be displayed on the LCD screen.

 

 

You May Also Like To Create…

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *