Zbotic Logo Zbotic Logo
  • Home
  • Shop
  • Sale
  • 3D Print Service
  • PCB Service
  • B2B
  • Blogs
  • Contact Us
0 0

View Wishlist Add all to cart

0 0
0 Shopping Cart
Shopping cart (0)
Subtotal: ₹0.00

View cartCheckout

  • Shop
  • About Us
  • Contact Us
  • Reseller
  • Blogs
020 69134444
1800 209 0998
[email protected]
Help Desk
Facebook Twitter Instagram Linkedin YouTube
Zbotic Logo Zbotic Logo
0 0

View Wishlist Add all to cart

0 0
0 Shopping Cart
Shopping cart (0)
Subtotal: ₹0.00

View cartCheckout

All departments
  • 3D Print Service
  • 3D Printer
  • Batteries & Chargers
  • Development Boards
  • Drone Parts
  • EBike parts
  • Sensor Modules
  • Electronic Components
  • Electronic Modules
  • IoT and Wireless
  • Mechanical Parts and Workbench Tools
  • Motors & Drivers & Pumps & Actuators
  • DIY and Robot Kits
  • Show more
  • Home
  • Shop
  • Sale
  • 3D Print Service
  • PCB Service
  • B2B
  • Blogs
  • Contact Us
Return to previous page
Home Sensors & Modules

APDS-9960 Gesture Sensor: Hand Motion Control for Arduino

APDS-9960 Gesture Sensor: Hand Motion Control for Arduino

March 11, 2026 /Posted byJayesh Jain / 0

Imagine controlling a robot, changing a music track, or adjusting a smart light — all without touching a single button. The APDS-9960 from Broadcom (formerly Avago) makes exactly this kind of touchless, gesture-based interaction possible with just one small I2C sensor module and a few lines of Arduino code.

The APDS-9960 packs four capabilities into one 3 × 4 mm chip: gesture detection, proximity sensing, ambient light measurement, and RGB colour sensing. This guide walks you through every feature, from hardware wiring to advanced gesture projects you can build today.

Table of Contents

  1. What Is the APDS-9960?
  2. Key Specifications
  3. How the Sensor Works
  4. Hardware Wiring to Arduino
  5. Library Setup
  6. Gesture Detection Code
  7. Proximity Sensing Code
  8. RGB Colour Sensing Code
  9. Common Problems and Fixes
  10. Project Ideas
  11. Recommended Products from Zbotic
  12. Frequently Asked Questions
  13. Conclusion

1. What Is the APDS-9960?

The APDS-9960 is an integrated optical sensor containing four directional IR photodiodes, a current-controlled IR LED, and on-chip ADCs, gesture engines, proximity engines, and colour/ALS (Ambient Light Sensor) circuitry. All communication happens over a standard I2C bus at up to 400 kHz.

The SparkFun APDS-9960 breakout board (and its many clones) brings this chip to 3.3 V and 5 V maker environments with level-shifting, decoupling, and an interrupt pin — making it the most popular platform to learn on.

The sensor was first popularised in Samsung’s Galaxy S5 smartphone, where it powered the touchless swipe gestures in the camera app. Today it is widely used in:

  • Smart home control panels
  • Contactless HMI (Human Machine Interface) in medical equipment
  • Air-gesture keyboards and presenters
  • Robotics and drone hand-control interfaces
  • Automatic screen brightness adjustment

2. Key Specifications

Parameter Value
Operating voltage 2.4 V – 3.6 V (chip); breakout: 3.3 V or 5 V
I2C address 0x39 (fixed)
Gesture detection range ~5 cm – 15 cm (hand gesture zone)
Proximity detection range ~0 – 20 cm
Gesture directions UP, DOWN, LEFT, RIGHT, NEAR, FAR
Colour channels Clear, Red, Green, Blue (CRGB)
ALS range 0 – 65,535 counts (16-bit)
IR LED drive current 12.5 mA – 100 mA (configurable)
Package size 3.94 × 2.36 × 1.35 mm
Operating temperature -40°C to +85°C

3. How the Sensor Works

Gesture Engine

The chip contains four directional IR photodiodes arranged in a cross pattern — North, South, East, and West. The on-chip IR LED illuminates a nearby object, and each diode measures the intensity of reflected IR light independently. As a hand moves across the sensor, the N/S/E/W photodiode signal ratios change in a characteristic pattern that the gesture engine’s finite state machine interprets as a directional swipe.

For example, a left-to-right swipe produces a signal sequence where the West diode peaks first, followed by a rising East diode signal. The engine matches this pattern and asserts the RIGHT gesture register.

Proximity Engine

All four photodiodes work together during proximity sensing, summing their signals to produce a single 8-bit value (0–255) proportional to how close an object is. Higher values indicate a closer object. The proximity threshold registers let you set hardware interrupt triggers without CPU polling.

Colour / ALS Engine

Each photodiode has a different optical filter: Clear (all wavelengths), Red (~615–700 nm), Green (~515–590 nm), and Blue (~430–500 nm). The 16-bit ADC behind each produces raw counts proportional to incident light intensity in each band. You can compute colour temperature, lux, or RGB ratios from these values.

4. Hardware Wiring to Arduino

The APDS-9960 breakout board operates at 3.3 V. SparkFun’s board has a built-in 3.3 V regulator and level shifters, allowing safe connection to a 5 V Arduino Uno. Chinese clone boards vary — check yours before connecting to 5 V directly.

APDS-9960 Board Pin Arduino Uno Pin
VCC (3.3V or 5V depending on board) 3.3V or 5V
GND GND
SDA A4
SCL A5
INT D2 (interrupt pin — optional but recommended)

Connect a 10 kΩ pull-up resistor from INT to 3.3 V if your board does not include one. The INT pin is active-low — it goes LOW when a gesture, proximity threshold, or ALS threshold event fires.

5. Library Setup

Two popular Arduino libraries exist for the APDS-9960:

  1. SparkFun APDS-9960 RGB and Gesture Sensor — the original, most stable. Install via Arduino Library Manager (search “SparkFun APDS-9960”).
  2. APDS9960_NonBlocking — uses interrupts and avoids delay() calls, better for RTOS and event-driven code.

This guide uses the SparkFun library. After installing, include it with #include <SparkFun_APDS9960.h>.

6. Gesture Detection Code

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

#define INT_PIN 2
SparkFun_APDS9960 apds;
bool isr_flag = false;

void interruptRoutine() { isr_flag = true; }

void setup() {
  Serial.begin(9600);
  pinMode(INT_PIN, INPUT);
  attachInterrupt(digitalPinToInterrupt(INT_PIN),
                  interruptRoutine, FALLING);
  Wire.begin();

  if (!apds.init()) {
    Serial.println("APDS-9960 init error");
    while(1);
  }
  apds.enableGestureSensor(true);
  Serial.println("Gesture sensor ready. Wave your hand!");
}

void loop() {
  if (isr_flag) {
    detachInterrupt(digitalPinToInterrupt(INT_PIN));
    handleGesture();
    isr_flag = false;
    attachInterrupt(digitalPinToInterrupt(INT_PIN),
                    interruptRoutine, FALLING);
  }
}

void handleGesture() {
  if (!apds.isGestureAvailable()) return;
  switch (apds.readGesture()) {
    case DIR_UP:    Serial.println("UP");    break;
    case DIR_DOWN:  Serial.println("DOWN");  break;
    case DIR_LEFT:  Serial.println("LEFT");  break;
    case DIR_RIGHT: Serial.println("RIGHT"); break;
    case DIR_NEAR:  Serial.println("NEAR");  break;
    case DIR_FAR:   Serial.println("FAR");   break;
    default:        Serial.println("NONE");  break;
  }
}

Open the Serial Monitor at 9600 baud and slowly swipe your hand 5–10 cm above the sensor. For best results, use a single smooth motion and avoid hovering (which can confuse the engine).

7. Proximity Sensing Code

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

SparkFun_APDS9960 apds;
uint8_t proximity_data = 0;

void setup() {
  Serial.begin(9600);
  Wire.begin();
  apds.init();
  apds.enableProximitySensor(false); // false = polling mode
}

void loop() {
  if (!apds.readProximity(proximity_data)) {
    Serial.println("Error reading proximity");
  } else {
    Serial.print("Proximity: ");
    Serial.println(proximity_data); // 0=far, 255=very close
  }
  delay(100);
}

The proximity value is inversely proportional to distance: 0 means nothing detected (or very far), 255 means extremely close. Use this in conditional logic: if (proximity_data > 200) { /* object very close */ }

8. RGB Colour Sensing Code

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

SparkFun_APDS9960 apds;
uint16_t r, g, b, a;

void setup() {
  Serial.begin(9600);
  Wire.begin();
  apds.init();
  apds.enableLightSensor(false);
}

void loop() {
  delay(150);
  if (apds.readRedLight(r) && apds.readGreenLight(g) &&
      apds.readBlueLight(b) && apds.readAmbientLight(a)) {
    Serial.print("R:"); Serial.print(r);
    Serial.print(" G:"); Serial.print(g);
    Serial.print(" B:"); Serial.print(b);
    Serial.print(" Clear:"); Serial.println(a);
  }
}

Hold a coloured object directly above the sensor (within 3–5 cm) for best readings. Normalise values by dividing each channel by the Clear (ambient) value to get approximate chromaticity coordinates independent of lighting intensity.

9. Common Problems and Fixes

Sensor Not Detected (init() returns false)

  • Check SDA/SCL are not swapped
  • Confirm voltage match — 3.3 V chip without level shifting on 5 V Arduino will need a voltage-level-shifter or a breakout with built-in level shifting
  • Run an I2C scanner sketch and verify the device appears at 0x39
  • Ensure the INT pin pull-up is present if you are using interrupt mode

Gestures Detected Randomly or Wrong Direction

  • Move hand slower — the gesture engine needs approximately 200–400 ms for the full motion
  • Maintain 5–15 cm distance from the sensor surface
  • Avoid placing the sensor near bright IR sources (TV remotes, direct sunlight)
  • Ensure the sensor face is not obstructed by plastic covers (IR-opaque plastics will block the signal)

No Gesture in Bright Ambient Light

Strong ambient IR light (sunlight, halogen lamps) can saturate the photodiodes. Reduce the GGAIN (gesture gain) and GLDRIVE (gesture LED drive) registers, or shelter the sensor from direct IR sources.

Proximity Always Reads 0

Ensure you call apds.enableProximitySensor() before reading. The chip’s internal state machine must be in proximity mode — you cannot simultaneously run gesture and proximity modes (they share the IR LED timing engine).

10. Project Ideas

Gesture-Controlled MP3 Player

Connect an APDS-9960 to an Arduino Uno and a DFPlayer Mini MP3 module. Swipe RIGHT to skip track, LEFT to go back, UP to increase volume, DOWN to decrease. Build it into a compact enclosure for desk or car use.

Touchless Hand Sanitiser with Proximity Trigger

Use the proximity engine to detect a hand placed beneath a nozzle. Trigger a 5 V relay driving a solenoid valve. Add a 3-second lockout timer to prevent continuous flow.

Smart Desk Lamp with Gesture Brightness Control

Swipe UP/DOWN to raise or lower PWM duty cycle on an LED driver. Swipe NEAR/FAR to toggle on/off. Add the colour sensor to automatically adjust colour temperature based on ambient light colour.

Colour-Sorting Robot

Mount the APDS-9960 above a conveyor belt. Read RGB values of each object passing under the sensor and steer a servo arm to route objects into labelled bins based on detected colour thresholds.

Automatic Screen Dimmer

Connect to a laptop or Raspberry Pi via serial. Read ambient lux from the Clear channel and send brightness adjustment commands to the OS display API — simulating a hardware ambient light sensor for devices that lack one.

11. Recommended Products from Zbotic

PIR Motion Sensor Switch

AC 220V Security PIR Human Body Motion Sensor Detector

When the APDS-9960 isn’t enough range, step up to this PIR sensor for whole-room presence detection in smart lighting and security systems.

View on Zbotic

B2X2 PIR Sensor

B2X2 4-Element Infrared Motion Analog PIR Sensor for Lighting

Multi-element PIR sensor ideal for high-sensitivity occupancy detection in smart home lighting projects complementing gesture-controlled interfaces.

View on Zbotic

BMP280 Sensor Module

BMP280 Barometric Pressure and Altitude Sensor I2C/SPI Module

Expand your I2C sensor network. The BMP280 pairs perfectly with the APDS-9960 on the same I2C bus for multi-sensor environment monitoring projects.

View on Zbotic

12. Frequently Asked Questions

Can the APDS-9960 detect finger gestures or only full hand swipes?

The gesture engine is optimised for hand-sized objects moved at 5–15 cm from the sensor. Finger-level gestures at close range (1–3 cm) may work but are less reliable. For precise finger gesture detection, capacitive touchscreens or the MGC3130 3D gesture controller are better suited.

Can I run gesture detection and proximity sensing at the same time?

No. The chip’s internal IR LED engine handles only one detection mode at a time. In the SparkFun library, calling enableGestureSensor() disables proximity and light sensing. You must explicitly switch modes between detections, adding a small settling delay (50–100 ms) between mode switches.

What is the maximum I2C bus length for APDS-9960?

Standard I2C at 100 kHz is reliable up to ~1 metre of wire. At 400 kHz (fast mode), keep wires under 30 cm and add appropriate pull-up resistors (2.2 kΩ for 400 kHz). For longer runs, use an I2C bus extender IC like the PCA9600.

Does the APDS-9960 work with 3.3 V microcontrollers like ESP32?

Yes, the chip is native 3.3 V and works perfectly with ESP32, STM32, and Raspberry Pi Pico. Use the standard Wire library and configure your SDA/SCL pins appropriately. No level shifter is needed for these 3.3 V systems.

How do I calibrate the colour sensor for accurate colour detection?

Perform a white balance calibration: place a white reference tile above the sensor in your standard lighting conditions and record R, G, B, C values. Use these as scaling factors when computing normalised RGB from subsequent readings. Also account for integration time — longer integration improves SNR but can saturate in bright light.

13. Conclusion

The APDS-9960 is one of the most versatile sensor ICs available for the Arduino ecosystem. Its combination of gesture recognition, proximity detection, ambient light measurement, and RGB colour sensing — all on a single I2C chip — makes it a powerful tool for creating intuitive, touchless interfaces.

Whether you are a student building your first gesture-controlled project or an engineer prototyping a next-generation HMI for an industrial product, the APDS-9960 delivers reliable performance at a very accessible price point. Start with the SparkFun library examples, understand how each engine mode works, and you will have a touchless controller up and running within an afternoon.

Build Your Touchless Interface Today

Find gesture sensors, proximity modules, and all the components you need — stocked and shipped fast across India.

Shop Sensors & Modules

Tags: APDS-9960, Arduino gesture control, colour sensor Arduino, gesture sensor, Proximity Sensor
Share Post
  • Facebook
  • Linkedin
  • Whatsapp
A4988 Stepper Motor Driver: Wi...
blog a4988 stepper motor driver wiring microstepping arduino code 596540
blog piezoelectric sensor vibration impact and energy harvesting 596550
Piezoelectric Sensor: Vibratio...

Related posts

Svg%3E
Read more

Encoder Module: Position and Speed Measurement with Arduino

April 1, 2026 0
A rotary encoder converts the angular position and rotation speed of a shaft into electrical signals that Arduino can count... Continue reading
Svg%3E
Read more

Infrared Obstacle Sensor: Line Follower and Object Detection

April 1, 2026 0
Infrared obstacle sensors are the building blocks of line-following robots, edge detection systems, and proximity triggers. These tiny modules emit... Continue reading
Svg%3E
Read more

Rain Sensor and Raindrop Detection Module: Arduino Guide

April 1, 2026 0
A rain sensor module detects the presence of water droplets on its surface, giving Arduino a simple signal to trigger... Continue reading
Svg%3E
Read more

LiDAR Sensor TFmini: Distance Measurement Beyond Ultrasonic

April 1, 2026 0
When ultrasonic sensors hit their limits — range too short, accuracy too coarse, outdoor sunlight causing interference — LiDAR sensors... Continue reading
Svg%3E
Read more

Pressure Sensor BMP280: Weather Station and Altitude Meter

April 1, 2026 0
The BMP280 barometric pressure sensor by Bosch measures atmospheric pressure with ±1 hPa accuracy and temperature with ±1°C precision. These... Continue reading

Add comment Cancel reply

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

Facebook Twitter Instagram Pinterest Linkedin Youtube

Get the latest deals and more.

Download on Google Play Download on the App Store

Call us: 020 69134444 / 1800 209 0998

Monday - Saturday 09:30 AM - 06:00 PM
For Technical Supports Email: [email protected]
For Sales / Enquiries Email: [email protected]

  • My Account

    • Cart

    • Wishlist

    • Checkout

    • My Orders

    • Track Order

    • My Account

  • Information

    • FAQs

    • Blogs

    • Career

    • About Us

    • Contact Us

    • Payment Options

  • Policies

    • Privacy Policy

    • Terms & Conditions

    • GST Input Tax Credit

    • Shipping Return Policy

    • E-Waste Collection Points

    • Our Sitemap

© Zbotic.in is registered trademark of Moxie Supply Pvt Ltd – All Rights Reserved
Login
Use Phone Number
Use Email Address
Not a member yet? Register Now
Reset Password
Use Phone Number
Use Email Address
Register
Already a member? Login Now