Arduino Gesture Sensor APDS 9960



Gesture and Ambient light sensor APDS-9960 from Avago Technologies helps us to make simple and robust Gesture control project. The sensor utilizes four directional photo diodes to sense reflected IR light to convert physical motion Information to a Digital information (simply gesture info).

The architecture of the gesture engine features automatic activation (based on Proximity engine results), ambient light subtraction, cross-talk cancelation, dual 8-bit data converters, power saving inter-conversion delay, 32-dataset FIFO, and interrupt-driven I2C-bus communication. The gesture engine accommodates a wide range of mobile device gesturing requirements  simple UP-DOWN-RIGHT-LEFT gestures or more complex gestures can be accurately sensed. Power consumption and noise are minimized with adjustable IR LED timing. (credit Avago Technologies).

Application Note

With this APDS 9960 sensor we can make interaction to Arduino, Microcontroller, Computer, robot etc.. with simple gesture swipe of your hand.

Sensor Breakout board Pinout



Arduino-APDS 9960 Hookup


Arduino Code


#include <Wire.h>
#include <SparkFun_APDS9960.h>

// 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() {

  // 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:


APDS 9960 – Arduino Library

APDS 9960 – Datasheet 


  1. CL February 3, 2017 Reply
    • Franco February 18, 2017 Reply
      • Marko September 26, 2017 Reply
      • Sid November 12, 2017 Reply
  2. the lizard king January 25, 2018 Reply
    • Luke March 18, 2018 Reply
      • Jan April 10, 2018 Reply

Add a Comment

Your email address will not be published. Required fields are marked *