This article describes the design and working of a Bidirectional Visitor Counter using 8051 Microcontroller. The main intention is to design a system wherein the number of persons entering or leaving a room is kept track of and displayed on a screen.
When a person enters the room, count would be increased, whereas on leaving, the count would decrease. IR sensing mechanism is used to sense the presence of visitors and the whole counting operation is done by a microcontroller.
But, before going to know about this circuit, get an idea about How to interface a 16 x 2 LCD Display to 8051 Microcontroller as we are going to use this concept in this project.
- Construction and Output Video
- Bidirectional Visitor Counter Circuit Principle
- Circuit Diagram of Bidirectional Visitor Counter
- Circuit Components
- Circuit Design of Bidirectional Visitor Counter using 8051 Microcontroller
- How to Operate Bidirectional Visitor Counter Circuit?
- DOWNLOAD CODE
- Applications of Bidirectional Visitor Counter Circuit
- Limitations of this Circuit
Construction and Output Video
Bidirectional Visitor Counter Circuit Principle
The circuit operates on the basis of infrared sensing. Infrared or simply IR Sensors are devices that function as a Transmitter and Receiver, respectively, using an Infrared Light Source and a Photo Detector such as a Photo Diode or a Photo Transistor.
We utilised an IR LED as the IR Transmitter and a Photo Diode as the IR Receiver in this project. At the two ends of a room’s entrance, two sets of IR sensors consisting of an IR LED and a Photo Diode are positioned.
The microcontroller receives the output from each sensor. Because the Photo Diode is a Reflective type IR Sensor, IR light from the LED would not fall on it in normal operation. In this situation, the sensor’s output would be a logic LOW signal.
In case of any interruption (due to any person crossing the path), the Photo Diode would start receiving the IR Light and start conducting. As a result, the output from the sensor would be a logic HIGH signal.
The transition from low to high, for each sensor pair is detected by the microcontroller and accordingly the count would be increased or decreased.
Circuit Diagram of Bidirectional Visitor Counter
Here is the list of components and their corresponding values used in this circuit. photo transistor
- AT89C51 (8051 based Microcontroller)
- 8051 Programmer
- Push Button
- 10µF Electrolytic Capacitor
- 2 x 10KΩ Resistors (1/4 Watt)
- 11.0592 MHz Crystal
- 2 x 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
Circuit Design of Bidirectional Visitor Counter using 8051 Microcontroller
The heart of the circuit design lies in designing the Microcontroller interface. Here, we used the Microcontroller AT89C51, which is an 8051 family microcontroller.
The microcontroller AT89C51 is interfaced to the IR sensor pairs at PORT2 pins – P2.0 and P2.1 respectively. The following image shows the circuit diagram of the Reflective Type IR Sensor Module used in this project.
The sensor circuit is created by choosing the right resistor values for the LED and Photo Diode. In series with the IR LED is a 150 ohm current limiting resistor.
A 10K series resistor is used to connect the photo diode in reverse bias. A potential divider is formed by a photo diode and a 10K resistor, and the output is fed into the non-inverting input of the Operational Amplifier (Op – Amp).
At the inverting input, a 10K POT is connected. The IR Sensor’s sensitivity can be changed by adjusting this POT. The count data are shown on a 16 x 2 LCD panel. The LCD’s data line is connected to the Microcontroller’s PORT1 pins.
The Control Pins i.e. RS, RW and E are tied to P3.6, GND and P3.7 pins. A 10KΩ POT is connected to contrast adjust pin i.e. Pin 3 of LCD.
Another important aspect of the design involves designing the oscillator circuit and the reset circuit. The oscillator circuit is designed by selecting an 11.0592 MHz quartz crystal and two ceramic capacitors – each 33pF.
The reset circuit is designed by selecting a resistor of 10KΩ and an electrolyte capacitor of 10µF to ensure a reset pulse width of 100ms and reset pin voltage drop of 1.2V.
How to Operate Bidirectional Visitor Counter Circuit?
Let’s take a look at how this Bidiractional Visitor Counter with an 8051 Microcontroller works.
The stack pointer and all other variables are initially initialised by the microcontroller when the system is turned on. The input pins are then scanned (P2.0 and P2.1).
Meanwhile, when no object is in front of the IR Sensors, the light from the IR LED does not fall on the Photo Diode of the first sensor pair, and the Photo Diode does not conduct.
As a result, the IR sensors’ output is LOW. To put it another way, ports P2.0 and P2.1 are set to logic LOW. When a human stands in front of the IR Sensors, the IR light from the IR LED bounces off of them and lands on the Photo Diode.
As a result, the Photo Diode begins to conduct, and the sensor’s output becomes HIGH. To put it another way, the ports P2.0 and P2.1 are set to logic HIGH.
When a transition occurs, i.e., a logic HIGH signal is received first at port P2.0, then at port P2.1, the microcontroller interprets this as an interruption in sensing the passage or entry of a person or an object in front of the IR LED and Photo Diode.
The count value is increased according to the software, and this value is displayed on the 16 x 2 LCD Display.
If the microcontroller detects logic HIGH on P2.1 and subsequently P2.0, it assumes that the person is leaving the room and decreases the microcontroller according to the programme.
The program ensures that the count is increased or decreased only when both the sensors detect the person.
Applications of Bidirectional Visitor Counter Circuit
- The Bidirectional Visitor Counter using 8051 Microcontroller circuit can be used domestically to get an indication of number of persons entering a party
- It can be used at official meetings.
- It can be used at homes and other places to keep a check on the number of persons entering a secured place.
- It can also be used as home automation system to ensure energy saving by switching on the loads and fans only when needed.
Limitations of this Circuit
- It is a low range circuit and cannot be implemented at large areas.
- With frequent change in the count value, after a certain time the output may look confusing.