Here this project is used to design a project in which we can create a bidirectional visitor counter. The main intention behind this project is that whenever a person or the no. of persons is entering a room or leaving a room then it will be displayed on the screen. When a person enters the room, the count will be automatically increased and when they are leaving, the counting will automatically decreased. The IR sensing mechanism is used here so that we can sense the presence of the visitors and the whole counting process is carried out with the help of the 8051 microcontroller.



The circuit works on the principle of Infra Red (IR) sensing. Now we can take the two sets of IR sensors consisting of an IR LED and the phototransistor are placed at two ends. The output from each sensor is fed to the microcontroller. In normal operation, the 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. In this case of any interruption (due to any person crossing the path), the phototransistor would cease to conduct or conduct less and 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.






  • At89C51
  • X1 – 12MHz crystal
  • D1, D2 – IR LED
  • Q1, Q2 – IR Phototransistor
  • U1 – AT89C51
  • U4 – 2-Digit 7 segment display
  • R1, R3 – 760 Ohms
  • R2, R4 – 3K
  • R5 – 10K
  • C1 – 10uF, electrolyte
  • C2, C3 – 15pF



  1. This circuit here can be used domestically and to get an indication of the number of persons entering a party
  2. It can also be used at official meetings.
  3. It can also be used at homes and at other places to keep a check on the number of persons entering a secured place.
  4. It can also be used as the home automation system to ensure energy saving by switching on the loads and fans only when needed. 



  1. It is a theoretical circuit and that may require some few changes in practical implementation.
  2. It is a very low range circuit and it cannot be implemented at large areas.
  3. With the frequent change in the count value, after a certain time, the output may look confusing.





Leave a Comment