Home CodeArduino PAJ7620 gesture sensor and micro:bit example

PAJ7620 gesture sensor and micro:bit example

by shedboy71

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

 

Schematics/Layout

 

microbit and PAJ7620

microbit and PAJ7620

 

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_UP_FLAG !
GES_BACKWARD_FLAG !
GES_UP_FLAG !
GES_UP_FLAG !

 

Links

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

You may also like

Leave a Comment