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 22: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
2025/05/31 21:56, , , , , , ,
2025/09/23 19:25, , , , , ,
2026/03/21 19:20, , , , , , ,
2026/02/15 20:33, , , , , , , , ,
2026/02/14 22:24, , , , , , , , , , , , ,
2026/03/28 22:07, , , , , , ,
2026/02/15 20:40, , , , , , , , , , , , , ,
2026/02/14 23:37, , , , , , , , , , ,
2026/02/14 22:40, , , , , , , , , ,
2026/03/21 22:25, , , , , , , , , , ,
2026/02/14 18:19, , , , , , , , , , ,
2026/02/14 18:11, , , , , , , ,
2025/05/31 21:32, , , , , , , ,
2026/02/14 19:29, , , , , , , , , , , , , ,
2025/11/21 23:07, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
2023/07/01 15:29, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
2026/03/22 00:26, , , , , , , , ,
2026/02/14 22:45, , , , , , , , ,
2026/02/14 22:09, , , , , , , , , , , , , , , ,
2026/02/14 17:26, , , ,
2026/02/14 21:54, , , , , , , , , , , , , , , , , , , , , , , , ,
2026/03/28 18:02, , , , , , , , , , , , , , , ,
2026/02/14 23:58, , , , , , , , , , ,
2026/02/14 17:27, , , , , , , , , ,
2026/02/14 23:38, , , , , , ,
2026/02/14 22:52, , , , , , , ,
2026/02/14 22:23, , , , , , , ,
2026/02/14 22:53, , , , , , , , , , , , ,
2026/02/15 20:27, , , , , , , , , , , , , , , ,
2026/02/15 20:29, , , , , , , , , , , , , ,
2026/02/14 22:47, , , ,
2026/02/14 22:51, , , , , ,
2026/02/14 17:26, , , ,
2026/02/14 22:22, , , , , , , , , , , , ,
2026/02/14 22:21, , , , , , , , , , ,
2026/02/14 22:22, , , , , , , ,
2026/03/05 20:19, , , , , , , , , , , , , , , , ,
2026/02/14 17:27, , , , , , ,



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