IR Sensors Based Bidirectional Visitor Counter Using 8051 Microcontroller
" Innovation is change that unlocks new value."
~ Jamie Notter .
HELLO GUYS!! WELCOME BACK TO MY FORUM . Today we are here to share with you all an exciting project with all the necessary details of it . The name of this project is "IR SENSORS BASED BIDIRECTIONAL VISITOR COUNTER" using 8051 microcontroller , and also will share its code , circuit and the instructions provided etc. This project is one of the best and very useful circuits in our real life. This Bidirectional Visitor Counter Circuit helps to count the number of people entering or leaving the room, and displays the total count on the screen. It is mainly helpful to use in parties, meetings, etc. Practically sometimes it becomes difficult for the counting of people in a meeting or a seminar which is held in an huge auditorium , so in that case this project makes its look very easy to count the number of persons entering and at the same time leaving too. The main intention of this circuit is to build a system wherein the number of persons entering or leaving a room has to be displayed on a screen. The circuit mainly works on IR sensing principle. 2 sets of IR sensors consisting of an IR LED and photo transistor are placed at two ends. Output from each sensor is fed to the microcontroller. In normal operation, IR light from the LED would fall on the photo transistor and the latter would conduct. The output from the sensor would be a logic low signal in this case. To make this awesome project , you have to read this article completely and carefully and follow all the instructions as well . If you have any electronic components then this project can be made very easily , otherwise go to the website mentioned in our blog section or to the basic electronic of 8051 Microcontroller tutorial .
In this project , we will be learning about the IR sensors used for the counting of the persons entering the room as well as leaving with the help of 8051 microcontroller . 2 IR sensors are used to this project that is one for the transmitting and another for the receiving .
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 Diagram of Bidirectional Visitor Counter
- 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
- Proteus
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 .
HOW TO OPERATE BIDIRECTIONAL VISITOR COUNTER :-
Let us now see how this Bidirectional Visitor Counter using 8051 Microcontroller actually works. 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.
PROGRAM SOURCE CODE :-
###
// Program to make a bidirectional visitor counter using IR sensor #include <reg51.h> #define msec 1 unsigned int num=0; sbit dig_ctrl_4=P1^3; //declare the control pins of seven segments sbit dig_ctrl_3=P1^2; sbit dig_ctrl_2=P1^1; sbit dig_ctrl_1=P1^0; unsigned int digi_val[10]={0x40,0xF9,0x24,0x30,0x19,0x12,0x02,0xF8,0x00,0x10}; unsigned int dig_1,dig_2,dig_3,dig_4,test=0; unsigned char dig_disp=0; sbit up=P3^5; //up pin to make counter count up sbit down=P3^6; //down pin to make counter count down void init() // to initialize the output pins and Timer0 { up=down=1; dig_ctrl_4 = 0; dig_ctrl_3 = 0; dig_ctrl_2 = 0; dig_ctrl_1 = 0; TMOD=0x01; TL0=0xf6; TH0=0xFf; IE=0x82; TR0=1; } void delay() //To provide a small time delay { TMOD=0x01; TL0=0x36; TH0=0xF6; TR0=1; while(TF0==0); TR0=0; TF0=0; } void display() interrupt 1 // Function to display the digits on seven segment. For more details refer seven segment multiplexing. { TL0=0x36; TH0=0xf6; P2=0xFF; dig_ctrl_1 = dig_ctrl_3 = dig_ctrl_2 = dig_ctrl_4 = 0; dig_disp++; dig_disp=dig_disp%4; switch(dig_disp) { case 0: P2= digi_val[dig_1]; dig_ctrl_1 = 1; break; case 1: P2= digi_val[dig_2]; dig_ctrl_2 = 1; break; case 2: P2= digi_val[dig_3]; dig_ctrl_3 = 1; break; case 3: P2= digi_val[dig_4]; dig_ctrl_4 = 1; break; } } void main() { init(); while(1) { if(up==0&&down==1) //check if up pin is pressed { test++; num=test; dig_4=num%10; num=num/10; dig_3=num%10; num=num/10; dig_2=num%10; dig_1=num/10; if(test==9999) test=0; } if(up==1&&down==0) //check if down pin is pressed { test--; num=test; dig_4=num%10; num=num/10; dig_3=num%10; num=num/10; dig_2=num%10; dig_1=num/10; if(test==0) test=9999; } } }
###
Advantages
:-
1. No need of human intervention.
2. Can work 24x7 without any problem.
3. Low cost and very easy to implement.
Applications :-
1. The Bidirectional Visitor Counter using 8051
Microcontroller circuit can be used domestically to get an indication of number
of persons entering a party.
2. It can be used at official meetings.
3. It can be used at homes and other places to keep
a check on the number of persons entering a secured place.
4.
It can also be used as
home automation system to ensure energy saving by switching on the loads and
fans only when needed.
Limitation :-
1. It is a low range circuit and cannot be
implemented at large areas.
2. With frequent change in the count value, after a
certain time the output may look confusing.
Comments
Post a Comment