LamaPLC: APDS - Avago ALS and proximity detection sensors with I²C communication

APDS-9960 The Avago APDS-9900, APDS-9930, and APDS-9960 are a series of integrated optical sensor modules that primarily offer ambient light sensing (ALS) and proximity detection, with the APDS-9960 adding advanced gesture recognition and RGB color sensing.

Feature Comparison

FeatureAvago APDS-9900Avago APDS-9930Avago APDS-9960
TypeApproximates Human Eye ResponseApproximates Human Eye ResponseAmbient Light and RGB Color Sensing, Proximity Sensing, and Gesture Detection in an Optical Module
Ambient Light Sensing (ALS)Yes (Clear & IR channels)Yes (Clear & IR channels)Yes (RGBC - Red, Green, Blue, Clear)
Proximity DetectionYesYes (calibrated to 100mm)Yes (calibrated to 100mm)
Gesture DetectionNoNoYes (Up, Down, Left, Right, etc.)
RGB Color SensingNoNoYes
InterfaceI²CI²CI²C
Operating Voltage2.5V – 3.6V2.2V – 3.6V2.4V – 3.6V
Key ApplicationSimple light/proximity in phonesPower-saving display managementHMI, robotics, complex touchless control

Communication: I²C communication, default address: 0x39

If you'd like to support the development of the site with the price of a coffee — or a few — please do so here.

Here's a handy tip: you can quickly save this page as a PDF by clicking “export to PDF” in the menu on the right side of the screen.

2026/02/14 23:38

Arduino wiring

PinNameFunction
VLLED PowerOptional power for the IR LED (if not jumpered to VCC). Usually 3.0V – 4.5V
VCCPower2.4V to 3.6V. (Note: Use 3.3V for Arduino; 5V will damage the chip without a regulator)
GNDGround0V Reference
SCLI²C ClockSerial clock line for I²C communication
SDAI²C DataSerial data line for I²C communication
INTInterruptActive Low. Goes LOW when a gesture or proximity event is triggered. For gesture sensing, it is highly recommended to connect the INT pin to a hardware interrupt pin (e.g., Digital Pin 2 on Arduino) to ensure the sensor's FIFO buffer is read immediately when data is ready.

Arduino code

FOr APDS-9960 running on an Arduino, the SparkFun APDS-9960 Library “SparkFun APDS9960” is the industry standard.

#include <Wire.h>
#include <SparkFun_APDS9960.h>
 
#define APDS9960_INT 2 // Must be an interrupt pin
SparkFun_APDS9960 apds = SparkFun_APDS9960();
volatile bool isr_flag = false;
 
void setup() {
  Serial.begin(9600);
  pinMode(APDS9960_INT, INPUT);
 
  // Initialize interrupt service routine
  attachInterrupt(digitalPinToInterrupt(APDS9960_INT), interruptRoutine, FALLING);
 
  if (apds.init()) {
    Serial.println(F("APDS-9960 initialization complete"));
  } else {
    Serial.println(F("Something went wrong during APDS-9960 init!"));
  }
 
  // Start sensor gesture 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) {
    detachInterrupt(digitalPinToInterrupt(APDS9960_INT));
    handleGesture();
    isr_flag = false;
    attachInterrupt(digitalPinToInterrupt(APDS9960_INT), interruptRoutine, FALLING);
  }
}
 
void interruptRoutine() {
  isr_flag = true;
}
 
void handleGesture() {
  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;
      case DIR_NEAR:  Serial.println("NEAR");  break;
      case DIR_FAR:   Serial.println("FAR");   break;
      default:        Serial.println("NONE");
    }
  }
}

I²C topics on lamaPLC

PageDateTags
2026/04/23 21:51, , , , , , ,
2025/09/23 21:25, , , , , ,
2026/03/22 03:14, , , , , , ,
2026/04/23 21:52, , , , , , , , ,
2026/04/23 21:52, , , , , , , , , , , , ,
2026/03/28 23:50, , , , , , ,
2026/04/12 00:34, , , ,
2026/04/23 21:52, , , , , , , , , , , , , ,
2026/04/23 21:52, , , , , , , , , , ,
2026/04/23 21:52, , , , , , , , , ,
2026/03/22 00:08, , , , , , , , , , ,
2026/04/23 21:52, , , , , , , , , , ,
2026/04/23 21:52, , , , , , , ,
2025/05/31 23:32, , , , , , , ,
2026/04/23 21:52, , , , , , , , , , , , , ,
2025/11/22 00:07, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
2023/07/01 17:29, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
2026/03/22 01:44, , , , , , , , ,
2026/04/23 21:52, , , , , , , , ,
2026/04/23 21:52, , , , , , , , , , , , , , , ,
2026/04/23 21:51, , , ,
2026/04/23 21:52, , , , , , , , , , , , , , , , , , , , , , , , ,
2026/04/11 19:54, , , , , , , , , , , , , , , , , , ,
2026/04/23 21:52, , , , , , , , , , ,
2026/02/14 18:27, , , , , , , , , ,
2026/04/23 21:52, , , , , , ,
2026/04/23 21:52, , , , , , , ,
2026/04/23 21:52, , , , , , , ,
2026/04/23 21:52, , , , , , , , , , , , ,
2026/04/15 19:41, , , , , , , , , , , , , , , ,
2026/04/23 21:52, , , , , , , , , , , , , ,
2026/02/14 23:47, , , ,
2026/02/14 23:51, , , , , ,
2026/02/14 18:26, , , ,
2026/04/23 21:52, , , , , , , , , , , , ,
2026/04/23 21:52, , , , , , , , , , ,
2026/04/23 21:52, , , , , , , ,
2026/03/05 21:19, , , , , , , , , , , , , , , , ,
2026/02/14 18:27, , , , , , ,



This page has been accessed for: Today: 3, Until now: 4