PAJ7620U2 Gesture Sensor

From Waveshare Wiki
Jump to: navigation, search
PAJ7620U2 Gesture Sensor
PAJ7620U2-Gesture-Sensor

PAJ7620U2 Gesture Sensor
{{{name2}}}

{{{name3}}}

{{{name4}}}

{{{name5}}}

Introduction

PAJ7620U2 Gesture Sensor,gesture recognition function with general I2C interface into a single chip.
It can recognize 9 gestures including move up, move down, move left, move right, etc with a simple swipe of your hand.

More

Features

  • Based on PAJ7620U2 sensor, directly recognizes 9 basic gestures, supports gesture interrupt output.
  • Embedded infrared LED and optical lens, be able to work in low-light even dark environment.
  • I2C interface, requires only two signal pins to control.
  • Onboard voltage translator, compatible with 3.3V/5V logic level.

Specification

  • Operating voltage: 3.3V/5V
  • Communication interface: I2C
  • Recognition distance: 5cm ~ 15cm
  • Supported gestures: up, down, left, right, forward, backward, clockwise, anticlockwise, shake
  • Recognition rate: 240Hz
  • Recognition angle: 60° (diagonal)
  • Ambient light immunity: <100k Lux
  • Dimensions: 20mm × 20mm
  • Mounting hole size: 2.0mm
  • Application: smart home, offices and teaching, human-robot interaction, gesture toys and domatosensory game equipment

Interface

PIN SYMBOL Description
1 VCC 3.3V/5V
2 GND Ground
3 SDA I2C data pin
4 SCL I2C clock pin
5 INT External interrupt pin

How to use it

We provide demo codes for easy testing, you can download the demo codes from #Resources

Unzip the archive downloaded to get the codes.

Raspberry Pi

  • Insert the Micro SD card of Raspberry Pi to the host PC.
  • Copy the RapberryPi folder to the boot directory of the micro SD card.
  • Start your Raspberry Pi with the Micro SD card.
  • You can find that the Raspberry Pi codes are saved in the BOOT directory.
PAJ-6.png
  • Copy the folder to the home directory
sudo cp -r /boot/RaspberryPi/ ./
sudo chmod 777 -R RaspberryPi/
cd RaspberryPi
PAJ-8.png
PAJ-9.png
Install libraries
  • BCM2835:
wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.64.tar.gz
sudo tar zxvf bcm2835-1.64.tar.gz
cd bcm2835-1.64
sudo ./configure
sudo make
sudo make check
sudo make install
  • Install wiringPi
sudo apt-get install git
sudo git clone git://git.drogon.net/wiringPi
cd wiringPi
sudo ./build
  • Install python
sudo apt-get install python-pip 
sudo pip install RPi.GPIO
sudo pip install spidev
sudo apt-get install python-imaging
sudo apt-get install python-smbus
sudo apt-get install python-serial
Enable I2C
sudo raspi-config
  • Choose Interfacing Options -> I2C -> Yes
Hardware connection

The colors of the wires may be different, please connect them according to the silk screen printing.

Gesture Sensor Raspberry Pi (Board) Raspberry Pi(BCM2835)
VCC 3.3V 3.3V
GND GND GND
SDA 3 P2
SCL 5 P3


PAJ7620U2-Pi-WS.jpg

Run the codes
  • BCM2835 codes
cd ~/RaspberryPi/bcm2835/
cd Gesture
sudo make
sudo ./PAJ7620U2
  • wiringPi codes
cd ~/RaspberryPi/wiringPi
cd Gesture
sudo make
sudo ./PAJ7620U2
  • Python codes
cd ~/RaspberryPi/python
cd Gesture			
sudo python PAJ7620U2.py
Expected result
  • Gesture detecting:
Program effect18.png
  • Object detecting:
Program effect 2.png

STM32 examples

The STM32 examples are based on Waveshare XNUCLEO-F103RB whose chip is STM32F103RB, HAL libraries.

Hardware connection

Connect the sensor to the STM32 board according to the table, then connect the USB to UART interface of the XNUCLEO board to the host PC.

Gesture Sensor STM32
VCC 3.3V/5V
GND GND
SDA PB9
SCL PB8


PAJ7620U2-STM32-WS.jpg

  • Open the project (STM32 demo codes) with Keil software
  • Compile it and program to board
Expectre result
  • Run serial assistance software, set baud rate to 115200
  • Gesture Detecting:
Stm-2.png
  • Obeject detecting:
Stm-3.png

Arduino

The demo codes provide is based on the Arduino UNO.

Hardware connection
Gesture Sensor Arduino
VCC 5V
GND GND
SDA SDA
SCL SCL


PAJ7620U2-Arduino-WS.jpg

  • Open the codes by Arduino IDE.
  • Compile and upload to Arduino Board.
Expected result
  • Gesture detecting
PAJ7620u2-17.png
  • Object detecting
PAJ7620U2-19.png

Resources

FAQ

Support

Support

If you require technical support, please go to the Support page and open a ticket.