APDS-9960 RGB and Gesture Sensor Hookup Guide

Similar documents
ZX Distance and Gesture Sensor Hookup Guide

INA169 Breakout Board Hookup Guide

9DoF Sensor Stick Hookup Guide

nrf24l01+ Transceiver Hookup Guide

AS726X NIR/VIS Spectral Sensor Hookup Guide

Touch Potentiometer Hookup Guide

FABO ACADEMY X ELECTRONIC DESIGN

Lesson 3: Arduino. Goals

Adafruit 16-Channel Servo Driver with Arduino

Adafruit 16-Channel Servo Driver with Arduino

Grove - I2C Color Sensor User Manual

ArduCAM USB Camera Shield

Pi Servo Hat Hookup Guide

The Robot Builder's Shield for Arduino

Arduino Lesson 1. Blink. Created by Simon Monk

Adafruit 16-Channel Servo Driver with Arduino

Getting Started with the micro:bit

LaserPING Rangefinder Module (#28041)

Milli Developer Kit Reference Application Published on Silver Spring Networks STAGE (

Objectives: Learn what an Arduino is and what it can do Learn what an LED is and how to use it Be able to wire and program an LED to blink

Adafruit 16-channel PWM/Servo Shield

EARTH PEOPLE TECHNOLOGY. EPT-200TMP-TS-U2 Temperature Sensor Docking Board User Manual

Arduino Microcontroller Processing for Everyone!: Third Edition / Steven F. Barrett

IMU: Get started with Arduino and the MPU 6050 Sensor!

Lab 2: Blinkie Lab. Objectives. Materials. Theory

Coding with Arduino to operate the prosthetic arm

1Getting Started SIK BINDER //3

TWEAK THE ARDUINO LOGO

For this exercise, you will need a partner, an Arduino kit (in the plastic tub), and a laptop with the Arduino programming environment.

Application Note. Communication between arduino and IMU Software capturing the data

Ardweeny 1.60" 0.54" Simple construction - only 7 parts plus pins & PCB! Ideal for breadboard applications

Arduino STEAM Academy Arduino STEM Academy Art without Engineering is dreaming. Engineering without Art is calculating. - Steven K.

Adafruit SGP30 TVOC/eCO2 Gas Sensor

Demon Pumpkin APPROXIMATE TIME (EXCLUDING PREPARATION WORK): 1 HOUR PREREQUISITES: PART LIST:

Heating Pad Hand Warmer Blanket

smraza Getting Start Guide Contents Arduino IDE (Integrated Development Environment)... 1 Introduction... 1 Install the Arduino Software (IDE)...

EGG 101L INTRODUCTION TO ENGINEERING EXPERIENCE

HAW-Arduino. Sensors and Arduino F. Schubert HAW - Arduino 1

LEARN ARDUINO SENSORS ALL SENSORS DESCRIPTION APPLICATION SPECIFICATIONS EXAMPLE CODES NOTES DOWNLOADS DHT11, DHT22 AND AM2302 SENSORS ADAFRUIT

Adafruit 16-channel PWM/Servo Shield

LumiNet: Prototyping Organic Physical Networks (and hacking Arduino in the process)

Application Note AN 102: Arduino I2C Interface to K 30 Sensor

The µbotino Microcontroller Board

HC-SR501 Passive Infrared (PIR) Motion Sensor

Breadboard Arduino Compatible Assembly Guide

USER MANUAL SERIAL IR SENSOR ARRAY5

Lab 5: Arduino Uno Microcontroller Innovation Fellows Program Bootcamp Prof. Steven S. Saliterman

Sten-Bot Robot Kit Stensat Group LLC, Copyright 2013

Capacitive Touch with Conductive Fabric & Flora

EE-110 Introduction to Engineering & Laboratory Experience Saeid Rahimi, Ph.D. Labs Introduction to Arduino

Internet of Things Student STEM Project Jackson High School. Lesson 2: Arduino and LED

Attribution Thank you to Arduino and SparkFun for open source access to reference materials.

Sound Detector Hookup Guide

// Parts of a Multimeter

Lab 06: Ohm s Law and Servo Motor Control

DFRduino Romeo All in one Controller V1.1(SKU:DFR0004)

Si4707 Hookup Guide. Introduction

PIR Motion Detector Experiment. In today s crime infested society, security systems have become a much more

U2C-1SP4T-63H. Typical Applications

Simon Tilts Assembly Guide

Photon Weather Shield Hookup Guide

OTTO THE BIPEDAL ROBOT

You'll create a lamp that turns a light on and off when you touch a piece of conductive material

ArduCAM USB Camera Shield

RGB Driver click. PID: MIKROE 3078 Weight: 28 g

EGG 101L INTRODUCTION TO ENGINEERING EXPERIENCE

Arduino Sensor Beginners Guide

Setup Download the Arduino library (link) for Processing and the Lab 12 sketches (link).

Training Schedule. Robotic System Design using Arduino Platform

Adafruit 16-Channel PWM/Servo HAT & Bonnet for Raspberry Pi

Portland State University MICROCONTROLLERS

Gravity: 12-Bit I2C DAC Module SKU: DFR0552

Peek-a-BOO Kit JAMECO PART NO / / Experience Level: Beginner Time Required: 1+ hour

MICROCONTROLLERS BASIC INPUTS and OUTPUTS (I/O)

Congratulations on your purchase of the SparkFun Arduino ProtoShield Kit!

Microcontrollers and Interfacing

Grove - Infrared Receiver

DEVKIT-S12ZVC QUICK START GUIDE (QSG)

Application Note AN 157: Arduino UART Interface to TelAire T6613 CO2 Sensor

Montgomery Village Arduino Meetup Dec 10, 2016

Sunday, November 4, The LadyUno Sound Unit

Arduino Workshop 01. AD32600 Physical Computing Prof. Fabian Winkler Fall 2014

Programming 2 Servos. Learn to connect and write code to control two servos.

100UF CAPACITOR POTENTIOMETER SERVO MOTOR MOTOR ARM. MALE HEADER PIN (3 pins) INGREDIENTS

VCNL4000 Demo Kit. IR Anode. IR Cathode. IR Cathode SDA SCL

MAKEVMA502 BASIC DIY KIT WITH ATMEGA2560 FOR ARDUINO USER MANUAL

MicroWave Sensor SKU: SEN0192

Adafruit Si4713 FM Radio Transmitter with RDS/RDBS Support

Marine Debris Cleaner Phase 1 Navigation

ASCOM EF Lens Controller

Controlling motors with Arduino and Processing

CPSC 226 Lab Four Spring 2018

Adafruit 8-Channel PWM or Servo FeatherWing

Adafruit 16-Channel PWM/Servo HAT for Raspberry Pi

Citrus Circuits Fall Workshop Series. Roborio and Sensors. Paul Ngo and Ellie Hass

RFM69HCW Hookup Guide

LESSONS Lesson 1. Microcontrollers and SBCs. The Big Idea: Lesson 1: Microcontrollers and SBCs. Background: What, precisely, is computer science?

EVDP610 IXDP610 Digital PWM Controller IC Evaluation Board

Schematics for Breakout Examples

TB6612FNG Dual Motor Driver Carrier

Transcription:

Page 1 of 12 APDS-9960 RGB and Gesture Sensor Hookup Guide Introduction Touchless gestures are the new frontier in the world of human-machine interfaces. By swiping your hand over a sensor, you can control a computer, microcontroller, robot, etc. One manufacturer has even created a touchless toilet that flushes when you move your hand over the tank. The Avago APDS-9960 offers ambient light and color (as clear, red, green, and blue) measuring, proximity detection, and gesture sensing. The APDS-9960 RGB and Gesture Sensor board breaks out the pins on the Avago APDS-9960 so you can easily use it in a variety of projects. The APDS-9960 uses the I2C interface for communications. Covered In This Tutorial In this tutorial, we will give an overview of the APDS-9960 sensor board and provide an example hookup and code. The tutorial is split into the following sections: Board Overview To begin, we ll go over each of the pins on the breakout board and their function. This section also overviews the jumpers on the front of the board. Hardware Hookup In this section, we ll show you how to hook the APDS-9960 up to an Arduino to detect gestures via I2C. Arduino Library Installation Here, we download and install the APDS-9960 Arduino library.

Page 2 of 12 Gesture Sensing Example We try out the sensor with the the GestureTest example. Resources and Going Further You made a simple gesture sensor, but where do you go from there? This section gives you some additional resources for getting more use out of the APDS-9960. Materials Used You will need a few components and tools to follow along with this tutorial. Here is what you will need: APDS-9960 Hookup Guide SparkFun Wish List SparkFun RGB and Gesture Sensor - APDS-9960 SEN-12787 This is the SparkFun RGB and Gesture Sensor, a small breakout boa Breadboard - Mini Modular (White) PRT-12043 This white Mini Breadboard is a great way to prototype your small proj Jumper Wires Standard 7" M/M Pack of 30 PRT-11026 If you need to knock up a quick prototype there's nothing like having a Break Away Headers - Straight PRT-00116 A row of headers - break to fit. 40 pins that can be cut to any size. Us SparkFun USB Mini-B Cable - 6 Foot CAB-11301 This is a USB 2.0 type A to Mini-B 5-pin cable. You know, the mini-b SparkFun FTDI Basic Breakout - 3.3V DEV-09873 This is the newest revision of our [FTDI Basic](http://www.sparkfun.co Arduino Pro 328-3.3V/8MHz DEV-10914 It's blue! It's skinny! It's the Arduino Pro! SparkFun's minimal design a If you do not have specifically a 3.3V Arduino Pro, there are a number of ways to complete the walkthrough. In general, you will need: Arduino or other microcontroller You will need something that is capable of I2C and communicating back to the computer (e.g. serial communications). The microcontroller needs to have a 3.3V I/O voltage or you will have to use a level shifter. We are using the 3.3V Arduino Pro, but the 3.3V Arduino Pro Mini would work as well. Level shifting If you are using a 5V Arduino, like the Uno or RedBoard, you will need to use a level shifter, such as the bidirectional logic level converter. Connectors You will need to interface your microcontroller with the breakout board. Male headers are perfect if you re using a breadboard. Another option is to use wire to connect the breakout board directly to the microcontroller. Soldering tools After you ve picked a connector, you will need to solder it to the breakout board. A simple soldering iron and some solder should be all you need. Recommended Reading Before getting started with the APDS-9960, there are a few concepts that you should be familiar with. Consider reading some of these tutorials before continuing:

Page 3 of 12 What is an Arduino? We will use an Arduino to control the APDS- 9960 2 2 I C I C is the communication protocol used by the APDS-9960 Serial Communication We use serial communications (with the FTDI breakout board) to program the Arduino and provide information to our computer from the Arduino How to Use a Breadboard The breadboard ties the Arduino to the APDS-9960 breakout board Board Overview Pin Descriptions The APDS-9960 breakout board provides 6 pins to provide power to the sensor and I2C bus. Pin Label VL GND Description Optional power to the IR LED if PS jumper is disconnected. Must be 3.0-4.5V Connect to ground. VCC Used to power the APDS-9960 sensor. Must be 2.4-3.6V SDA SCL INT 2 I C data I2C clock External interrupt pin. Active LOW on interrupt event Setting the Jumpers On the front of the breakout board are 2 solder jumpers: PS This jumper connects the power supplies of the sensor and IR LED (also located on the APDS-9960) together. When the jumper is closed (i.e. connected), you only need to supply power to the VCC pin to power both the sensor and the IR LED. If the jumper is open, you need to provide power to both the VCC (2.4-3.6V) and VL (3.0-4.5V) pins separately. This jumper is closed by default. I2C PU This is a 3-way solder jumper that is used to connect and disconnect the I2C pullup resistors. By default, this jumper is closed, which means that both SDA and SCL lines have connected pullup resistors on the breakout board. Use some solder wick to open the jumper if you do not need the pullup resistors (e.g. you have pullup resistors that are located on the I2C bus somewhere else).

Page 4 of 12 Hardware Hookup Add Headers Solder a row of break away male headers to the 6 headers holes on the board. Connect the Breakout Board We will be using the Arduino Pro s regulated 3.3V power and I2C bus with the APDS-9960. Note that we are leaving VL on the breakout board unconnected. IMPORTANT: You must use 3.3V! If you try to use a 5V power supply or 5V I2C communications, you risk damaging the APDS-9960. If you are using a 5V Arduino (e.g. UNO), then you need to have some kind of level shifting. Connect the breakout board to the following pins on the Arduino: APDS-9960 Breakout Board Arduino Pro 3.3V GND VCC SDA SCL GND VCC A4 A5 INT 2 Arduino Library Installation To use the APDS-9960, you will need some supporting software. If you are using an Arduino, then you are in luck! We created an Arduino library that makes the APDS-9960 easy to use. Click the button below to download the latest version of the APDS-9960 breakout board project, which includes the Arduino library.

Page 5 of 12 DOWNLOAD THE PROJECT FILES! Unzip the downloaded file and navigate to <your download directory>\apds-9960_rgb_and_gesture_sensor-master\apds- 9960_RGB_and_Gesture_Sensor-master\Libraries. Note: the directory names in this picture have changed slightly since the Arduino 1.6.3 update. Follow this guide on installing Arduino libraries to install the files within the SparkFun_APDS9960 directory as an Arduino library. Gesture Sensing Example Load the GestureTest Example Open up the Arduino program and select File Examples SparkFun_APDS9960 GestureTest. Plug in your FTDI Breakout (3.3V) to the Arduino Pro (3.3V). Attach a USB mini cable from your computer to the FTDI Breakout. If you have not previously done so, install the FTDI drivers.

For reference, here is the GestureTest.ino sketch. Page 6 of 12

Page 7 of 12 /************************************************************* *** GestureTest.ino APDS 9960 RGB and Gesture Sensor Shawn Hymel @ SparkFun Electronics May 30, 2014 https://github.com/sparkfun/apds 9960_RGB_and_Gesture_Sensor Tests the gesture sensing abilities of the APDS 9960. Configur es APDS 9960 over I2C and waits for gesture events. Calculates th e direction of the swipe (up, down, left, right) and displays it on a serial console. To perform a NEAR gesture, hold your hand far above the sensor and move it close to the sensor (within 2 inches). Hold your hand there for at least 1 second and move i t away. To perform a FAR gesture, hold your hand within 2 inches of th e sensor for at least 1 second and then move it above (out of range) of the sensor. Hardware Connections: IMPORTANT: The APDS 9960 can only accept 3.3V! Arduino Pin APDS 9960 Board Function 3.3V VCC Power GND GND Ground A4 SDA I2C Data A5 SCL I2C Clock 2 INT Interrupt Resources: Include Wire.h and SparkFun_APDS 9960.h Development environment specifics: Written in Arduino 1.0.5 Tested with SparkFun Arduino Pro Mini 3.3V This code is beerware; if you see me (or any other SparkFun employee) at the local, and you've found our code helpful, ple ase buy us a round! Distributed as is; no warranty is given. ************************************************************** **/ #include <Wire.h> #include <SparkFun_APDS9960.h> // Pins #define APDS9960_INT 2 // Needs to be an interrupt pin // Constants // Global Variables SparkFun_APDS9960 apds = SparkFun_APDS9960();

Page 8 of 12 int isr_flag = 0; void setup() { // Initialize Serial port Serial.begin(9600); Serial.println(); Serial.println(F(" ")); Serial.println(F("SparkFun APDS 9960 GestureTest")); Serial.println(F(" ")); // Initialize interrupt service routine attachinterrupt(0, interruptroutine, FALLING); // Initialize APDS 9960 (configure I2C and initial values) if ( apds.init() ) { Serial.println(F("APDS 9960 initialization complete")); else { Serial.println(F("Something went wrong during APDS 9960 in it!")); // Start running the APDS 9960 gesture sensor engine if ( apds.enablegesturesensor(true) ) { Serial.println(F("Gesture sensor is now running")); else { Serial.println(F("Something went wrong during gesture sens or init!")); void loop() { if( isr_flag == 1 ) { detachinterrupt(0); handlegesture(); isr_flag = 0; attachinterrupt(0, interruptroutine, FALLING); void interruptroutine() { isr_flag = 1; 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;

Page 9 of 12 default: Serial.println("NONE"); Run Make sure you have the correct serial port selected under Tools Serial Port and Arduino Pro or Pro Mini (3.3V, 8MHz) w/ ATmega328 selected under Tools Board. If you have never used the Arduino IDE before, this turoial should get you started. Click the Upload button and wait for the program to finish uploading to the Arduino. Select Tools Serial Monitor to open up the serial terminal. More info on the Serial Terminal can be found here. You should see a couple of messages noting that APDS-9960 initialization complete and Gesture sensor is now running. Hover your hand 4 to 8 inches (10 to 20 cm) above the sensor but off to one side (i.e. not directly above the sensor). While maintaining the same height, swipe your hand over the sensor (into and then immediately out of range of the sensor). If you move too fast, the sensor will not recognize the gesture. Gestures will appear on the serial monitor, which indicate the direction of the swipe.

Page 10 of 12 There are also 2 other gestures available: NEAR and FAR. A NEAR gesture can be achieved by holding your hand far above the sensor (greater than 10 inches (25 cm)), bringing it close to the sensor (about 2 inches (5 cm) directly above the sensor), holding it there for at least 1 second, and then removing your hand. A FAR gesture can be achieved by holding your hand directly above and close to the sensor (about 2 inches (5 cm)) for at least 1 second and then moving your hand up directly above and out of range of the sensor. If a gesture was not correctly interpreted, NONE will appear in the serial monitor. Supported Gestures Here is a list of the currently supported gestures. Make sure each gesture begins outside of the range of the sensor, moves into the range of the sensor, and ends outside the range of the sensor. Gesture UP DOWN Description A swipe from the bottom of the board to the top and out of range of the sensor. Make sure that your wrist/arm is not in the sensor's range at the end of the swipe! A swipe from the top of the board to the bottom and out of range of the sensor.

Page 11 of 12 LEFT RIGHT NEAR FAR NONE A swipe from the right side of the board to the left and out of range of the sensor. A swipe from the left side of the board to the right and out of range of the sensor. Object (e.g. hand) starts far above the sensor, moves close to the sensor, hovers for at least 1 second, and moves out of range of the sensor. Object starts near the sensor, hovers for at least 1 second, and then moves up above and out of range of the sensor. The sensor could not correctly guess the gesture being performed. Resources and Going Further Now that you have seen the gesture recognition capabilities of the APDS- 9960, you can begin to use it in your project! Keep in mind that the APDS- 9960 is also capable of sensing object proximity and ambient/color light. Try out the other examples in the SFE_APDS9960 library to see what the sensor can do: AmbientLightInterrupt This example shows how you can generate an Arduino interrupt whenever the ambient light falls below a given level. You can also change it to throw an interrupt when the light rises above a certain level. ColorSensor This demo shows how to read ambient, red, green, and blue light values from the APDS-9960. GestureTest We used this example in this hookup guide. It shows how to read basic gestures with the APDS-9960. ProximityInterrupt The APDS-9960 can be used to detect when objects move within range of its sensor. This example shows how to throw an interrupt whenever an object moves within a certain range of the sensor. You can also change the limits to generate an interrupt whenever an object moves outside of a certain range. ProximitySensor You do not need to use interrupts with the proximity sensor. In this demo, we show you how to poll the sensor for proximity data at regular intervals. Try running this example and moving your hand close to the sensor. Resources Here are some additional resources to help you with the APDS-9960: APDS-9960 Datasheet APDS-9960 Breakout Board Schematic APDS-9960 RGB and Gesture Sensor GitHub Repository Other Tutorials What will you make with the APDS-9960? If you need some inspiration, check out these related tutorials: Serial Graphic LCD Hookup

https://learn.sparkfun.com/tutorials/apds-9960-rgb-and-gesture-sensor-hookup-guide?_ga=... Page 12 of 12 9/29/2015 Hackers in Residence - Sound and Motion Reactivity for Wearables How to consciously wear light-up and and sound reactive clothing. Learn how to use the Serial Graphic LCD. RGB Panel Hookup Guide Make bright, colorful displays using the 32x32 and 32x16 RGB LED panels. This hookup guide shows how to hook up these panels and control them with an Arduino. Micro OLED Breakout Hookup Guide Learn how to hook up the Micro OLED breakout to an Arduino. Then draw pixels, shapes, text and bitmaps all over it!