We have heard of events/parties going out of control due to gate crashing by uninvited guests. Now, as a solution, imagine your door counting the number of invitees and raising an alarm when the number exceeds the guest list. It could have sounded like a magic door some years back, but it is a reality today. We can call it a smart door and the thing that is making it smart is a gate-crashing alarm system that we are going to build today in this DIY project.
This technology can also be used to prevent entry of criminals inside our house by simply installing it in our push & pull door.
The door alarm system prototype that we are going build today can detect entry of up to three to four persons, but it can be upgraded as per requirement.
It will count the number of times the door opens and will automatically raise alarm when it detects the extra person. This is enabled by using a gesture sensor that senses the door’s movement from left-right or right-left. If you find gesture sensor a little bit costly, and want a cheaper alternative, do write us in the comment section. We will make another less expensive solution for you.
To start this project, we need the following electronic components which are easily available in the market:-
Bill of Material for Visitor Counter
Coding
Open IDLE and the library manager, after that install the Sparkfun library of APDS9960 in Arduino IDE (Fig 1).
Next initialize the ‘Sparkfun APDS9960’ library and then create variables to store different values. Now, create a setup function where you can create the code for checking the connection in the gesture sensor. Then create a loop function to check the interrupt pin. When any movement happens near the sensor, the loop calls a gesture handle function.
In gesture handle function, we check the gesture from the sensor. When we open our door, this function checks the gesture from left-right or right-left. If it detects the gesture towards the left (i.e. when someone enters through the door), then there will be an increment in ‘count’ variable. We have another ‘if condition’ that checks the count value. When the total number of people entering through the door exceeds four, then it automatically makes loud sound.
You can download the code from link below:
Download Source Code
Download Code With OLEDÂ
Connection
Now connect the components as illustrated below
Arduino | Component |
SDA | APDS9960 SDA |
SCL | APDS9960 SDA |
GND | APDS9960 GND & BUZZER GND |
3.3 V | APDS9960 VCC |
PIN 2 | INT |
PIN 11 | BUZZER VCC |
Testing for Visitor Counter
After you are done connecting all the components, do crosscheck each connection as any wrong connection can fry your costly dev board. After ensuring that all is fine, you can fix the sensor near the door and check the circuit by moving your hand.
For testing, power the Arduino using any 5v power supply, then move your hand near the gesture sensor from left- right or right-left. Each time it detects the left gesture, it will add 1 to the count value. When this number exceeds 4, the sensor will automatically start the alarm buzzer.
Please what do I need to do the coding
Start with Arduino IDE
How can I install Arduino IDE on my computer
Download the Arduino IDE ZIP file from Arduino Website then extract it in computer and run the arduino
The code is not working
what problem are you facing
When I ran the code..It gave output..But the buzzer is not giving any sound..Plz give me brief connection and code details..plzzzx
When I run the code…It gave me output…But the buzzer is not giving any sound..Plz give me brief details about connections and code…Plzz…urgent
What type of buzzer are you using does it make sound when you directly connect to power battery if not then you have to use the buzzer that can make sound form direct connection with battery. you might be using simple buzzer that do naot have any sound circuit in it
When I run the code…It gave me output…But the buzzer is not giving any sound..Plz give me brief details about connections and code…Plzz…urgent
What type of buzzer are you using check the the buzzer IS it make sound when you directly connect to 3v battery.If it is not making sound in direct connection then you have to add a tone melody in code
What is the name of the component that reads the count and how can I get it?
APDS 9960
Source code is not available on the above link its shows error..can u please help me
refresh website and open in desktop mode
From above link, I click on download source code and download code with OLED …but the code not available its shows Oops.. Error 404 ..Can You please send that source code and OLED to my email [email protected] …it’s very urgent Ashwini sinha Garu
If you are unable to download the source code, please try to open the page in incognito mode and retry or temporarily turn off the antivirus before downloading.
Ashwini sinha help me
Sir,I’m done open the page in incognito mode and turn off antivirus before downloading but it always shows oops error 404 only after clicking on link of download source code
Hi, I have emailed the source code, please check.
Sir,I’m done open the page in incognito mode and turn off antivirus before downloading but it always shows oops error 404 only after clicking on link of download source code ….sir can you please send code to my mail [email protected] and I sended a mail to [email protected] also not responded to my problem
Hi, I have emailed the source code, please check.
Sir , I have one doubt without OLED can be done this project or not..i mean use ardunio uno ,apds9960 sensor, alarm buzzer..but source code only for apds9960 ,alarm buzzer,ardunio uno..not available
Sir ,can I use alarm buzzer(what type of buzzer can I use) of any type or not .. please respond kindly
Can u mail me source code to @[email protected] please .
We have shared the code via email