Sunday, December 22, 2024

Visitor Counter Using RGB APDS-9960

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.

- Advertisement -

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.

- Advertisement -

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).

Fig 1. Arduino library manager

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.

Fig 2. Arduino code creating variables
Fig 3. Setup function
Fig 4. Arduino code checking interrupt

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.

Fig 5. Checking gesture

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
Fig 6. Connection

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.


This article was first published on 8 July 2019 and was updated on 2nd October 2021.

Ashwini Sinha
Ashwini Sinha
A tech journalist at EFY, with hands-on expertise in electronics DIY. He has an extraordinary passion for AI, IoT, and electronics. Holder of two design records and two times winner of US-China Makers Award.

25 COMMENTS

    • 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

  1. 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

SHARE YOUR THOUGHTS & COMMENTS

EFY Prime

Unique DIY Projects

Truly Innovative Electronics

Electronics News

Latest DIY Videos

Electronics Components

Electronics Jobs

Calculators For Electronics

×