How to Build a Digital Visitor Counter Using 8051 Microcontroller
A digital visitor counter is a device that can count the number of people entering or exiting a room, hall, office, mall, or any other place. It can be useful for monitoring the traffic, security, and occupancy of a place. In this article, we will show you how to build a simple digital visitor counter using 8051 microcontroller and some basic components.
What is 8051 Microcontroller
8051 microcontroller is a popular 8-bit microcontroller that was developed by Intel in 1980. It has 4 KB of ROM, 128 bytes of RAM, 32 I/O pins, two 16-bit timers, one serial port, and four interrupt sources. It can be programmed in assembly language or C language using various software tools. 8051 microcontroller is widely used for embedded applications such as robotics, automation, security systems, etc.
What are the Components Required for Digital Visitor Counter
The components required for digital visitor counter using 8051 microcontroller are:
8051 microcontroller (AT89C51 or any compatible variant)
Two infrared (IR) sensor modules
Four 7-segment displays
Four BCD to 7-segment decoder ICs (74LS47 or any compatible variant)
Four NPN transistors (BC547 or any compatible variant)
Four 330 ohm resistors
One 10K ohm resistor
One 10K ohm potentiometer
One 5V power supply
Breadboard and jumper wires
How does the Digital Visitor Counter Work
The digital visitor counter works on the principle of interruption detection by IR sensors. The IR sensor modules consist of an IR transmitter and an IR receiver. The IR transmitter emits infrared light which is invisible to human eyes. The IR receiver detects the reflected infrared light from any object that comes in its path. When there is no interruption, the IR receiver gives a low output. When there is an interruption, the IR receiver gives a high output.
The two IR sensor modules are placed at the entrance and exit gates of the place where we want to count the visitors. The output of the first IR sensor module is connected to pin P1.5 of the microcontroller and is configured as an up mode selector. The output of the second IR sensor module is connected to pin P1.6 of the microcontroller and is configured as a down mode selector.
The microcontroller counts the number of visitors depending on the input from the IR sensors. Whenever the first IR sensor detects an interruption, it increments the count value by one. Whenever the second IR sensor detects an interruption, it decrements the count value by one. The count value ranges from 0 to 9999 and can be reset by pressing the reset button on the microcontroller.
The count value is displayed on four 7-segment displays which are connected to port P2 of the microcontroller through four BCD to 7-segment decoder ICs. The decoder ICs convert the binary coded decimal (BCD) value from the microcontroller to corresponding segments on the display. The four NPN transistors are used to enable each display individually by applying a high signal to their base terminals. The base terminals are connected to pins P1.0 to P1.3 of the microcontroller.
The potentiometer is used to adjust the contrast of the display by varying the voltage across it.
How to Program the Digital Visitor Counter
The digital visitor counter can be programmed in assembly language or C language using various software tools such as Keil uVision, Proteus, etc. The program logic is as follows:
Initialize port P1 as input port and port P2 as output port.
Initialize timer 0 in mode 1 (16-bit timer) with a suitable value for generating a delay 061ffe29dd