产品名称(300px)

简介

SEN0315手势识别传感器是一款强大的3D手势识别交互式传感器;在最远20cm范围内,最多可以识别13种手势。具备良好的手势识别稳定性和节能机制,总是能够在恰当的时候偷偷帮你节省电源;采用Gravity接口,零件的连接就不再是一件麻烦的事。目前有两种工作模式:高速模式下可以识别手的上\下\左\右\前\后\顺时针\逆时针移动以及快速挥动9种手势;低速模式下可以此前9种基础上再加乱序\缓慢左右\缓慢前后\缓慢上下移动4种手势。显然这款传感器可以有广泛的运用范围,设想一下,挥挥手控制电视空调;挥挥手调整灯光和音乐;挥挥手去操纵游戏...会不会很有意思呢?

技术规格

PAJ7620U2 Gesture Sensor 手势识别传感器尺寸图

SEN0315_sche.png

引脚说明

  • 顶部示意图
  • 底部示意图
''' 丝印 ''' ''' 功能描述 '''
D I2C数据SDA
C I2C时钟SCL
- 电源负极
+ 电源正极

使用教程

准备

接线图

准备好硬件后,按照下图将模块与UNO连接好 SEN0315_LinePic.png

样例代码

点击下载库文件例程和库文件如何安装库?

函数参考:

DFRobot_PAJ7620U2(TwoWire *pWire=&Wire);
/**
* @brief 构造函数
* @param mode 构造设备时,可以指定它的默认工作模式
*/

int begin(void)
/**
* @brief 初始化函数
* @return 返回0表示初始化成功,返回其他值表示初始化失败
*/

void setGestureHighRate(bool b);
/**
* @brief 设置告诉手势识别模式
* @param b true表示配置为高速识别模式,以最快速度识别手势并返回。
* @n false表示低速模式,在低速模式下,系统会做更多的判断
* @n 在高速识别模式下,可以快速识别的动作包括向左滑动 向右滑动 向上滑动 向下滑动
* @n 向前滑动 向后滑动 逆时针 顺时针 快速挥手 9个动作
* @n 高级用户如果想要用这些动作的组合,需要在外部自己算法逻辑,比如左右左快速挥手
* @n 因为每个人用到的动作有限 ,我们没有将更多的扩展动作集在库中,需要用户在ino文件中自己完成算法逻辑
* @n
* @n
* @n 在低速识别模式下,每2秒识别一个动作,我们将一些扩展动作集成到库内部,方便基础用户使用
* @n 可以识别的动作包括向左滑动 向右滑动 向上滑动 向下滑动 向前滑动 向后滑动
* @n 逆时针 顺时针 快速挥手 9个基础动作 左右慢挥手 上下慢挥手 前后慢挥手 乱序慢挥手 4个扩展动作
*/

String gestureDescription(eGesture_t gesture);
/**
* @brief 获取手势号码对应的字符串描述
* @param gesture 包含在eGesture_t中的手势号码
* @return 手势号码对应的文字描述信息,如果输入了手势表中不存在的手势,返回空字符串
* @n 正常的返回值可能是 "None","Right","Left", "Up", "Down", "Forward", "Backward", "Clockwise",
* @n "Anti-Clockwise", "Wave", "WaveSlowlyDisorder", "WaveSlowlyLeftRight", "WaveSlowlyUpDown",
* @n "WaveSlowlyForwardBackward"
*/

eGesture_t getGesture(void);
/**
* @brief 获取手势
* @return 返回手势,可能是的值为eGestureNone eGestureRight eGestureLeft eGestureUp
* @n eGestureDown eGestureForward eGestureBackward eGestureClockwise
* @n eGestureWave eGestureWaveSlowlyDisorder eGestureWaveSlowlyLeftRight
* @n eGestureWaveSlowlyUpDown eGestureWaveSlowlyForwardBackward
*/

高速模式:

代码功能:可以识别以下手势。

warning_yellow.png
注:顺时针和逆时针手势需要至少转两圈以上 更多操作详见问答部分参考视频
高速模式可识别手势
gesture code gesture dsctiption
1 Right
2 Left
4 Up
8 Down
16 Forward
32 Backward
64 Clockwise
128 Anti-clockwise
256 Wave(quickly)
the totality of recognizable gesture is 9

|

/*!
 * @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.
   *
   *
   *
   *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();
  }
}

|}

结果

结果:可识别9种手势,可以在串口打印出相应的手势描述,如下图所示: <File:SEN0315> 9ges.png

低速模式:

warning_yellow.png
注:低速模式下默认采样时间为2s,所以完成一项操作后可能需等待1s 更多操作详见问答部分参考视频

代码功能:可以识别以下手势。

低速模式可识别手势
gesture code gesture dsctiption
1 Right
2 Left
3 WaveSlowlyLeftRight
4 Up
8 Down
12 WaveSlowlyUpDown
16 Forward
32 Backward
48 WaveSlowlyForwardBackward
64 Clockwise
128 Anti-clockwise
256 Wave(quickly)
512 WaveSlowlyDisorder
the totality of recognizable gesture is 13
#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 <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
    * "None","Right","Left", "Up", "Down", "Forward", "Backward", "Clockwise", "Anti-Clockwise", "Wave",
    * "WaveSlowlyDisorder", "WaveSlowlyLeftRight", "WaveSlowlyUpDown
  }
}

结果

结果:可识别13手势,可以在串口打印出相应的手势描述,如下图所示: <File:SEN0315> 13ges.png

Mind+(基于Scratch3.0)图形化编程

1、下载及安装软件,版本不低于1.6.2 RC2.0。下载地址:http://www.mindplus.cc 详细教程:Mind+基础wiki教程-软件下载安装
2、切换到“上传模式”。详细教程:Mind+基础wiki教程-上传模式编程流程
3、“扩展”中选择“主控板”中的“Arduino Uno”,“用户库”中搜索加载'''手势''' 。详细教程:Mind+基础wiki教程-加载扩展库流程
4、进行编程,程序如下图。
5、菜单“连接设备”,“上传到设备”
6、程序上传完毕后,打开串口即可看到数据输出。详细教程:Mind+基础wiki教程-串口打印

blocks

sen0135_example

常见问题

问:有高速模式演示视频吗?

- 答:https://www.bilibili.com/video/av76484181'''

问:有低速模式演示视频吗?

- 答:https://www.bilibili.com/video/av76484092'''

更多问题及有趣的应用,可以 访问论坛 进行查阅或发帖!

更多

原理图 Datasheet SVG 文件

DFshopping_car1.png DFRobot商城购买链接