Arduino 项目笔记 | 基于PAJ7620U2手势识别(Gestures Sensor)的水龙头

本文介绍了针对传统水龙头卫生问题,提出了一种利用PAJ7620U2手势识别模块的非接触式水龙头控制系统。该系统通过手势识别避免了直接接触,提高了卫生标准。文章详细阐述了红外感应水龙头的优缺点,如需电源、成本高等,并提出PAJ7620U2传感器作为解决方案,具备高速、高精度和强抗干扰能力。通过ArduinoIDE编程实现手势控制水阀开关,实现了洗手无需接触水龙头的功能。此外,还涵盖了硬件选择、软件配置和电路搭建过程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一、项目背景

在许多大型公共场所,人员流动量大,公共设施的卫生情况普遍恶劣;传统的接触式水龙头存在着严重的卫生隐患。

在这里插入图片描述

家用厨房 洗碗、洗手时沾着油渍或洗手液洗手的手不方便触及水龙头。
医院里 容易滋生细菌、病毒,对水龙头的清洁要求更高。

红外感应水龙头虽然能够达到非接触的效果,但是其很容易被其他光线或异物干扰,导致水流不停或不出水等问题。

二、问题描述

红外感应水龙头的优缺点(链接

  • 1、需要电源驱动,因此要做到定期更换内部供电系统。

  • 2、不能兼顾接水和洗手,如洗脸要接一盆水,不可能手一直防着感应,就这一点来说,目前并不适合家居使用,如果后期有改善,是可以考虑的。

  • 3、造价比较高,目前市场上的感应水龙头价格需在400元至1000元之间,有的甚至更贵。

  • 4、由于感应水龙头的特殊性,它的生产成本较高,所以现在装修材料市场上的感应水龙头价格较贵,一般在400元至1000元之间,有的感应水龙头可能还会因为其他的优异的性能价格甚至更贵。

  • 5、感应水龙头由于是采用需要电源驱动的,所以我们在品是的使用过程中要,定期进行感应水龙头的内部的供电系统元件的检修以及更换。更多详细内容可以百度查查吧。

三、PAJ7620U2 模块介绍

手势感应普遍应用于智能家居、智能可穿戴设备和VR等电子设备领域。

本方案采用的是 PAJ7620U2 的手势识别模块,可直接识别9种基本手势,支持I2C接口,兼容3.3V/5V电平。

相比 APDS-9960 等方案,具有识别速度更快,准确度更高,可识别手势更多等优点,且抗干扰性更强,适用于智能家居、机器人交互等低功耗应用场景。
在这里插入图片描述

  • 1、手势传感器¥79.00 (链接
  • 2、手势传感器¥48.00(链接

其特点有:

  • 1、基于PAJ7620U2传感器,可直接识别9种基本手势,支持手势中断输出
  • 2、内置红外LED和光学镜头,能在低光和黑暗环境下工作
  • 3、支持I2C接口通信,仅需两根信号脚即可控制
  • 4、板载电平转换电路,可兼容3.3V/5V的逻辑电平

PAJ7620U2 传感器参数:

  • 工作电压:3.3V/5V
  • 通信接口:I2C
  • 识别距离:5CM ~ 15CM
  • 识别手势:上、下、左、右、前、后、顺时针、逆时针、摇摆
  • 识别速度:240HZ
  • 识别视角:60° (对角线)
  • 环境光免疫力:<100K LUX
  • 产品尺寸:20MM × 20MM
  • 过孔直径:2.0MM

PAJ7620U2 传感器模块说明

引脚功能描述
VCC电源正(3.3V/5V)
GND电源地
SDAI2C数据线
SCLI2C时钟线
INT外部中断
四、所需器件

硬 件

  • UNO x1
  • IO 传感器拓展板 x1
  • PAJ7620U2手势识别传感器x1 (DFrobot 技术文档)
  • 数字继电器模块 + 3V 水泵
  • 3.7V 锂电池

软 件

  • Arduino IDE

前导知识

数字继电器模块使用教程
在这里插入图片描述

  • 控制信号:TTL电平,高电平通。
  • 触点方式:1H,1Z
  • 额定负载:10A 250VAC/10A 24VDC
  • 最大开关电压:250VAC/30VDC
  • 最大开关功率:250VA/210W
  • 最大切换电流:1H 15A/1Z 10A
  • 触点动作时间:10ms以下
  • 触点状态:未通电时常开

继电器模块接线端字符含义:

  • NC表示常闭;

  • NO表示常开;

  • N/A表示空脚;

  • COM表示公共端;

五、电路搭设

在这里插入图片描述
在这里插入图片描述

六、程序编写

关键代码展示 :

#include <DFRobot_PAJ7620U2.h>

DFRobot_PAJ7620U2 paj;

#define Switch  3  //继电器开关

void setup()
{
  pinMode(Switch,OUTPUT);//输出模式
  digitalWrite(Switch,LOW);//初始化为LOW
  
  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 
    *           1      2       4     8        16          32
    * "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();
    if(gesture == 4 || gesture == 8 )
    { 
      Serial.println("--------------Gesture Recognition System---------------------------");
      Serial.print("gesture code        = ");Serial.println(gesture);//gesture ID
      Serial.print("gesture description  = ");Serial.println(description);//描述
      switch(gesture)
      {
      //4-up  
      case 4:      {Serial.println("SWITCH STATE    = OPEN");digitalWrite(Switch,HIGH);} break;
      //8-down
      case 8:      {Serial.println("SWITCH STATE    = CLOSE");digitalWrite(Switch,LOW);} break;  
      default : break;
       }
    }
    //{digitalWrite(Switch,LOW);}//关闭水阀
  }
  delay(500);
}
七、外观设计
八、成品展示
  • 花絮记录
    在这里插入图片描述
    在这里插入图片描述
总结
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Naiva

你的鼓励将是我创作的最大动力!

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值