Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

How to Use Adafruit APDS-9960: Examples, Pinouts, and Specs

Image of Adafruit APDS-9960Design with Adafruit APDS-9960 in Cirkit Designer

Introduction

The Adafruit APDS-9960 is a multifunctional sensor that offers digital proximity, ambient light, RGB, and gesture sensing capabilities. This sensor is capable of detecting simple hand gestures, measuring the intensity of ambient light, and identifying colors, making it an ideal choice for a wide range of applications such as gesture-based control systems, automatic screen brightness adjustment, and interactive toys.

Common applications include:

Explore Projects Built with Adafruit APDS-9960

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of Arduino Nano Controlled Smart Relay with APDS-9960 Gesture Sensor: A project utilizing Adafruit APDS-9960 in a practical application
Arduino Nano Controlled Smart Relay with APDS-9960 Gesture Sensor

This circuit features an Arduino Nano microcontroller interfaced with an Adafruit APDS-9960 sensor and a 2-channel relay module. The APDS-9960 sensor, which is capable of gesture detection, is connected to the Arduino via I2C communication lines (SCL, SDA) and powered by the Arduino's 3.3V output. The relay module is controlled by the Arduino through a digital pin (D7) and is used to switch an AC-powered bulb on and off, with the relay's common (COM) terminal connected to the AC source and the normally open (NO1) terminal connected to the bulb.

Open Project in Cirkit Designer
Image of ESP8266 NodeMCU Controlled Smart Light with Gesture Sensing and Relay Switching: A project utilizing Adafruit APDS-9960 in a practical application
ESP8266 NodeMCU Controlled Smart Light with Gesture Sensing and Relay Switching

This circuit features an ESP8266 NodeMCU microcontroller interfaced with an Adafruit APDS-9960 sensor and a 1-Channel Relay to control a 9W-10W bulb. The APDS-9960 sensor likely provides input to the NodeMCU to trigger the relay, which in turn switches the bulb on or off. A Mini 360 Buck Converter is used to step down voltage for the NodeMCU and sensor, while a pilot lamp indicates the system status.

Open Project in Cirkit Designer

Technical Specifications

Key Technical Details

Pin Configuration and Descriptions

Pin Number Name Description
1 VDD Power supply (2.4V to 3.6V)
2 GND Ground connection
3 SDA I2C Data Line
4 SCL I2C Clock Line
5 INT Interrupt output (active low)

Usage Instructions

Integration with a Circuit

To use the APDS-9960 sensor in a circuit, connect the VDD pin to a 2.4V to 3.6V power supply, the GND pin to the ground, and the SDA and SCL pins to the I2C data and clock lines, respectively. The INT pin can be connected to a microcontroller's external interrupt input to respond to gesture or proximity events.

Best Practices

Example Code for Arduino UNO

#include <Wire.h>
#include <Adafruit_APDS9960.h>

Adafruit_APDS9960 apds;

void setup() {
  Serial.begin(9600);
  if (!apds.begin()) {
    Serial.println("Failed to initialize APDS-9960! Please check your wiring.");
    while (1);
  }
  Serial.println("APDS-9960 initialization complete");
  
  // Enable gesture sensing
  if (!apds.enableGestureSensor(true)) {
    Serial.println("Gesture sensor is not enabled!");
  }
}

void loop() {
  // Check if a gesture is available
  if (apds.gestureAvailable()) {
    switch (apds.readGesture()) {
      case APDS9960_DIR_UP:
        Serial.println("Detected UP gesture");
        break;
      case APDS9960_DIR_DOWN:
        Serial.println("Detected DOWN gesture");
        break;
      case APDS9960_DIR_LEFT:
        Serial.println("Detected LEFT gesture");
        break;
      case APDS9960_DIR_RIGHT:
        Serial.println("Detected RIGHT gesture");
        break;
      case APDS9960_DIR_NEAR:
        Serial.println("Detected NEAR gesture");
        break;
      case APDS9960_DIR_FAR:
        Serial.println("Detected FAR gesture");
        break;
      default:
        // No gesture detected
        break;
    }
  }
}

Troubleshooting and FAQs

Common Issues

FAQs

Q: Can the APDS-9960 sensor detect gestures in complete darkness? A: Yes, the sensor uses infrared LEDs for gesture detection, which can work in low or no light conditions.

Q: How do I calibrate the sensor for ambient light and color detection? A: Calibration involves reading the sensor values under known lighting conditions and adjusting the readings programmatically to match the known values.

Q: What is the maximum distance for reliable gesture detection? A: The sensor can reliably detect gestures up to approximately 10 cm away, depending on environmental conditions and setup.

Q: Is the APDS-9960 sensor compatible with 5V systems? A: The sensor operates at 2.4V to 3.6V. For 5V systems, level shifters or voltage regulators should be used to ensure compatibility.

For further assistance, consult the Adafruit APDS-9960 datasheet and the Adafruit support forums.