Home Code Arduino Uno and PAJ7620 gesture sensor example

Arduino Uno and PAJ7620 gesture sensor example

by shedboy71

In this example we connect a PAJ7620 gesture sensor to an Arduino Uno

The PAJ7620 integrates gesture recognition function with general I2C interface into a single chip forming an image analytic sensor system. It can recognize 9 human hand gesticulations such as moving up, down, left, right, forward, backward, circle-clockwise, circle-counter clockwise, and waving.

It also offers built-in proximity detection in sensing approaching or departing object from the sensor. The PAJ7620 is designed with great flexibility in power-saving mechanism, well suit for low power battery operated HMI devices.

The PAJ7620 is packaged into module form in-built with IR LED and optics lens as a complete sensor solution.

Gesture Mode : Single-Object Detection
Image Array Size : 60 x 60
Sampling Rate : 240fps
Operating Distance : 20cm
Output Types : 9 types of Gestures: Up, Down, Left, Right, Forward, Backward, Circle-Clockwise, Circle-Counter Clockwise, and Waving)
Cursor Mode : Yes
Interface : I2C/SPI
Light Source : Integrated IR LED with optics

 

Parts List

name Link
Arduino Uno UNO R3 CH340G/ATmega328P, compatible for Arduino UNO
PAJ7620 breakout CJMCU-7620 9 Gesture Moving Recognition Sensor Module PAJ7620U2 I2C 2.8V~3.3V SC
connecting wire Free shipping Dupont line 120pcs 20cm male to male + male to female and female to female jumper wire

Layout

An I2C device that uses 3.3v

 

Code

Again we use a library – https://www.elecrow.com/wiki/images/7/72/Paj7620.zip

[codesyntax lang=”cpp”]

#include <Wire.h>
#include "paj7620.h"

void setup()
{
Serial.begin(9600);
paj7620Init();
}

void loop()
{
uint8_t data = 0; // Read Bank_0_Reg_0x43/0x44 for gesture result.

paj7620ReadReg(0x43, 1, &data);

if (data == GES_UP_FLAG)
{
Serial.println("GES_UP_FLAG !");
}

if (data == GES_DOWN_FLAG)
{
Serial.println("GES_DOWN_FLAG !");
}

if(data == GES_FORWARD_FLAG)
{
Serial.println("GES_FORWARD_FLAG !");
}

if(data == GES_BACKWARD_FLAG)
{
Serial.println("GES_BACKWARD_FLAG !");
}

if(data == GES_RIGHT_FLAG)
{
Serial.println("GES_RIGHT_FLAG !");
}

if(data ==GES_LEFT_FLAG)
{
Serial.println("GES_LEFT_FLAG !");
}

}

[/codesyntax]

 

 

Output

Open the serial monitor – this is what I saw, move your hands in various directions

INIT SENSOR…
Addr0 =20, Addr1 =76
wake-up finish.
Paj7620 initialize register finished.
GES_BACKWARD_FLAG !
GES_BACKWARD_FLAG !
GES_FORWARD_FLAG !
GES_BACKWARD_FLAG !
GES_FORWARD_FLAG !
GES_BACKWARD_FLAG !
GES_UP_FLAG !
GES_DOWN_FLAG !
GES_UP_FLAG !
GES_DOWN_FLAG !

 

Links

http://www.pixart.com.tw/upload/PAJ7620U2_GDS_v1.0_29032016_20160623194552.pdf

Share

You may also like

Leave a Comment