Bidirectional Visitor Counter | 8051 Microcontroller | Best Electronics Projects


Welcome to Freaky Diodes, Here we are back with another awesome electronics project. In this project, we describe the design and working of a Bidirectional Visitor Counter using 8051 Microcontroller. The main purpose is to design a system that can keep track of the number of persons entering or leaving the room and display it on a screen.

Also Read: Wireless AC light Dimmer Using Arduino: Hand Gesture based

Whenever anyone comes to the room, count would be increased, whereas someone leaves, the count would decrease. In this project, the IR sensing mechanism is used for sensing the visitors and the counting process is done by an 8051 microcontroller.

About the Circuit of Bidirectional Visitors Counter:

This Bidirectional Visitors Counter works on the principle of IR sensing. In this project, we used two sets of IR sensors which includes a IR LED & a Photo Diode that placed at the two entrance of a room.

Also Read: Social Distancing Cap Using Arduino

The output of each IR sensor is fed to 8051 microcontroller. In normal operation, the output from the IR sensor would be a logic LOW signal if the IR light would not fall on the Photo Diode as it is a Reflective type IR Sensor.

When any person crosses the path, the Photo Diode of IR sensor would start receiving the light from IR LED and starts conducting. and the output from the IR sensor would be HIGH signal.

Circuit Diagram:

bidirectional visitor counter circuit diagram
Circuit Diagram Of Bidirectional Visitor Counter

Components Required For Bidirectional Visitor Counter:

  • AT89C51 (8051 based Microcontroller)
  • 8051 Programmer
  • Push Button
  • 10µF Electrolytic Capacitor
  • 2 10KΩ Resistors (1/4 Watt)
  • 11.0592 MHz Crystal
  • 2 33pF Ceramic Capacitors
  • 16 x 2 LCD Display
  • 10KΩ Potentiometer
  • 2 x IR Sensors (Reflective Type)
  • Connecting Wires
  • Power Supply
  • Keil µVision Software
  • Willar Software
  • Proteus Software

Circuit Design:

In this project we have used Microcontroller AT89C51, a part of 8051 Microcontroller family. The AT89C51 is interfaced to the IR sensor pairs at P2.0 & P2.1 pins of PORT2.

Circuit Design

A limiting resistor of 150Ω is placed in series with the IR LED. The Photo Diode of IR sensor in reverse bias is connected with a 10KΩ series resistor. A potential divider is formed with Photo Diode & Resistor, the output is given to the Op – Amp non – inverting input.

At the inverting input a 10KΩ POT is connected. In order to change the sensitivity of the IR Sensor this POT can be adjust. And, to display the count values a 16 x 2 LCD Display is used. The PORT1 Pins of the Microcontroller are connected to data line of the LCD.

The RS, RW & E control Pins are connected to P3.6, GND & P3.7 pins. the contrast adjust pin of LCD i.e. Pin 3 is connected to a 10KΩ POT.

Working of Bidirectional Visitor Counter Circuit:

Let’s see the working of bidirectional visitor counter.

The 8051 microcontroller first initializes the stack pointer & other variables, then scans the P2.0 & P2.1 input pins, the light from the IR LED would not fall on the Photo Diode of the first sensor when there is no object in front of the IR Sensors.

If there is someone in front of the IR Sensors the P2.0 & P2.1 ports are at a logic LOW level. The light from the LED of IR reflects from the person and falls on the Photo Diode, the ports P2.0 and P2.1 are at a logic HIGH level.

Also Visit: Latest Jobs, Interships & Off-Campus drives

First at port P2.0 and then at P2.1 a logic HIGH level is received, the microcontroller sees the entry of someone or an object in front of the IR LED and the Photo Diode.

If the logic HIGH is sensed by the microcontroller, first on the P2.1 and then on P2.0, as per the program it assumes that the person is leaving the room and, the microcontroller decreases the count.

Program code of Bidirectional Visitor Counter: Click Here

For more electronics projects visit our website regularly, and don’t forget to join our social media groups for latest updates of jobs, internships & projects.


Please enter your comment!
Please enter your name here