Sparkfun RGB and Gesture Sensor // APDS-9960

What it does


Sparkfun RGB and Gesture Sensor
The Sparkfun RGB and Gesture sensor provides ambient light, RGB color, proximity sensing, and gesture recognition for distances up to 8" (20cm).

The APDS-9960 utilizes 4 directional photodiodes to detect reflected IR energy from the built-in IR LED. The chip's gesture engine converts the photodiode signals to physical motion information(e.g. velocity, direction, distance) and interprets these values as UP, DOWN, LEFT, RIGHT, NEAR, and FAR gestures.

The APDS-9960 is used in the Samsung Galaxy S5 for gesture recognition and proximity detection.

Sparkfun RGB and Gesture sensor
Download Avagotech APDS Data Sheet .PDF

How to use it


Hardware Connections

mbed LPC1768ADPS-9960 Breakout Board
Not ConnectedVL
GNDGND
Vout (3.3V)VCC
p9 (I2C sda)SDA
p10 (I2C scl)SCL
p11(DigOut)INT (interrupt)

Warning!

Make sure VCC is connected to 3.3V!
5V has the potential to burn out the chip!

Gesture Sensor Zoom-In /media/uploads/jodoedjr/diagram.png
Jumpers

  • PS is soldered closed by default. PS shorts VL, the voltage supply to the IR LED, to the VCC pin. To drive the IR LED and sensor separately unsolder the PS jumper and connect VL to a 3.0-4.5V source. VCC should be connected to a 2.4-3.6V source to power the sensor.
  • I2C PU is soldered closed by default. I2C PU is a three-terminal jumper that connects the SDA and SCL outputs to pull-up resistors. When closed, SDA and SCL are pulled high through 4.7k ohm resistors connected to VCC. If the I2C bus has pull-up resistors connected elsewhere consider unsoldering I2C PU.

Software Implementation


Sparkfun provides an Arduino Library and several code sketches on the RGB and Gesture Sensor product page. The given libraries were altered to replace Arduino specific functions with comparable Mbed code and to take advantage of Mbed's I2C hardware capabilities.

Library

Import libraryAPDS_9960

APDS-9960 Light, RGB, Proximity, and Gesture Sensor https://www.sparkfun.com/products/12787 This library interfaces the APDS-9960 to Mbed over I2C. The library relies on the I2C library. To use the library, instantiate a glibr object, call ginit(), and call the appropriate functions.


The code below utilizes .wav files stored on an SD card in conjunction with the APDS-9960 to provide audio feed back for gesture recognition. The gesture name is also printed to the pc serial port. The code is demonstrated in the video below.

Import programGestureSensor_Test

Uses the APDS_9960 Digital Proximity, Ambient Light, RGB and Gesture Sensor library to play detected gesture sounds on a speaker from the SDcard


Please log in to post comments.