通过APDS-9960手势识别芯片在Arduino上实现手势识别。
1. HARDWARE
· Osoyoo UNO Board (Fully compatible with Arduino UNO rev.3) x 1
· APDS-9960 RGB and Gesture Sensor x 1
· Jumpers
· USB Cable x 1
· PC x 1
2. SOFTWARE
· Arduino IDE (version 1.6.4+)
· Arduino library: APDS9960.h
3. 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).
3.1 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 |
3.2 FEATURES:
· Model: GY-APDS 9960-3.3
· Using chip: APDS-9960
· Operational Voltage: 3.3V
· Ambient Light & RGB Color Sensing
· Proximity Sensing
· Gesture Detection
· Operating Range: 4-8in (10-20cm)
· I2C Interface (I2C Address: 0x39)
· Size: 20mm * 15.3mm
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.
3.3 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).
3.4 HARDWARE HOOKUP
3.4.1 Add Headers
Solder a row of break away male headers to the 6 headers holes on the board.
3.4.2 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** | \OSOYOO UNO** |
---|---|
GND | GND |
VCC | 3.3V |
SDA | A4 |
SCL | A5 |
\NOTE:**
· Connect the \SCL** pin to the I2C clock \SCL** pin on your Arduino. On an UNO & ‘328 based Arduino, this is also known as \A5**, on a Mega it is also known as \digital 21** and on a Leonardo/Micro, \digital 3**
· Connect the \SDA** pin to the I2C data \SDA** pin on your Arduino. On an UNO & ‘328 based Arduino, this is also known as \A4**, on a Mega it is also known as \digital 20** and on a Leonardo/Micro, \digital 2**
3.5 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**
4. 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.
5.CODE PROGRAM
You can copy below code to your Arduino IDE window, then select corresponding board type and port type for your Arduino board.
6.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.
#
附:Adafruit Community Code of Conduct
Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and leaders pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level or type of
experience, education, socio-economic status, nationality, personal appearance,
race, religion, or sexual identity and orientation.
Our Standards
We are committed to providing a friendly, safe and welcoming environment for
all.
Examples of behavior that contributes to creating a positive environment
include:
- Be kind and courteous to others
- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Collaborating with other community members
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
- The use of sexualized language or imagery and sexual attention or advances
- The use of inappropriate images, including in a community member’s avatar
- The use of inappropriate language, including in a community member’s nickname
- Any spamming, flaming, baiting or other attention-stealing behavior
- Excessive or unwelcome helping; answering outside the scope of the question
asked - Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others’ private information, such as a physical or electronic
address, without explicit permission - Other conduct which could reasonably be considered inappropriate
The goal of the standards and moderation guidelines outlined here is to build
and maintain a respectful community. We ask that you don’t just aim to be
“technically unimpeachable”, but rather try to be your best self.
We value many things beyond technical expertise, including collaboration and
supporting others within our community. Providing a positive experience for
other community members can have a much more significant impact than simply
providing the correct answer.
Our Responsibilities
Project leaders are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project leaders have the right and responsibility to remove, edit, or
reject messages, comments, commits, code, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any community member for other behaviors that they deem
inappropriate, threatening, offensive, or harmful.
Moderation
Instances of behaviors that violate the Adafruit Community Code of Conduct
may be reported by any member of the community. Community members are
encouraged to report these situations, including situations they witness
involving other community members.
You may report in the following ways:
In any situation, you may send an email to support@adafruit.com.
On the Adafruit Discord, you may send an open message from any channel
to all Community Helpers by tagging @community helpers. You may also send an
open message from any channel, or a direct message to @kattni#1507,
@tannewt#4653, @Dan Halbert#1614, @cater#2442, @sommersoft#0222, or
@Andon#8175.
Email and direct message reports will be kept confidential.
In situations on Discord where the issue is particularly egregious, possibly
illegal, requires immediate action, or violates the Discord terms of service,
you should also report the message directly to Discord.
These are the steps for upholding our community’s standards of conduct.
- Any member of the community may report any situation that violates the
Adafruit Community Code of Conduct. All reports will be reviewed and
investigated. - If the behavior is an egregious violation, the community member who
committed the violation may be banned immediately, without warning. - Otherwise, moderators will first respond to such behavior with a warning.
- Moderators follow a soft “three strikes” policy - the community member may
be given another chance, if they are receptive to the warning and change their
behavior. - If the community member is unreceptive or unreasonable when warned by a
moderator, or the warning goes unheeded, they may be banned for a first or
second offense. Repeated offenses will result in the community member being
banned.
Scope
This Code of Conduct and the enforcement policies listed above apply to all
Adafruit Community venues. This includes but is not limited to any community
spaces (both public and private), the entire Adafruit Discord server, and
Adafruit GitHub repositories. Examples of Adafruit Community spaces include
but are not limited to meet-ups, audio chats on the Adafruit Discord, or
interaction at a conference.
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. As a community
member, you are representing our community, and are expected to behave
accordingly.
Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 1.4, available at
https://www.contributor-covenant.org/version/1/4/code-of-conduct.html,
and the Rust Code of Conduct.
For other projects adopting the Adafruit Community Code of
Conduct, please contact the maintainers of those projects for enforcement.
If you wish to use this code of conduct for your own project, consider
explicitly mentioning your moderation policy or making a copy with your
own moderation policy so as to avoid confusion.