DFRobot 的 SEN0315 规格书
DFRDBCIT
mm: m: rmun:
Gravity:
PAJ7620U2
Gesture Sensor
SKU:SEN0315
Introduction
Build an awesome interactive project with this PAJ7620U2 Gesture Sensor! It is an
interactive sensor with 3D gesture recognition that can recognize 13 gestures at most
within 20cm.
There are two recognition modes for this sensor: fast mode (9 gestures) and slow mode
(13 gestures). In fast detection mode, the sensor can recognize 9 gestures: move left,
right, up, down, forward, backward, clockwise, counter-clockwise, wave. The slow mode
can recognize 4 expanded gestures besides the 9 basic gestures: slowly move left and
right, slowly move up and down, slowly move forward and backward, move randomly.
The unit sampling time can be defined by users in this mode. Moreover, users can
customize their own gestures if necessary.
The sensor offers stable performance, fast response and high accuracy, which makes it
an excellent choice for interactive applications like non-contact remote controller,
interactive robot, gesture-based game device, smart lighting management, and so on.
Specification
• Operating Voltage: 3.3V-5V
• Operating Current: 3.5mA
• Communication Port: Gravity-IIC 4Pin
• IIC Address: 0x73
30.00mm
15. 00mm
+ I 0—D
.lLJEKJEhiCJ
(—22.00mm—>
IIC nu [I ....
Cover Glas ': I), 7 um
.'\I[ (km E (ijm
• Dimension: 30x22mm/1.18x0.87"
• Mounting Hole Size: 15mm/0.59"
• Detection Distance: 3cm-20cm
• Update Rate: 120Hz
• Operating Temperature: -40℃~85℃
• Ambient Light Immunity: <100k Lux
• Cover Board Material: glass or PC; transparency>90%; Board thickness<0.7 (Place the
cover board and the module as close as possible, and the distance between them should
not be over 0.2mm.)
silkscreen
w
e
=
a
m
m
0
N
D
o
N
w
h
2
O.
Sensor(V1.0)
Description
IIC SDA
IIC SCL
Negative
Positive
Board OverView
Silkscreen
Description
D
IIC SDA
C
IIC SCL
-
Negative
+
Positive
DFRobot_PAJ7529U2(Twowire *pwire=&wire);
/**
* @brief Constructor
*/
int begin(void)
/**
* @brief Init function
* @return Return a if the initialization succeeds, otherwise return non—zero‘
*/
/**
* @brief Set the gesture recognition mode
* @param b true Fast detection mode, recognize gestures quickly and return‘
* @n false Slow detection mode, the system will do more judgements‘
* @n In fast detection mode, the sensor can recognize 9 gestures: move left,
right, up, down, forward,
* @n To detect the combination of these gestures, like wave left, right and left
quickly, users need to
* @n design their own algorithms logic‘
* @n Since users only use limited gestures, we didn't integrate too much expanded
gestures in the library‘
yourself.
* @n
* @n
* @n In slow detection mode, the sensor recognize one gesture every 2 seconds,
and we have integrated the
* @n expanded gestures inside the library, which is convenient for the beginners
* @n The slow mode can recognize 9 basic gestures and 4 expanded gestures: move
left, right, up, down,
* @n forward, backward, clockwise, counter-clockwise, wave, slowly move left and
right, slowly move up
* @n and down, slowly move forward and backward, wave slowly and randomly‘
*/
/**
* @brief Get the string descritpion corresponding to the gesture numben
* @param gesture Gesture number inlcuded in the eGesture_t
* @return Textual description corresponding to the gesture numberzif the gesture
input in the gesture table
* @n Normally, it may return "None","Right
"Backward", "Clockwise",
* @n "Anti-Clockwise", "Nave", "WaveSlowlyDisorder", "WaveSlowlyLeftRight",
"Left", "Up", "Down", "Forward",
Sample Code
Functions for reference:
DFRobot_PAJ7620U2(TwoWire *pWire=&Wire);
/**
* @brief Constructor
* @param mode Call the function and designate the device's default working mode.
*/
int begin(void)
/**
* @brief Init function
* @return Return 0 if the initialization succeeds, otherwise return non-zero.
*/
void setGestureHighRate(bool b);
/**
* @brief Set the gesture recognition mode
* @param b true Fast detection mode, recognize gestures quickly and return.
* @n false Slow detection mode, the system will do more judgements.
* @n In fast detection mode, the sensor can recognize 9 gestures: move left,
right, up, down, forward,
* @n backward, clockwise, counter-clockwise, wave.
* @n To detect the combination of these gestures, like wave left, right and left
quickly, users need to
* @n design their own algorithms logic.
* @n Since users only use limited gestures, we didn't integrate too much expanded
gestures in the library.
* @n If necessary, you can complete the algorithm logic in the ino file by
yourself.
* @n
* @n
* @n In slow detection mode, the sensor recognize one gesture every 2 seconds,
and we have integrated the
* @n expanded gestures inside the library, which is convenient for the beginners
to use.
* @n The slow mode can recognize 9 basic gestures and 4 expanded gestures: move
left, right, up, down,
* @n forward, backward, clockwise, counter-clockwise, wave, slowly move left and
right, slowly move up
* @n and down, slowly move forward and backward, wave slowly and randomly.
*/
String gestureDescription(eGesture_t gesture);
/**
* @brief Get the string descritpion corresponding to the gesture number.
* @param gesture Gesture number inlcuded in the eGesture_t
* @return Textual description corresponding to the gesture number:if the gesture
input in the gesture table
* @n doesn't exist, return null string
* @n Normally, it may return "None","Right","Left", "Up", "Down", "Forward",
"Backward", "Clockwise",
* @n "Anti-Clockwise", "Wave", "WaveSlowlyDisorder", "WaveSlowlyLeftRight",
"WaveSlowlyUpDown",
* @n "NaveslowlyForwardBackward"
*/
eGesture_t getGesture(void);
* @brief Get gesture
* @return The gesture value it may return: eGestureNone eGestureRight
eGestureLeft eGestureUp
* @n eGestureDown eGestureForward eGestureBackward eGestureClockwise
* @n eGesturewave eGestureWaveslowlyDisorder eGestureWaveslowlyLeftRight
* @n eGestureNaveSlowlyUpDown eGestureWaveslowlyForwardBackward
Note: the clockwise and anti-clockwise gesture detection requires at least two repeated
32 Backward
64 Clockwise
* @n "WaveSlowlyForwardBackward"
*/
eGesture_t getGesture(void);
/**
* @brief Get gesture
* @return The gesture value it may return: eGestureNone eGestureRight
eGestureLeft eGestureUp
* @n eGestureDown eGestureForward eGestureBackward eGestureClockwise
* @n eGestureWave eGestureWaveSlowlyDisorder eGestureWaveSlowlyLeftRight
* @n eGestureWaveSlowlyUpDown eGestureWaveSlowlyForwardBackward
*/
Fast Detection Mode
Code function: recognize the following gestures.
Note: the clockwise and anti-clockwise gesture detection requires at least two repeated
motions.
The available gestures in fast detection mode:
Gesture Code
Gesture Description
1
Right
2
Left
4
Up
8
Down
16
Forward
32
Backward
64
Clockwise
128 Anti-clockwise
256 Wave(Quickly)
/*!
* @file GestureRecognize_HighRatelino
* @brief Present the 9 built-in gestures data the sensor supports‘
* @n Nave your hand above the sensor (within 9~29cm), it can recognize 9 kinds of
* @n backward, clockwise, anti—clockwise, wave‘
* @n For more usages of the sensor, refer to the description about
setGestureHighRate in function setup‘
*
*
@copyright Copyright (c) 2919 DFRobot Co‘Ltd (http://www‘dfrobot‘com)
@licence The MIT License (MIT)
*
@version V1.9
@date 2919-97-16
@get from https://www.dfrobotlcom
@url httpsI//github‘com/DFRobot/DFRobot_PAJ7529U2
* * * *
*/
DFRobot_PAJ7529U2 paj;
void setup()
{
delay(399);
Serial.println("Gesture recognition system base on PAJ7529U2");
while(paj‘begin() != 9){
Serial.println("initial PAJ7529U2 failure! Please check if all the connections
are fine, or if the wire sequence is correct?");
delay(599);
Serial.println("PAJ7529U2 init completed, start to test the gesture recognition
function");
/*Set fast detection mode
*If the parameter is set to false, the module enters slow detection mode, and it
detects one gesture every 25‘ We have integrated
*The slow mode can recognize 9 basic gestures and 4 expanded gestures: move left,
right, up, down, forward, backward, clockwise,
*counter-clockwise, wave, slowly move left and right, slowly move up and down,
slowly move forward and backward,
Gesture Code
Gesture Description
128
Anti-clockwise
256
Wave(Quickly)
/*!
* @file GestureRecognize_HighRate.ino
* @brief Present the 9 built-in gestures data the sensor supports.
* @n Wave your hand above the sensor (within 0~20cm), it can recognize 9 kinds of
gestures: move up, down, left, right, forward,
* @n backward, clockwise, anti-clockwise, wave.
* @n For more usages of the sensor, refer to the description about
setGestureHighRate in function setup.
*
* @copyright Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com)
* @licence The MIT License (MIT)
* @author Alexander(ouki.wang@dfrobot.com)
* @version V1.0
* @date 2019-07-16
* @get from https://www.dfrobot.com
* @url https://github.com/DFRobot/DFRobot_PAJ7620U2
*/
#include <DFRobot_PAJ7620U2.h>
DFRobot_PAJ7620U2 paj;
void setup()
{
Serial.begin(115200);
delay(300);
Serial.println("Gesture recognition system base on PAJ7620U2");
while(paj.begin() != 0){
Serial.println("initial PAJ7620U2 failure! Please check if all the connections
are fine, or if the wire sequence is correct?");
delay(500);
}
Serial.println("PAJ7620U2 init completed, start to test the gesture recognition
function");
/*Set fast detection mode
*If the parameter is set to false, the module enters slow detection mode, and it
detects one gesture every 2s. We have integrated
*some gestures inside the module to make it convenient for beginners.
*The slow mode can recognize 9 basic gestures and 4 expanded gestures: move left,
right, up, down, forward, backward, clockwise,
*counter-clockwise, wave, slowly move left and right, slowly move up and down,
slowly move forward and backward,
*wave slowly and randomly.
*The fast mode can recognize 9 gestures: move left, right, up, down, forward,
backward, clockwise, counter—clockwise, wave
*To detect the combination of these gestures, like wave left, right and left
quickly, users needs to design their own algorithms logic‘
*Since users only use limited gestures in this mode, we are not going to integrate
too much expanded gestures in the library‘
*/
paj.setGestureHighRate(true);
* eGestureNone eGestureRight eGestureLeft eGestureUp eGestureDown
eGestureForward
* eGestureBackward eGestureClockwise eGestureAntiClockwise eGestureWave
eGesturewaveSlowlyDisorder
eGesturewaveSlowlyForwardBackward
*/
DFRobot_PAJ7629U2::eGesture_t gesture = paj‘getGesture();
if(gesture != paj.eGestureNone ){
/* Get the string descritpion corresponding to the gesture numben
* The string description could be
Clockwise", "Nave",
* "NaveSlowlyDisorder", "WaveSlowlyLeftRight", "WaveSlowlyUpDown",
"NaveSlowlyForwardBackward"
*/
String description = pajigestureDescription(gesture);//Convert gesture number
Serial.println(" —————————————— Gesture Recognition System —————————————————————————
Serial.print("gesture code = ");Serial‘println(gesture);
Serial.print("gesture description = ");Serialuprintln(description);
Serial.println();
}
*
*
*
*If the parameter is set to true, the module enters fast detection mode.
*The fast mode can recognize 9 gestures: move left, right, up, down, forward,
backward, clockwise, counter-clockwise, wave
*To detect the combination of these gestures, like wave left, right and left
quickly, users needs to design their own algorithms logic.
*Since users only use limited gestures in this mode, we are not going to integrate
too much expanded gestures in the library.
*If necessary, you can complete the algorithm logic in the ino file by yourself.
*/
paj.setGestureHighRate(true);
}
void loop()
{
/* Read gesture number(return eGesture_t enumerated type)
* eGestureNone eGestureRight eGestureLeft eGestureUp eGestureDown
eGestureForward
* eGestureBackward eGestureClockwise eGestureAntiClockwise eGestureWave
eGestureWaveSlowlyDisorder
* eGestureWaveSlowlyLeftRight eGestureWaveSlowlyUpDown
eGestureWaveSlowlyForwardBackward
*/
DFRobot_PAJ7620U2::eGesture_t gesture = paj.getGesture();
if(gesture != paj.eGestureNone ){
/* Get the string descritpion corresponding to the gesture number.
* The string description could be
* "None","Right","Left", "Up", "Down", "Forward", "Backward", "Clockwise", "Anti-
Clockwise", "Wave",
* "WaveSlowlyDisorder", "WaveSlowlyLeftRight", "WaveSlowlyUpDown",
"WaveSlowlyForwardBackward"
*/
String description = paj.gestureDescription(gesture);//Convert gesture number
into string description
Serial.println("--------------Gesture Recognition System-------------------------
--");
Serial.print("gesture code = ");Serial.println(gesture);
Serial.print("gesture description = ");Serial.println(description);
Serial.println();
}
}
Expected Results
Serial print the code and description of 9 gestures.
0 00m Milo/Galina Um)
—o.mu Izunitiu 9m.—
.mu. nd. - u
an... Innipcin = [ml
—o.mu Izunitiu 9m.—
nstuu 'I‘l ‘ 32
mm- Innipcin =luh¢l
—o.mu Izunitiu 9m.—
listlxu 'I‘l - 2
9n... u-im- = 1.5:
—mm. mug-hi.- 9m.—
IIIUIKI will - I
on... fighting = nu:
—OIflIz. hug-hi.- Syn-—
lum- "I. - 4
pm:- h-ipci- = I.
—GIflIz| hug-hi.- Syn-—
DEE- " Elfin-im—
Left
WaveSlowlyLeftRight
UP
Slow Detection Mode
Note: the default samping time in slow mode is 2s, so you need to wait for 1s when completed one
detection.
The available gestures in slow detection mode:
Gesture Code
Gesture Description
1
Right
2
Left
3
WaveSlowlyLeftRight
4
Up
8 Down
12 WaveSIowlyUpDown
16 Forward
32 Backward
48 WaveSIowlyFonNardBackward
64 Clockwise
#include
/*!
* @file GestureRecognize_LowRatelino
* @brief Present the 9 built-in gestures the sensor supports and 4 extended gestures
in the slow mode.
* @n Nave you hand above the sensor(within 9~29cm), it can detect: move left, right,
up, down, forward, backward, clockwise,
slowly move forward and backward, wave randomly and slowly‘
* @n For more usages of the sensor, refer to the description about setGestureLowRate
in function setup.
*
*
@copyright Copyright (c) 2919 DFRobot Co‘Ltd (http://www‘dfrobot‘com)
* @licence The MIT License (MIT)
* @version V1.9
* @date 2919-97-16
* @get from https://www.dfrobotlcom
*
@url httpsI//github‘com/DFRobot/DFRobot_PAJ7529U2
Gesture Code
Gesture Description
8
Down
12
WaveSlowlyUpDown
16
Forward
32
Backward
48
WaveSlowlyForwardBackward
64
Clockwise
128
Anti-clockwise
256
Wave(quickly)
512
WaveSlowlyDisorder
#include <DFRobot_PAJ7620U2.h>
/*!
* @file GestureRecognize_LowRate.ino
* @brief Present the 9 built-in gestures the sensor supports and 4 extended gestures
in the slow mode.
* @n Wave you hand above the sensor(within 0~20cm), it can detect: move left, right,
up, down, forward, backward, clockwise,
* @n anti-clockwise, wave, slowly move left and right, slowly move up and down,
slowly move forward and backward, wave randomly and slowly.
* @n For more usages of the sensor, refer to the description about setGestureLowRate
in function setup.
*
* @copyright Copyright (c) 2010 DFRobot Co.Ltd (http://www.dfrobot.com)
* @licence The MIT License (MIT)
* @author Alexander(ouki.wang@dfrobot.com)
* @version V1.0
* @date 2019-07-16
* @get from https://www.dfrobot.com
* @url https://github.com/DFRobot/DFRobot_PAJ7620U2
*/
#include
void setup()
{
Serial.begin(115289);
delay(388);
Serial.println("Gesture recognition system base on PAJ7529U2");
Serial.println("initial PAJ7529U2 failure! Please check if all the connections
are fine, or if the wire sequence is correct?");
delay(599);
}
Serial.println("PAJ7529U2init completed, start to test the gesture recognition
/*Set fast detection mode
*If the parameter is set to false, the module enters slow detection mode, and it
detects one gesture every 25‘ We have integrated
*some gestures inside the module to make it convenient for beginners‘
*The slow mode can recognize 9 basic gestures and 4 expanded gestures: move left,
*counter-clockwise, wave, slowly move left and right, slowly move up and down,
slowly move forward and backward,
*wave slowly and randomly‘
*
*
*
*The fast mode can recognize 9 gestures: move left, right, up, down, forward,
backward, clockwise, counter—clockwise, wave‘
*To detect the combination of these gestures, like wave left, right and left
quickly, users needs to design their own
*algorithms logic.
too much expanded gestures in the library‘
*If necessary, you can complete the algorithm logic in the ino file by yourself‘
*/
paj.setGestureHighRate(false);
}
void loop()
{
* eGestureNone eGestureRight eGestureLeft eGestureUp eGestureDown
eGestureForward
* eGestureBackward eGestureClockwise eGestureAntiClockwise eGestureWave
* eGesturewaveSlowlyLeftRight eGestureWaveSlowlyUpDown
eGesturewaveSlowlyForwardBackward
*/
#include <DFRobot_PAJ7620U2.h>
DFRobot_PAJ7620U2 paj;
void setup()
{
Serial.begin(115200);
delay(300);
Serial.println("Gesture recognition system base on PAJ7620U2");
while(paj.begin() != 0){
Serial.println("initial PAJ7620U2 failure! Please check if all the connections
are fine, or if the wire sequence is correct?");
delay(500);
}
Serial.println("PAJ7620U2init completed, start to test the gesture recognition
function");
/*Set fast detection mode
*If the parameter is set to false, the module enters slow detection mode, and it
detects one gesture every 2s. We have integrated
*some gestures inside the module to make it convenient for beginners.
*The slow mode can recognize 9 basic gestures and 4 expanded gestures: move left,
right, up, down, forward, backward, clockwise,
*counter-clockwise, wave, slowly move left and right, slowly move up and down,
slowly move forward and backward,
*wave slowly and randomly.
*
*
*
*If the parameter is set to true, the module enters fast detection mode.
*The fast mode can recognize 9 gestures: move left, right, up, down, forward,
backward, clockwise, counter-clockwise, wave.
*To detect the combination of these gestures, like wave left, right and left
quickly, users needs to design their own
*algorithms logic.
*Since users only use limited gestures in this mode, we are not going to integrate
too much expanded gestures in the library.
*If necessary, you can complete the algorithm logic in the ino file by yourself.
*/
paj.setGestureHighRate(false);
}
void loop()
{
/* Read gesture number(return eGesture_t enumerated type)
* eGestureNone eGestureRight eGestureLeft eGestureUp eGestureDown
eGestureForward
* eGestureBackward eGestureClockwise eGestureAntiClockwise eGestureWave
eGestureWaveSlowlyDisorder
* eGestureWaveSlowlyLeftRight eGestureWaveSlowlyUpDown
eGestureWaveSlowlyForwardBackward
*/
DFRobot_PAJ7620U2::eGesture_t gesture = paj.getGesture();
if(gesture != paj.eGestureNone ){
/* Get the string descritpion corresponding to the gesture number‘
* The string description could be
Cloc kwi se" , "Wave" ,
* "WaveslowlyDisorder", "WaveslowlyLeftRight", "WaveslowlyUpDown",
"WaveslowlyForwardBackwa rd "
*/
String description = pajigestureDescription(gesture);//Convert gesture number
into string description
Seria1.print("gesture code
= ")'Serialiprint1n(gesture);
Seria1.print("gesture description = ");Serial‘print1n(description);
Seria1.print1n();
}
® coma (ArduinolGemim Um)
—Gu(ute lung-mu. Synd—
xmnn "I. = 512
Hutu: «minim - IluSlv-lflliiudet
—Glsxure let-Initial Sysu-t—
gum. "A. = 4
mm. luainion - up
—c.sxm let-Initial Syslu—
‘extwe "l. = :2
mm. mama»: = ‘luSlnlWlfll-xu
—Gnsme let-Initial Syn-r—
;mm "in = 3
mm. hmimm = 1m.
—G-stun [mg-mm Syn-r—
12
mm. I-sainki-n 7 ‘lrnSl-tlyllisnzlu
gum. "A.
46-:“1- lumpiti-n Syn-—
‘ Ush- dun-r
luliu
um h-i V
um «um
if(gesture != paj.eGestureNone ){
/* Get the string descritpion corresponding to the gesture number.
* The string description could be
* "None","Right","Left", "Up", "Down", "Forward", "Backward", "Clockwise", "Anti-
Clockwise", "Wave",
* "WaveSlowlyDisorder", "WaveSlowlyLeftRight", "WaveSlowlyUpDown",
"WaveSlowlyForwardBackward"
*/
String description = paj.gestureDescription(gesture);//Convert gesture number
into string description
Serial.println("--------------Gesture Recognition System-------------------------
--");
Serial.print("gesture code = ");Serial.println(gesture);
Serial.print("gesture description = ");Serial.println(description);
Serial.println();
}
}
Expected Result
Serial print the code and description of 13 gestures: