The following post is for the bi-directional visitor counter and home automation.
Here, We have used a simple arduino with PIR motion sensor and a 5V relay module. the circuit diagram for the following project is given below.
Circuit Diagram:
Required Components:
Arduino UNO - 1
PIR motion sensor -2
5V Relay module - 1
Jumper Wires
Working:
When a person will enter in the room the IN (blue) sensor will be triggered and it will increment the count in the room. So there will be one person in the room and the Output pin will be HIGH and relay module will be triggered and any instrument connected to it will be ON. If the other person will enter the room the counter will again increment and total count of room will be 2.
Now, when the person from the room will leave the room the OUT (green) sensor will be triggered and the count of the room will decrement to one. If the remaining one person will also leave the room the count will decrement to zero and the Output pin will be LOW and the relay will be OFF. So, finally the instrument connected to relay will be OFF.
Arduino Code: Download