Working Principle
The APDS-9960 from Broadcom (Avago) is a multi-function optical sensor integrating four capabilities in one 3.94 × 2.36 mm I²C package: gesture recognition, proximity detection, ambient light sensing, and RGB colour sensing. It uses an IR LED emitter paired with four directional photodiodes (up/down/left/right) to detect reflected IR and compute gesture direction and proximity distance. A separate clear + RGB photodiode array measures ambient light and colour temperature.
Gesture detection works by tracking differential IR reflectance across the four photodiodes as an object (typically a hand) moves across the sensor’s field of view, producing up, down, left, right data streams that an on-chip gesture engine resolves into directional events.
Electrical Characteristics
| Parameter | Value |
|---|---|
| Supply Voltage | 2.4–3.6 V |
| Interface | I²C (address 0x39, fixed) |
| Gesture Detection Range | 10–30 cm |
| Proximity Range | ~20 cm (8-bit output, 0–255) |
| ALS Dynamic Range | 0.01–16,000 lux |
| Colour Channels | Clear, Red, Green, Blue (16-bit each) |
| LED Drive Current | 12.5–100 mA (IR emitter, programmable) |
| Current Draw | ~1 mA active, ~0.5 µA standby |
Interfacing with an MCU
Connect VCC (3.3 V), GND, SDA, SCL, and the INT pin to an MCU GPIO (interrupt-driven gesture/proximity events). The sensor is I²C at a fixed address 0x39, so only one APDS-9960 per bus is possible without a multiplexer. Use the SparkFun or Adafruit APDS-9960 library for easy function access.
Calibration
- Proximity offset: The sensor has a hardware offset calibration register; run the offset calibration at startup to compensate for enclosure reflections
- Gesture sensitivity: Tune gesture enter/exit thresholds to avoid false triggers from nearby objects
- ALS integration time: Longer integration = more sensitivity in low light, but slower updates
- Colour correction: Apply IR rejection correction using the clear channel and published coefficients for accurate colour temperature
Code Example
/*
* APDS-9960 Gesture + Proximity + Colour — Arduino
* Library: SparkFun_APDS9960 (install via Library Manager)
* Wiring: VCC → 3.3V, GND, SDA, SCL, INT → Pin 2
*/
#include <Wire.h>
#include <SparkFun_APDS9960.h>
SparkFun_APDS9960 apds;
volatile bool gestureFlag = false;
void gestureISR() { gestureFlag = true; }
void setup() {
Serial.begin(9600);
apds.init();
apds.enableGestureSensor(true); /* INT on gesture */
apds.enableProximitySensor(false);
apds.enableLightSensor(false);
attachInterrupt(0, gestureISR, FALLING);
Serial.println("APDS-9960 Ready — wave hand over sensor");
}
void loop() {
if (gestureFlag) {
gestureFlag = false;
if (apds.isGestureAvailable()) {
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;
default: Serial.println("NONE"); break;
}
}
}
/* Also read proximity and colour periodically */
uint8_t prox;
uint16_t r, g, b, c;
apds.readProximity(prox);
apds.readAmbientLight(c);
apds.readRedLight(r);
apds.readGreenLight(g);
apds.readBlueLight(b);
Serial.print("Prox: "); Serial.print(prox);
Serial.print(" R:"); Serial.print(r);
Serial.print(" G:"); Serial.print(g);
Serial.print(" B:"); Serial.println(b);
delay(500);
}
Real-World Applications
Touchless Interfaces, Smart Displays & Colour Sensing
The APDS-9960 is used in smartphones (proximity for screen-off during calls), smart home devices (gesture control for lamps, speakers), touchless dispensers, display brightness auto-adjust (ALS), colour sorting machines, and IoT kiosks. Samsung Galaxy phones use this exact sensor for hover and gesture features.
Limitations
- Fixed I²C address: Only one sensor per bus (0x39); need a TCA9548A mux for multiple.
- Gesture range: Reliable only within 10–30 cm; not suitable for room-scale gesture detection.
- Ambient IR interference: Strong sunlight or IR sources can saturate the photodiodes and degrade gesture accuracy.
- 4 directions only: Basic up/down/left/right; cannot detect complex gestures like circles or pinches.