Location: Home » ガイド/電子ブック » Basic Tutorial about Arduino » Learn Coding with Arduino IDE – APDS-9960 RGB and Gesture Sensor

Learn Coding with Arduino IDE – APDS-9960 RGB and Gesture Sensor

Post Time: 2018-11-13 22:11:44 Category: Basic Tutorial about Arduino

Introduction

In this lesson, we will show what is the APDS-9960 RGB and Gesture Sensor and how to hook up it to the Arduino board.

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:

Preparations

HARDWARE

SOFTWARE

About APDS-9960 RGB and Gesture Sensor

This is the  RGB and Gesture Sensor, a small breakout board with a built in APDS-9960 sensor that offers ambient light and color measuring, proximity detection, and touchless gesture sensing. With this RGB and Gesture Sensor you will be able to control a computer, microcontroller, robot, and more with a simple swipe of your hand! This is, in fact, the same sensor that the Samsung Galaxy S5 uses and is probably one of the best gesture sensors on the market for the price.

 
The APDS-9960 is a serious little piece of hardware with built in UV and IR blocking filters, four separate diodes sensitive to different directions, and an I2C compatible interface. For your convenience we have broken out the following pins: VL (optional power to IR LED), GND (Ground), VCC (power to APDS-9960 sensor), SDA (I2C data), SCL (I2C clock), and INT (interrupt). Each APDS-9960 also has a detection range of 4 to 8 inches (10 to 20 cm).

Pin Descriptions

Pin Label Description
VL Optional power to the IR LED if PS jumper is disconnected. Must be 3.0 – 4.5V
GND Connect to ground.
VCC Used to power the APDS-9960 sensor. Must be 2.4 – 3.6V
SDA I2C data
SCL I2C clock
INT External interrupt pin. Active LOW on interrupt event

Features:

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.

Setting the Jumpers

On the front of the breakout board are 2 solder jumpers:

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  you risk damaging the APDS-9960.

Connect the breakout board to the following pins on the Arduino:

APDS-9960 Breakout Board 3.3V Arduino Pro
GND GND
VCC 3.3V
SDA A4
SCL A5

NOTE:

An APDS-9960 color sensor breakout board connected to an Arduino Nano 33 IoT

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.

DOWNLOAD THE PROJECT FILES!

Follow this guide on installing Arduino libraries to install the files within the APDS9960 directory as an Arduino library.

Gesture Sensing Example

Upload Sketch

After above operations are completed, connect the Arduino board to your computer using the USB cable. The green power LED (labelled PWR) should go on.

CODE PROGRAM

You can  copy below code to your Arduino IDE window, then select corresponding board type and port type for your Arduino board.

Running Result

Click the Upload button and wait for the program to finish uploading to the Arduino. Once uploaded to your Adruino, open up the serial monitor at 115200 baud speed.More info on the Serial Terminal can be found here. You should see a  messages noting that “Device initialized! ”

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.

DownLoad Url osoyoo.com

Leave a Reply


Address:
E-mail:
Tel: