Vivek CPP
Vivek CPP
(MSBTE)
PROJECT TITLE
DIGITAL VISITOR COUNTER
Submitted by
2024-2025
CERTIFICATE
This is to certify that the project report entitled “DIGITAL VISITOR
COUNTER”, submitted by name ,VIVEK KAPURE (38) is the bonafied work completed under
my supervision and guidance in partial fulfilment for the award of Diploma in Electronics &
Computer Engineering of Maharashtra State Board of Technical Education, Mumbai.
Prof. S. G. Deshmukh
Principal
Marathwada Institute of Technology, Polytechnic,
Chhatrapati Sambhajinagar (MSBTE) – 431 005
INDEX
Sr. No. Chapter Name Page No.
1. INTRODUCTION 1
1.1 Introduction 1
1.2 Statement of the Problem 1
1.3 Objectives 2
2. LITERATURE SURVEY 3
3. SYSTEM DEVELOPMENT 5
3.1 Basic Overview 5
3.2 Block Diagram 6
3.3 Hardware Requirement 7
3.3.1 Atmega328P Microcontroller 7
3.3.2 Power Supply 11
3.3.2.1 Adapter 12
3.3.2.2 Bridge Rectifier 13
3.3.2.3 Capacitor 14
3.3.2.4 7805 Voltage Regulator 15
3.3.2.5 Resistor 16
3.3.2.6 LED 17
3.3.3 Reset Circuit 18
3.3.4 Crystals 16MHz 19
3.3.5 7-segment display 21
3.3.6 IR Sensor 23
3.3.7 Buzzer 24
3.3.8 Arduino IDE 25
1.1 Introduction
Many times, we have seen a gatekeeper in a shopping mall, hall, large restaurant,
office, or parking area holding a 4-digit hand tally counter to manually count the number
of visitors to these places. But this is a very tedious task and there is a possibility of many
calculation errors in this process.
To overcome this problem, in this project we will be going to build a
Bidirectional Digital Visitor Counter. It is used to count the number of Visitors entering a
shopping mall, hall, large restaurant, office, or parking area at the entrance gate. This
system counts the total number of visitors/people entering through the entry gate and also
the total number of visitors/people leaving through the exit gate. Also, it counts the total
number of visitors/people currently present inside the place.
This is an Arduino based very simple project, a few major components are
needed to build this project. These major components are Arduino, two IR sensors, and a
7-segment display 4 digit. Here we are using an Arduino board which acts as the main
microcontroller to control this system. A pair of IR sensors are used to detect the visitor
from both directions, i.e., it detects the number of entering visitors and the number of
exiting visitors. The 7-segment display 4 digit. is used to display the total number of
entering visitors, the total number of exiting visitors, and also shows the total number of
visitors currently present inside the place.
In this project, we will make a Bidirectional Visitor Counter with an Automatic
Light Control System using Arduino. This project is based on a pair of Infrared Sensor
that detects interrupt when it detects an obstacle. The pair of IR sensors can detect the
visitor from both directions, i.e., the number of entering visitors and the number of
exiting visitors. This Arduino Bidirectional Visitor Counter Project can be used to count
the number of persons entering a hall, Shopping mall, office, functions in the entrance
gate. It can also be used at gates of parking areas and other public places. The device
counts the total number of people entering through the gate and also the total number of
people leaving through the same gate. And finally, it counts the total number of people
currently present inside the room. When no people are inside the room, i.e., the total
1
number of people is zero then the room light is turned off. When even a single person is
found inside the room, the light turns on. The light control system is automatic based on
the visitors’ presence.
2
2. LITREATURE SURVEY
This paper presents the design and construction of a digital bidirectional visitor
counter (DBVC). The DBVC is a reliable circuit that takes over the task of counting
number of persons / visitors in the room very accurately and beeps a warning alarm when
the number of visitors exceeds the capacity limit of the auditorium/hall. When somebody
enters the room then the counter is incremented by one (+1) and when any one leaves the
room then the counter is decremented by one (-1). The total number of persons inside the
room is also displayed on the LCD (Liquid Crystal Display). The microcontroller is used
for detecting an entry or exit action and computing the figures (addition and subtraction)
to acquire accurate results. It receives the signals from the sensors, and this signal is
operated under the control of embedded programming code which is stored in ROM of
the microcontroller. The microcontroller continuously monitors the Infrared Receivers.
When any object passes through the IR Receiver's then the IR Rays falling on the
receivers are obstructed. The obstruction occurs under two circumstances, either you
obstruct sensor 1 (i.e. outside the building) before sensor 2 (i.e. which is inside the
building) this shows that you are entering the building or you do it the other way around,
which is obstructing sensor 2 before sensor 1 to indicates an exit movement. This
obstruction is sensed by the Microcontroller, computed and displayed by a 16x2 LCD
screen. [1]
The aim of this paper is to design and implement a unidirectional digital visitor
counter using Bluetooth and FPGA. In this design, an IR sensor is used to detect the entry
of the person. This IR sensor is controlled remotely by the Arduino Bluetooth control
app. This research has been divided into three parts. First: - Detection of entry of the
person in the room using remotely controlled IR sensor. Second: - Increase the count of
people in the room. Third: - Displaying count of the person in android mobile phone
using Arduino Serial Bluetooth Terminal app. The digital visitor counter is designed
using VHDL. To control IR sensor remotely, UART receiver is designed by using
VHDL. For displaying count value in android mobile phone using Arduino Serial
Bluetooth Terminal app, a UART transmitter is designed using (Very High-Speed
Integrated Circuit Hardware Description Language) VHDL. Xilinx Vivado 2015.2 tool is
3
used to design and implement our proposed design on the Artix7 FPGA board. The
proposed unidirectional digital visitor counter can be used in Seminar Hall, Conference
room, Examination Hall, Community Hall, Classrooms, private and public offices, etc.
[2]
In today’s world, there is a continuous need for automatic appliances. With the
increase in standard of living, there is a sense of urgency for developing circuits that
would ease the complexity of life. Many times, we need to monitor the people visiting
some place like shopping mall. To provide solution for this we are going to implement a
project called “Bi Directional Digital Visitor Counter” with automatic room light control.
This project has a “Visitor counter”. Basic concept behind this project is to measure and
display the number of persons entering in any room like seminar hall, conference room
etc. LCD displays number of persons inside the room. We can use this project to count
and display the number of visitors entering inside any conference room or seminar hall.
This works in a two way. That means counter will be incremented if person enters the
room and will be decremented if a person leaves the room. In addition, it will
automatically control room lights. when the room is empty the lights will be
automatically turn off. Digital Visitor Counter bidirectional visitor counter in today’s
world, there is continuous need automatic appliance will be increase in standard of living,
there is a sense of urgency for developing circuit that would ease the complexity of life.
Also, if someone wants to know the number of persons present in a room so as not to
have congestion, the circuit prove to be helpful. The theme of this project when merged
with certain established technologies can be quite effective in number of countries. [3]
4
3. SYSTEM DEVELOPMETN
5
3.2 Block Diagram
POWER RESET
ADAPTER
SUPPLY CIRCUIT
OSCILLATOR IR SENSOR
UNIT -1
MICROCONTROLLER
AVR
IR SENSOR
7- SEGMENT DISPLAY
6
3.3 Hardware Requirement
3.3.1 Atmega328P Microcontroller:
Micro controller is a true computer on a chip. Microprocessors are intended to be
general-purpose digital computers whereas micro controllers are intended to be special
purpose digital controllers. Generally microprocessors contain a CPU, memory-
addressing units and interrupt handling circuits. Micro controllers have these features as
well as timers, parallel and serial I/O and internal RAM and ROM. Like the
microprocessor, a microcontroller is a general-purpose device, but one that is meant to
read data, and control its environmental based on those calculations. The contrast
between a micro controller and a microprocessor is best exemplified by the fact that
microprocessors have many operational codes for moving data from external memory to
CPU; microcontrollers may have one or two. Microprocessors may have one or two types
of bit-handling instructions; micro controllers will have many. The microprocessor is
concerned with the rapid movement of code and data from external addresses to the chip;
the microcontroller is concerned with rapid movements of bits within the chip. The
microcontroller can function as a computer with the addition of no external digital parts;
the microprocessor must have many additional parts to be operational. Generally 8-bit
microcontrollers are intended for use in large volumes as true 1-chipcomputers.
Typical applications consist of appliances and toys. Eight bit micro controllers
represent a transition zone between the dedicated, high volume, 4-bit micro controllers
and the high performance, 16 and 32-bit units. Eight bit micro controllers are very useful
word size for small computing tasks. 16-bit controllers have also been designed to take
the advantage of high level programming languages in the expectation that very little
assembly language programming will be done when employing these controllers in
sophisticated applications. 32 bit controllers are also used in high speed control and
signal processing applications.
The ATMEGA328 is a low-power, high-performance CMOS 8-bit
microcomputer with 8K bytes of Flash programmable and erasable read only memory
(PEROM). The device is manufactured using Atmel’s high-density nonvolatile memory
technology and is compatible with the industry-standard MCS-51 instruction set and pin
out. The on-chip Flash allows the program memory to be reprogrammed in-system or by
7
a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU
with Flash on a monolithic chip, the Atmel ATMEGA328 is a powerful microcomputer
which provides a highly-flexible and cost-effective solution to many embedded control
applications.
PIN Diagram:
8
lines, 32 general purpose working registers, three flexible Timer/Counters.
9
register contents but freezes the Oscillator, disabling all other chip functions until the
next interrupt or hardware reset.
In Power-save mode, the asynchronous timer continues to run, allowing the user
to maintain a timer base while the rest of the device is sleeping. The ADC Noise
Reduction mode stops the CPU and all I/O modules except asynchronous timer and ADC,
to minimize Switching noise during ADC conversions. In Standby mode, the
crystal/resonator Oscillator is running while the rest of the device is sleeping. This allows
very fast start-up combined with low power consumption.
Features:
• Compatible with MCS-51 Products.
• 8K Bytes of In-System Reprogrammable Flash Memory.
• Endurance: 1,000 Write/Erase Cycles.
• Fully Static Operation: 0 Hz to 24 MHz
• Three-level Program Memory Lock.
• 256 x 8-Bit Internal RAM.
• 32 Programmable I/O Lines.
• Three 16-bit Timer/Counters.
• Eight Interrupt Sources.
• Programmable Serial Channel.
• Low Power Idle and Power Down Modes
10
3.2.2 Power Supply
The power supply is designed to convert a 12V adapter input into a stable 5V DC
output, suitable for powering microcontrollers and other electronic components. The
process begins with a 12V adapter, which may provide either AC or DC voltage. To
ensure correct polarity and protect the circuit from accidental reverse connections, a
bridge rectifier is used. It not only converts AC to pulsating DC but also acts as a polarity
correction unit, making sure that the output polarity remains consistent even if the adapter
is connected in reverse. The pulsating DC from the rectifier is then smoothed using a
filter capacitor typically a 1000µF electrolytic capacitor which reduces ripple and
provides a more stable DC voltage. This filtered voltage is then regulated using a 7805-
voltage regulator IC, which ensures that the output remains a constant 5V, ideal for
sensitive electronics. To improve voltage stability and suppress noise, small ceramic
capacitors (usually 0.33µF on the input side and 0.1µF on the output side) are added
around the regulator. Finally, a power indicator LED, connected in series with a 1 kilo-
ohm resistor, is placed across the 5V output to visually confirm that the circuit is active
and supplying power. This simple yet effective design provides reliable, regulated 5V
power with built-in protection and is ideal for embedded systems and safety devices.
11
3.2.2.1 Adapter
The 12V 2A DC Power Supply Adapter is a high-quality power supply designed
for use with CCTV cameras and other security equipment. It provides a stable and
reliable DC output of 12 volts with a maximum current of 2 amps.
Fig.3.5: Adapter
Specification
• Input voltage: 100-240V AC, 50/60Hz
• Output voltage: 12V DC
• Maximum output current: 2A
• Power rating: 24W
• Connector type: DC female plug
• Overload protection
• Short circuit protection
• High Quality Adapter with BIS Certificate
• Over voltage protection
12
3.2.2.2 Bridge Rectifier
A bridge rectifier plays a crucial role in a power supply circuit, especially when
dealing with AC inputs or when polarity safety is a concern. It is used to convert
alternating current (AC) into direct current (DC) and also to ensure correct polarity of the
output, regardless of the polarity of the input from the adapter. This means that even if
the user accidentally connects the adapter terminals in reverse (positive to negative), the
bridge rectifier still directs the current correctly to the load. It achieves this by using four
diodes arranged in a bridge configuration, allowing current to flow through the load in
the same direction during both halves of the AC cycle. As a result, the bridge rectifier not
only converts AC to DC but also acts as a polarity protection circuit, which is especially
important for sensitive electronics like microcontrollers that can be damaged by incorrect
polarity.
13
3.3.2.3 Capacitor
In power supplies, capacitors are used to smooth (filter) the pulsating DC output
after rectification so that a nearly constant DC voltage is supplied to the load. The
pulsating output of the rectifiers has an average DC value and an AC portion that is called
ripple voltage. Filter capacitors reduce the amount of ripple voltage to a level that is
acceptable. It should be noted that resistors and inductors can be combined with the
capacitors to form filter networks. Here we will concentrate on capacitive filters only. In
a filter circuit the capacitor is charged to the peak of the rectified input voltage during the
positive portion of the input. When the input goes negative, the capacitor begins to
discharge into the load.
Smooth the output of the rectifier a reservoir capacitor is used - placed across the
output of the reciter and in parallel with the load. The smoothing works because the
capacitor charges up when the voltage from the rectifier rises above that of the capacitor
and then as the rectifier voltage falls, the capacitor provides the required current from its
stored charge. In this way the capacitor is able to provide charge when it is not available
from the rectifier, and accordingly the voltage varies considerably less than if the
capacitor were not present. The capacitor smoothing will not provide total voltage
stability; there will always be some variation in the voltage. In fact, the higher the value
of the capacitor, the greater the smoothing, and also the less current that is drawn, the
better the smoothing.
14
3.3.2.4 7805 Voltage Regulator
Voltage regulators are very common in electronic circuits. They provide a constant
output voltage for a varied input voltage. In our case the 7805 IC is an iconic regulator IC
that finds its application in most of the projects. The name 7805 signifies two meaning,
“78” means that it is a positive voltage regulator and “05” means that it provides 5V as
output. So our 7805 will provide a +5V output voltage. The output current of this IC can
go up to 1.5A. But, the IC suffers from heavy heat loss hence a Heat sink is
recommended for projects that consume more current. For example if the input voltage is
12V and you are consuming 1A, then (12-5) * 1 = 7W. This 7 Watts will be dissipated as
heat.
LM78XX Technical Specifications
▪ TO-220 Package
▪ The Output current is 1.5 Ampere
▪ Immediate short circuit shutdown function
▪ Immediate over heat shutdown function
▪ Low price
▪ Authentic to use in commercial devices
▪ Accurate and fixed 12V output
▪ Maximum input voltage is 35V DC
▪ Low standby current only 8mA
15
3.3.2.5 Resistor
A resistor is a passive two-terminal electrical component that implements
electrical resistance as a circuit element. In electronic circuits, resistors are used to reduce
current flow, adjust signal levels, to divide voltages, bias active elements, and terminate
transmission lines, among other uses. High-power resistors that can dissipate many watts
of electrical power as heat may be used as part of motor controls, in power distribution
systems, or as test loads for generators. Fixed resistors have resistances that only change
slightly with temperature, time or operating voltage. Resistors are common elements of
electrical networks and electronic circuits and are ubiquitous in electronic equipment.
Practical resistors as discrete components can be composed of various compounds and
forms. Resistors are also implemented within integrated circuits.
16
3.3.2.6 LED
An LED is a two-lead semiconductor light source, which emits lights when
activated. When an appropriate voltage is applied to the LED terminal, then the electrons
are able to recombine with the electron holes within the device and release energy in the
form of photons. This effect is known as electroluminescence. The color of the LED is
determined by the energy band gap of the semiconductor.
The forward voltage require to turn ON a LED, depends on the color of the LED.
If you are feeding the exact value of forward voltage then you can connect a LED directly
to the source. If the voltage is a higher than use a resistance in series with the LED, to
calculate the value of the resistance use formula:
17
3.3.3 Reset Circuit
One task of the power-on reset (POR) is ensuring that the processor starts at a
known address when power is first applied. To accomplish that task, the POR logic
output holds the processor in its reset state when the processor's power supply is first
turned on. The POR's second task is to keep the processor from starting its operation
from that known address until three events have occurred: the system power supplies
have stabilized at the appropriate levels; the processor's clock(s) has (have) settled; and
the internal registers have been properly loaded. The POR accomplishes this second task
through an onboard timer, which continues to hold the processor in its reset state for a
prescribed period of time. That timer triggers after the processor's power supply reaches a
specific voltage threshold. After a set time elapses, the timer expires, causing the POR
output to become inactive, the processor's data sheet specifies the required duration of the
timer's delay. The timer, incidentally, is what differentiates a POR from a voltage
detector, a device that also detects a voltage threshold, but does not time an event.
During powering-on the 328P's reset pin is low until the capacitor C5 is
sufficiently charged. How long this takes depends mainly on the start-up behavior of Vcc.
When DTR is low the capacitor will charge faster because RN2D (from capacitor C5 to
ground) is bypassed. But the main thing is that the power-on reset and the external reset
have the same effect when the rising voltage passes a certain threshold a timer is started
and after it times out program execution starts at 0x0000 or at the Boot Reset Address
.So, in the powering-on situation it makes no sense to differentiate between Power On
Reset and External Reset.
18
3.3.4 Crystals 16MHz
An electronic circuit or electronic device that is used to generate periodically
oscillating electronic signal is called as an electronic oscillator. The electronic signal
produced by an oscillator is typically a sine wave or square wave. An electronic oscillator
converts the direct current signal into an alternating current signal. The radio and
television transmitters are broad casted using the signals generated by oscillators. The
electronic beep sounds and video game sounds are generated by the oscillator signals.
These oscillators generate signals using the principle of oscillation. There are different
types of oscillator electronic circuits such as Linear oscillators – Hartley oscillator,
Phase-shift oscillator, Armstrong oscillator, Clapp oscillator, Colpitts oscillator, and so
on, Relaxation oscillators – Royer oscillator, Ring oscillator, Multivibrator, and so on,
and Voltage Controlled Oscillator (VCO). In this article, let us discuss in detail about
Crystal oscillator like what is crystal oscillator, a crystal oscillator circuit, working, and
use of crystal oscillator in electronic circuits.
19
Fig.3.13: Crystal circuit diagram
These quartz crystal oscillators are highly stable, consists of good quality factor,
they are small in size, and are very economical. Hence, quartz crystal oscillator circuits
are superior compared to other resonators such as LC circuits, turning forks, and so on.
Generally, 8MHz crystal oscillator is used in microprocessors and microcontrollers. The
equivalent electrical circuit also represents the crystal action of the crystal. The basic
components used in the circuit, inductance L1 represent crystal mass, capacitance C1
represents compliance, resistance R1 represents the crystal’s internal structure friction,
and C0 is used to represent the capacitance that is formed because of crystal’s mechanical
molding. The quartz crystal oscillator circuit diagram consists of series resonance and
parallel resonance, i.e., two resonant frequencies. If the reactance produced by
capacitance C1 is equal and opposite to the reactance produced by inductance L1, then
the series resonance occurs.
20
3.3.5 7-segment display
The 4-digtal 7-segment display works independently. It uses the principle of
human visual persistence to quickly display the characters of each 7-segment in a loop to
form continuous strings. For example, when “1234” is displayed on the display, “1” is
displayed on the first 7-segment, and “234” is not displayed. After a period of time, the
second 7-segment shows “2”, the 1st 3th 4th of 7-segment does not show, and so on, the
four digital display show in tSurn. This process is very short (typically 5ms), and because
of the optical afterglow effect and the principle of visual residue, we can see four
characters at the same time.
21
Seven segment displays are used in many days today’s consumer devices like
microwave ovens, washing machines, and air conditioners. They are a simple but
effective way to display numerical data like time or quantity. Since they are made out of
LEDs, they are a low-cost option for displaying information. They are widely appreciated
for its features like accuracy, clarity and optimum functionality.
Features:
1. Bright Red LED chip, which is made from AlGaAs on GaAs substrate
2. Blackface and RED LED segments
3. Type: Common cathode
4. No. of Pins: 12
5. Low Current Consumption
6. High Brightness
7. Easy to Use with PCB Mounting as well as on Breadboard
22
3.3.6 IR Sensor:
IR sensor is an electronic device, that emits the light in order to sense some object
of the surroundings. An IR sensor can measure the heat of an object as well as detects the
motion. Usually, in the infrared spectrum, all the objects radiate some form of thermal
radiation. These types of radiations are invisible to our eyes, but infrared sensor can
detect these radiations.
Fig.3.15: IR sensor
The emitter is simply an IR LED (Light Emitting Diode) and the detector is
simply an IR photodiode. Photodiode is sensitive to IR light of the same wavelength
which is emitted by the IR LED. When IR light falls on the photodiode, the resistances
and the output voltages will change in proportion to the magnitude of the IR light
received. There are five basic elements used in a typical infrared detection system: an
infrared source, a transmission medium, optical component, infrared detectors or
receivers and signal processing. Infrared lasers and Infrared LED’s of specific
wavelength used as infrared sources. The three main types of media used for infrared
transmission are vacuum, atmosphere and optical fibers. Optical components are used to
focus the infrared radiation or to limit the spectral response.
• Detection distance: 2 ~ 30cm
• Detection angle: 35 °
• Comparator chip: LM393
• 3mm screw holes for easy mounting
23
3.3.7 Buzzer
A buzzer is a small yet efficient component to add sound features to our
project/system. It is very small and compact 2-pin structure hence can be easily used
on breadboard, Per Board and even on PCBs which makes this a widely used component
in most electronic applications.
There are two types are buzzers that are commonly available. The one shown here
is a simple buzzer which when powered will make a Continuous Beeeeeeppp. sound,
the other type is called a readymade buzzer which will look bulkier than this and will
produce a Beep. Beep. Beep. Sound due to the internal oscillating circuit present inside it.
But, the one shown here is most widely used because it can be customized with help of
other circuits to fit easily in our application. This buzzer can be used by simply powering
it using a DC power supply ranging from 4V to 9V. A simple 9V battery can also be
used, but it is recommended to use a regulated +5V or +6V DC supply. The buzzer is
normally associated with a switching circuit to turn ON or turn OFF the buzzer at
required time and require interval.
It has two wires. Namely red & black. Polarity matters: black=ground Apply an
oscillating voltage to make a noise. Oscillating voltage alternately squeezes and releases
the piezo element. Must apply flucuating voltage, a steady HIGH or LOW won’t work.
The buzzer case supports the piezo element and has resonant cavity for sound
Fig.3.16: Buzzer
24
3.3.8 Arduino IDE
The Arduino Integrated Development Environment (IDE) is a cross-
platform application (for Windows, macOS, Linux) that is written in functions
from C and C++. It is used to write and upload programs to Arduino compatible boards,
but also, with the help of third-party cores, other vendor development boards.
The source code for the IDE is released under the GNU General Public License,
version 2. The Arduino IDE supports the languages C and C++ using special rules of
code structuring. The Arduino IDE supplies a software library from the Wiring project,
which provides many common input and output procedures. User-written code only
requires two basic functions, for starting the sketch and the main program loop, that are
compiled and linked with a program stub main() into an executable cyclic
executive program with the GNU toolchain, also included with the IDE distribution. The
Arduino IDE employs the program avr dude to convert the executable code into a text file
in hexadecimal encoding that is loaded into the Arduino board by a loader program in the
board's firmware. By default, avrdude is used as the uploading tool to flash the user code
onto official Arduino boards.
Arduino IDE is a derivative of the Processing IDE, however as of version 2.0, the
Processing IDE will be replaced with the Visual Studio Code-based Eclipse Theia IDE
framework. With the rising popularity of Arduino as a software platform, other vendors
started to implement custom open source compilers and tools (cores) that can build and
upload sketches to other microcontrollers that are not supported by Arduino's official line
of microcontrollers. Arduino IDE is an open source software that is mainly used for
writing and compiling the code into the Arduino Module.
It is official Arduino software, making code compilation too easy that even a
common person with no prior technical knowledge can get their feet wet with the
learning process.
It is easily available for operating systems like MAC, Windows, Linux and runs
on the Java Platform that comes with inbuilt functions and commands that play a vital
role for debugging, editing and compiling the code in the environment.
25
Fig.3.17: Arduino window
Each of them contains a microcontroller on the board that is actually programmed and
accepts the information in the form of code.
The main code, also known as a sketch, created on the IDE platform will
ultimately generate a Hex File which is then transferred and uploaded in the controller on
the board. The IDE environment mainly contains two basic parts: Editor and Compiler
where former is used for writing the required code and later is used for compiling and
uploading the code into the given Arduino Module.
26
#define aPin 10 //
#define bPin 12 // _____
#define cPin 8 // | A |
#define dPin 7 // F |_| B
#define ePin 6 // | G |
#define fPin 11 // E |_| C
#define gPin 9 // D O dot
#define ir_entry A2
#define ir_exit A3
#define buzzer 13
long Counter = 0;
int Common = 1; //<Common=1; for Common anode> <Common=0; for Common cathode>
int On, Off, Off_C;
int DTime = 4; // Display timer
pinMode(aPin, OUTPUT);
pinMode(bPin, OUTPUT);
pinMode(cPin, OUTPUT);
pinMode(dPin, OUTPUT);
pinMode(ePin, OUTPUT);
pinMode(fPin, OUTPUT);
pinMode(buzzer, OUTPUT);
if (Common == 1) {
On = 0, Off = 1, Off_C = 0; //for Common anode
}
else {
On = 1, Off = 0, Off_C = 1; //for Common cathode
}
void loop() {
if (digitalRead (ir_entry) == 1) {
if (flag1 == 0) {
flag1 = 1;
digitalWrite(buzzer, HIGH);
Counter = Counter + 1;
if (Counter > 9999) {
Counter = 0;
}
}
} else {
flag1 = 0;
}
if (digitalRead (ir_exit) == 1) {
if (flag2 == 0) {
flag2 = 1;
digitalWrite(buzzer, HIGH);
Counter = Counter - 1;
if (Counter < 0) {
Counter = 9999;
}
}
} else {
flag2 = 0;
}
showNumber(Counter % 10);
digitalWrite(c4Pin, Common);
delay(DTime);
digitalWrite(c4Pin, Off_C);
digitalWrite(buzzer, LOW);
}
void showNumber(int x) {
switch (x) {
case 1: one(); break;
case 2: two(); break;
case 3: three(); break;
case 4: four(); break;
case 5: five(); break;
case 6: six(); break;
case 7: seven(); break;
case 8: eight(); break;
case 9: nine(); break;
default: zero(); break;
}
}
void one() {
digitalWrite( aPin, Off); //
digitalWrite( bPin, On); // |
digitalWrite( cPin, On); // |
digitalWrite( dPin, Off); // |
digitalWrite( ePin, Off); // |
digitalWrite( fPin, Off);
digitalWrite( gPin, Off);
}
void two() {
digitalWrite( aPin, On); // ____
digitalWrite( bPin, On); // |
digitalWrite( cPin, Off); // ____|
digitalWrite( dPin, On); // |
29
digitalWrite( ePin, On); // |____
digitalWrite( fPin, Off);
digitalWrite( gPin, On);
}
void three() {
digitalWrite( aPin, On); // ____
digitalWrite( bPin, On); // |
digitalWrite( cPin, On); // ____|
digitalWrite( dPin, On); // |
digitalWrite( ePin, Off); // ____|
digitalWrite( fPin, Off);
digitalWrite( gPin, On);
}
void four() {
digitalWrite( aPin, Off); //
digitalWrite( bPin, On); // | |
digitalWrite( cPin, On); // ||
digitalWrite( dPin, Off); // |
digitalWrite( ePin, Off); // |
digitalWrite( fPin, On);
digitalWrite( gPin, On);
}
void five() {
digitalWrite( aPin, On); // ____
digitalWrite( bPin, Off); // |
digitalWrite( cPin, On); // |____
digitalWrite( dPin, On); // |
digitalWrite( ePin, Off); // ____|
digitalWrite( fPin, On);
digitalWrite( gPin, On);
}
void six() {
digitalWrite( aPin, On); // ____
digitalWrite( bPin, Off); // |
digitalWrite( cPin, On); // |____
digitalWrite( dPin, On); // | |
digitalWrite( ePin, On); // ||
digitalWrite( fPin, On);
digitalWrite( gPin, On);
}
void seven() {
30
digitalWrite( aPin, On); // ____
digitalWrite( bPin, On); // |
digitalWrite( cPin, On); // |
digitalWrite( dPin, Off); // |
digitalWrite( ePin, Off); // |
digitalWrite( fPin, Off);
digitalWrite( gPin, Off);
}
void eight() {
digitalWrite( aPin, On); // ____
digitalWrite( bPin, On); // | |
digitalWrite( cPin, On); // ||
digitalWrite( dPin, On); // | |
digitalWrite( ePin, On); // ||
digitalWrite( fPin, On);
digitalWrite( gPin, On);
}
void nine() {
digitalWrite( aPin, On); // ____
digitalWrite( bPin, On); // | |
digitalWrite( cPin, On); // ||
digitalWrite( dPin, On); // |
digitalWrite( ePin, Off); // ____|
digitalWrite( fPin, On);
digitalWrite( gPin, On);
}
void zero() {
digitalWrite( aPin, On); // ____
digitalWrite( bPin, On); // | |
digitalWrite( cPin, On); // | |
digitalWrite( dPin, On); // | |
digitalWrite( ePin, On); // ||
digitalWrite( fPin, On);
digitalWrite( gPin, Off);
}
31
4. RESULT AND DISCUSION
First of all, we need to set one IR sensor (IR sensor-1) at the entry gate and
another one (IR sensor-2) set at the exit gate. Normally when IR sensors do not detect
any obstacle, it produces a HIGH (1) output value from the Output Pin.
When a visitor enters through the entry gate the IR sensor-1 detects the visitor
(obstacle) and produces a Low (0) output value from the Output Pin. Then the Arduino
read this value and counts 1+ using the code. Similarly, When the IR sensor-1 detects
another visitor (obstacle), the Arduino increment the counting by 1+. In this way every
time the Arduino adds +1 in the count when a visitor passes through this gate and
calculates the total number of entering visitors.
In the same way, when a visitor leaves through the exit gate the IR sensor-2
detects the visitor (obstacle) and produces a Low (0) output value from the Output Pin.
Then the Arduino read this value and counts 1+ using the code. Similarly, When the IR
sensor-2 detects another visitor (obstacle), the Arduino increment the counting by 1+. In
this way every time the Arduino adds +1 in the count when a visitor passes through this
gate and calculates the total number of exiting visitors.
Every time Arduino Subtracts the total number of entering visitors from the total
number of exiting visitors to calculate the total number of visitors currently present inside
the place.
After counting and calculating all numbers the Arduino sends data to the 7
Segment display 4 digit. The 7 Segment display 4 digit shows the total number of
entering visitors, the total number of exiting visitors, and the total number of visitors
currently present inside the place. The LED starts glowing when no one is present inside
that place.
32
Fig.4.1: Circuit diagram
The 2-pair of infrareds (IR) which consist of a transmitter (TX) and a receiver
(RX) is mounted face to face across the doorway. Both sensors are positioned at the
entrance with distance apart. This means upon the approach of a visitor the installed 2-
pair sensors are triggered by the obstruction. The direction of the visitor is determined by
which sensor is obstructed first before the other sensor follows. If sensor 1 is interrupted
first before sensor 2 is interrupted, it indicates that the visitor is entering. The visitor exits
the premises by interrupting the sensor in opposite direction. The output of the receiver
circuit sends high or low signals in a form of voltage to the microcontroller. The
programmed microcontroller follows the set of instructions (C language) written on it.
The tally computation (addition and subtraction) is done when it receives low signals
from the two IR receivers. It is after this command, which the microcontroller is made to
send control signals to the other I/O devices. The microcontroller also sends a data signal
to the LCD to visually display the exact number of visitors remaining in the building. The
buzzer is activated when the microcontroller detects that the room capacity is exceeded.
33
5. CONCLUSION
5.1 Conclusion
The Bidirectional Digital Visitor Counter project has been successfully
implemented to provide an efficient and intelligent method for counting the number of
people entering and exiting a specific area. The system uses two infrared (IR) sensors and
a microcontroller to detect movement and determine direction, allowing it to increment or
decrement the count based on whether a person is entering or leaving. This automated
approach eliminates the need for manual counting and minimizes human error.
The counter provides accurate and real-time information about the number of
individuals present in a room or hall, which is especially useful in situations requiring
occupancy control such as libraries, offices, conference halls, shopping malls, and other
public places. It helps in maintaining safety protocols such as fire safety limits and
pandemic-related social distancing measures by monitoring the number of people in a
confined area.
The system’s modular design allows easy integration with other devices like
automatic lighting systems or HVAC controls, making it more energy-efficient. The
successful operation of this project highlights the capability of embedded systems in
solving practical, real-world problems and improving daily life through automation and
smart technology.
5.2 Advantages:
• Accuracy: The use of IR sensors ensures precise detection of people entering and
leaving.
• Automation: Reduces the need for manual counting and human error.
• Low Cost: Built using easily available and affordable components.
• Compact Design: Takes up minimal space and can be installed in small entry
points.
• Real-Time Monitoring: Provides immediate updates of the number of people
inside.
34
• Energy Saving: Can be integrated with lighting or air conditioning systems to
save energy when the room is empty.
35
REFERENCES
36
Visitor Counter” Iperial journal of interdisciplinary Research(IJIR) Vol-2, Issue-4,
2016 ISSN: 2454-1362, http://www.onlinejoyrnal.In
[8]. Ali M. Ashkanani, Ali Sobhy M. Roza, HadiNaghavipour, “A Design Approach
of Automatic Visitor Counting System Using Video Camera”, IOSR Journal of
Electrical and Electronics Engineering (IOSR-JEEE) e-ISSN: 2278-1676,p-ISSN:
2320-3331, Volume 10, Issue 2 Ver. I (Mar – Apr. 2015), PP 62-67.
[9]. Kadam Shah, PrakashSavaliyaandMiteshPate,“automatic room light controller
with bidirectional visitor counter”, ijictrd – international journal of ictresearch
and development ,VOL-1 ISSUE-4 ,ISSN: 2395-4841.
[10]. David Pettebonea,∗, Peter Newmanb,1, Steven R. Lawson, “Estimating visitor
use at attraction sites and trailheads in Yosemite National Park using automated
visitor counters”, D. Pettebone et al. Landscape and Urban Planning 97 (2010) 229–
238.
[11]. Rahul Mishra1, ShahidRaza2, Zulquarnain3, RachnaArya4, Prashant Kumar,
“development of automatic person detection system to control ac fan & room lights”,
International Journal of Innovative Research in Science, Engineering and
Technology,Vol. 2, Issue 3, March 2013.
[12]. Gordon Cessford, Stuart Cockburn, and Murray Douglas, “Developing New
Visitor Counters and their Applications for Management”, Monitoring and
Management of Visitor Flows in Recreational and Protected Areas Conference
Proceedings ed by A.Arnberger, C. Brandenburg, A. Muhar, 2002 pages 14-20.
[13]. Anjali Sinha, Arpita Singh, Deepa Singh, Parul Singh , Anil Maurya andMahesh
Kumar Singh, Automatic Room Light Controller with VisitorCounter,
International Journal on Emerging Technologies (Special IssueNCETST-2017)
8(1): 172-175(2017).
[14]. Muhammad Umar Farooq, AamnaShakoor, Abu BakarSiddique, ARMbased
Bidirectional Visitor Counter and Automatic Room LightController using PIR
sensors, Advances in Science, Technology andEngineering Systems Journal Vol. 1,
No. 5, 10-15 (2016).
37
ACKNOWLEDGEMENT
We would also like to thank all the teaching staff members of our stream and our
college for their support. Last but not the least we would like to thanks all our student
friends who have helped us in completing and reviewing our Project.
We would also like to thank Prof. A. A. Deode (mentor) for their support and
providing their sponsorship to our Project.
Our sincere thanks to all those who knowingly and unknowingly have contributed
in their own way in completion of this project.
38