Got the sensor up and running by using:

  • Arduino Micro
  • PAA5100JE

Connecting it like this:

PAA5100JEArduino
3-5V3V
CSDigital 4
SCKSCK
MOSIMO
MISOMI
INT-
GNDGND

Arduino code for PAA5100JE
//This code is taken directly from the github page linked below.

#include "Optical_Flow_Sensor.h"

// param #1 digital pin 4 for chip select
// param #2 sensor type either PAA5100 or PMW3901 
Optical_Flow_Sensor flow(4, PAA5100);

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

  if (!flow.begin()) {
    Serial.println("Initialization of the flow sensor failed");
    while(1) { }
  }

}

int16_t deltaX,deltaY;

void loop() {
  // Get motion count since last call
  flow.readMotionCount(&deltaX, &deltaY);

  Serial.print("X: ");
  Serial.print(deltaX);
  Serial.print(", Y: ");
  Serial.print(deltaY);
  Serial.print("\n");

  delay(100);
}

Used code from GitHub to test the connections, and got this result:


Also got a code to work that measures movement of surface or object within 3mm of the sensor in X- and Y-directions (deltax,deltay). This data is quite good and could be used to measure how one surface moves, but would like for it to see difference between two surfaces without needing two sensors placed on the surfaces.

Spent time making plots of movement in python, before exploring ways of using optical flow to capture movement in video using Lucas-Kanade approach. 

Results of plotting of random movements in front of sensor:

Lucas Kanade (sparse), general dense optical flow and sparse optical flow are all explored now. 


  • No labels