How to Interface APDS9960 Gesture Sensor with Arduino


Discover the magic of gesture control as we explore the How to Interface APDS9960 Gesture Sensor with Arduino. This guide unveils the potential of gesture-based interactions in your Arduino projects, offering a hands-free approach to command and control. With just a few components, including the Arduino UNO and the APDS9960 sensor, you’ll embark on a journey to harness the power of gestures for an array of applications.

Hardware Required

You will require the following Hardware Components for Interfacing APDS9960 Gesture Sensor with Arduino.

Components#Buy From Amazon
Arduino UNO1Buy Link
APDS9960 Gesture Sensor1Buy Link
9v DC Adapter (Optional)1Buy Link
Jumper Wires5Buy Link
Breadboard1Buy Link

What is the APDS9960 Gesture Sensor?

At its core, the APDS9960 is a compact and intelligent sensor that recognizes gestures, translating human motions into actionable commands for your Arduino. It’s like teaching your projects to understand a secret language of movements. This sensor operates on the I2C protocol, enabling seamless communication with the Arduino UNO. So, what makes it tick?


  1. Gesture Sensing: The APDS9960 boasts advanced gesture sensing capabilities, capable of recognizing up, down, left, right, and even circular motions.
  2. Proximity Detection: It doesn’t just stop at gestures; this sensor is equipped with proximity detection, perfect for applications where you want your project to respond as soon as someone approaches.
  3. Ambient Light Sensing: Smart adaptive gain control allows the sensor to adjust its sensitivity to ambient light, ensuring accurate readings in various lighting conditions.
  4. Color Sensing: Yes, it can sense color too! The APDS9960 can identify a broad spectrum of colors, adding another layer of versatility to your projects.
  5. Low Power Consumption: Despite its capabilities, this sensor is energy-efficient, making it ideal for battery-powered projects that require extended use.


  1. Plug-and-Play Integration: No complex setup here – with an Arduino UNO, the APDS9960 easily integrates into your projects.
  2. Compact Design: Its small size makes it suitable for projects where space is a premium, without compromising on functionality.
  3. Customizable Sensitivity: Tailor the sensor’s sensitivity to match the requirements of your specific application.
  4. Real-Time Data Output: Receive instantaneous data about gestures, proximity, and ambient light for quick decision-making in your projects.
  5. Versatile Applications: Beyond gestures, this sensor opens the door to a wide range of applications, from interactive displays to smart home devices.



Pin Configuration of APDS-9960 Sensor

Pin NoPin NameDescription
1VLOptional power to IR LED if PS jumper is not connected. Can be 3.0V to 4.5V
2GNDConnected to the ground of the circuit used.
3VCCPower supply to the board. Can be 2.4V to 3.6V.
4SDAI2C Serial Data Address pin. Used to transfer the data through I2C.
5SCLI2C Serial Clock Line pin. Provides clock pulse for I2C communication.
6INTExternal Interrupt pin. It is Active LOW during an interrupt event.

Circuit Diagram

The following circuit shows you the connection of How to Interface APDS9960 Gesture Sensor with Arduino Please make the connection carefully


Circuit Connections

D5SCLI2C Clock

Installing Arduino IDE Software

First, you will require to Download the updated version of Arduino IDE Software and Install it on your PC or laptop. if you Learn How to install the Arduino step-by-step guide then click on how to install Arduino Button given Blow

Installing Libraries

Now when you are Ready to upload the code, to the Arduino Board you will need first to add the Following Libraries in Arduino, If you Learn How to add the library in the Arduino step-by-step guide click on how to install the library Button given Blow


//For more Projects:

#include <Wire.h>
#include <SparkFun_APDS9960.h>
Servo myservo;  // create servo object to control a servo

// Pins
#define APDS9960_INT    2 // Needs to be an interrupt pin

// Constants

// Global Variables
SparkFun_APDS9960 apds = SparkFun_APDS9960();
int isr_flag = 0;

void setup() {

  // Set interrupt pin as input
  pinMode(APDS9960_INT, INPUT);

  // Initialize Serial port
  Serial.println(F("SparkFun APDS-9960 - GestureTest"));
  // Initialize interrupt service routine
  attachInterrupt(0, interruptRoutine, FALLING);

  // Initialize APDS-9960 (configure I2C and initial values)
  if ( apds.init() ) {
    Serial.println(F("APDS-9960 initialization complete"));
  } else {
    Serial.println(F("Something went wrong during APDS-9960 init!"));
  // Start running the APDS-9960 gesture sensor engine
  if ( apds.enableGestureSensor(true) ) {
    Serial.println(F("Gesture sensor is now running"));
  } else {
    Serial.println(F("Something went wrong during gesture sensor init!"));

void loop() {
  if( isr_flag == 1 ) {
    isr_flag = 0;
    attachInterrupt(0, interruptRoutine, FALLING);

void interruptRoutine() {
  isr_flag = 1;

void handleGesture() {
    if ( apds.isGestureAvailable() ) {
    switch ( apds.readGesture() ) {
      case DIR_UP:
      case DIR_DOWN:
      case DIR_LEFT:
      case DIR_RIGHT:
      case DIR_NEAR:
      case DIR_FAR:


  1. Smart Lighting Systems: Imagine controlling the ambiance of a room with a wave of your hand.
  2. Interactive Displays: Transform static displays into interactive experiences at museums or exhibitions.
  3. Proximity-Activated Devices: Craft projects that respond when someone approaches, perfect for security systems.
  4. Color Recognition Systems: Develop systems that can identify and respond based on colors, a valuable feature in sorting applications.
  5. Gesture-Controlled Robotics: Take your robotics projects to the next level by enabling gestures as a mode of control.


In the world of Arduino projects, the APDS9960 Gesture Sensor emerges as a game-changer. Its ability to decipher gestures, sense proximity, recognize colors, and operate with low power consumption positions it as a versatile tool for hobbyists and engineers alike. Whether you’re crafting an interactive art installation or a gesture-controlled smart home system, this sensor is your silent partner in bringing ideas to life.

Leave a Comment