Gestures have become a popular way to interact with devices, especially in applications involving home automation, robotics, and gaming. In this tutorial, we will learn how to interface the PAJ7620 gesture sensor with an Arduino Uno and use it to detect various gestures like up, down, left, right, and more. Let's dive into the details of setting up the hardware, writing the code, and testing the system.
What is the GY-PAJ7620 Gesture Sensor?
The PAJ7620 is a highly capable gesture recognition sensor. It can detect a wide range of gestures such as up, down, left, right, forward, backward, and more. The sensor uses an array of infrared LEDs and a photodiode array to detect motion in its field of view. It communicates with a microcontroller (like Arduino) over the I2C interface, making it a versatile option for many gesture-controlled applications.
Technical Specifications of PAJ7620 Gesture Sensor:
- Communication Interface: I2C (Supports 400kHz Fast Mode I2C communication)
- Power Supply: 2.4V to 3.6V (typically 3.3V), Current Consumption: 1.6mA (normal mode), up to 4mA (gesture detection)
- Gesture Recognition: Detects 9 gestures, including Up, Down, Left, Right, Forward, Backward, Clockwise, Counterclockwise, and Wave
- Detection Range: 10 cm to 30 cm (optimal), Field of View: 60° (horizontal) x 60° (vertical)
- Interrupt Pin: External interrupt pin (connect to microcontroller interrupt pin)
- Operating Temperature Range: -20°C to 70°C
- Sensor Technology: Infrared LED Array and Photodiode Array, built-in 3D accelerometer and infrared sensor
- Output: I2C Address: 0x73, outputs gesture data to microcontroller
- Features: Low Power Consumption, Normal and High-speed gesture detection modes, User-configurable sensitivity
- Sensitivity: Adjustable detection range, works well in indoor and moderate outdoor lighting
- Response Time: Gesture Recognition Time: < 100ms
Components Required:
-
PAJ7620 Gesture Recognition Sensor Module
-
Arduino Uno
-
Arduino Uno Programming Cable
-
Breadboard
-
Jumper Wires
Pinout and Connections for GY-PAJ7620 :
-
- VCC: Connect to the 5V pin on the Arduino.
- GND: Connect to the GND pin on the Arduino.
- SCL: Connect to the A5 pin on the Arduino (SCL for I2C communication).
- SDA: Connect to the A4 pin on the Arduino (SDA for I2C communication).
- INT: Connect to pin 2 on the Arduino (used for gesture detection interrupts).

Arduino GY-PAJ7620 Gesture Sensor Circuit Diagram:

Code Explanation:
#include <DFRobot_PAJ7620U2.h>
#include <Wire.h>
- Includes the necessary libraries:
DFRobot_PAJ7620U2.h
for interacting with the PAJ7620U2 gesture sensor andWire.h
for I2C communication.
#define GESTURE_INT_PIN 2
- Defines
GESTURE_INT_PIN
as pin 2, which will be used for the interrupt when a gesture is detected.