This room visitor counter counts how many people are currently in the room. It will detect someone who enter or exit the room. When there is at least one person in the room, the relay is switched on. And vice versa, if the room is vacant, the relay is switched off. You can connect the relay to room lighting or any electric device.
The project can work flawlessly 100% of the time, as long as, nobody is immediately behind you when walking in/out of the room and you don’t use the door. Because the counter is not a computer vision-based project and therefore is unable to distinguish between a person and a door.
The project is built based on MSP430G2231 microcontroller, 2 Sharp GP2D12 IR distance sensors and a 12 v relay. For simplicity, the project use 3 blue LEDs as binary count of how many people are in the room, with a maximum displayable count of 7 (when the count is incremented past 7, the LEDs simply remain on). For better display, you can expand it using 7-segment LED display or LCD 16×2.