Trackpad gesture recognition

Hi

Is there any way that Arduino can be used for simple single touch gesture recognition (Swipe right, swipe left, swipe up, swipe down, single tap, double tap,.. )? The input comes from a laptop trackpad connected using PS2mouse library.

Thanks

Perhaps. What electronic signal is produced?

Paul

Paul_KD7HB:
What electronic signal is produced?

Paul

The trackpad sends the position of the mouse pointer (x, y coordinates) in realtime via P/S2.

glamis:
The trackpad sends the position of the mouse pointer (x, y coordinates) in realtime via P/S2.

Ok. I don't know what that means. What would your Arduino see?

Paul

Paul_KD7HB:
What would your Arduino see?

The trackpad is using PS/2 protocol to communicate with the Arduino. I'm using Adafruit-PS2-Trackpad library (GitHub - adafruit/Adafruit-PS2-Trackpad: PS2 library for Adafruit capacitive trackpads) to parse the incoming data. I don't know how the how the low level working principle of PS/2. However it transmits data through Clock and Data pins.

The library is initialized as follows :

#include <Adafruit_PS2_Trackpad.h>

// PS2 uses two digital pins
#define PS2_DATA 2
#define PS2_CLK 3

Adafruit_PS2_Trackpad ps2(PS2_CLK, PS2_DATA);

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

The library parses the incoming data and outputs (x,y) coordinates corresponding to the position of pointer (according to where its being touched) and the finger pressure values

void loop() {
  delay(25);

  if (! ps2.readData()) return;

  Serial.print("X = "); Serial.print(ps2.x, DEC); Serial.print("\t");
  Serial.print("Y = "); Serial.print(ps2.y, DEC); Serial.print("\t");
Serial.print("pressure = "); Serial.print(ps2.z); 
}

What I'm looking for is a method/function that when given a series of inputs (x,y,pressure) measured when finger slides over the track-pad, recognizes if the data points correspond to a given gesture.

Paul_KD7HB:
I don't know what that means

I don't know if my explanation is clear enough. I don't have a very deep knowledge of the low-level PS/2 protocol and solely rely on the Adafruit library.

glamis

Looks like your program prints out the coordinates. Do a bunch of swipes and see if you can see a pattern. If so, you can make a determination of what they mean and then code it.

Paul