In: Electrical Engineering
Any microcontroller project with minimum requirement use switches, led, and 7-segment.
Bidirectional Visitor Counter using 8051 Microcontroller
This project 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.
Bidirectional Visitor Counter Circuit Principle
The circuit works on the principle of IR sensing. Infrared or simply IR Sensors are devices that work with Infrared Light Source and a Photo Detector like a Photo Diode or a Photo Transistor that act as a Transmitter and Receiver respectively.
In this project, we have used an IR LED as the IR Transmitter and a Photo Diode as the IR Receiver. Two sets of IR sensors consisting of an IR LED and Photo Diode are placed at two ends of the entrance of a room.
Output from each sensor is fed to the microcontroller. In normal operation, IR light from the LED would not fall on the Photo Diode as it is a Reflective type IR Sensor. The output from the sensor would be a logic LOW signal in this case.
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 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 designed by selecting appropriate value of resistors for both the LED and the Photo Diode. A 150Ω current limiting resistor is placed in series with the IR LED.
Photo Diode is connected in reverse bias with a series resistor of 10KΩ. Photo Diode and 10KΩ Resistor form a potential divider and the output is given to the non – inverting input of the Operational Amplifier (Op – Amp).
Operation of a Bidirectional Visitor Counter Circuit
When the system is powered ON, the microcontroller initially initializes the stack pointer and all other variables. It then scans the input pins (P2.0 and P2.1).
In the meantime, when there is no object in front of the IR Sensors, the light from the IR LED would not fall on the Photo Diode of the first sensor pair and hence, the Photo Diode doesn’t conduct.
As a result, the output of the IR sensors is LOW. In other words, ports P2.0 and P2.1 are at logic LOW level. If there is a person in front of the IR Sensors, IR light from the IR LED reflects from the person and falls on the Photo Diode.
As a result, the Photo Diode starts conducting and the output of the sensor becomes HIGH. In other words, the ports P2.0 and P2.1 are at logic HIGH level.
Now when a transition takes place, i.e. a logic HIGH level is received, first at port P2.0 and then at P2.1, the microcontroller sees this as an interruption to sense the passage or entry of a person or an object in front of the IR LED and the Photo Diode.
As per the program, the count value is increased and this value is displayed on the 16 x 2 LCD Display.
If the microcontroller senses logic HIGH, first on the P2.1 and then on P2.0, it assumes that the person is leaving the room and as per the program, the microcontroller decreases the count as displays the same on the LCD.
The program ensures that the count is increased or decreased only when both the sensors detect the person.
A 10KΩ POT is connected at the inverting input. This POT can be adjust in order to change the sensitivity of the IR Sensor. A 16 x 2 LCD Display is used to display the count values. The data line of the LCD are connected to PORT1 Pins of the Microcontroller.
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.