Accuracy of MOCH22A based Infrared Speed Sensor Module

I do not use fork type light barriers for speed measurements in Motor test station anymore. Instead I do 90fps 640x480 videos with Raspberry Pi Zero from above and count the number of frames per round by single frame stepping the taken video. Knowing the robot diameter speed can be calculated easily from that.

Recently I found a fidget spinner for less than 1$ with free shipping and ordered it:

I wanted to know what that is, and do some measurements with it. I remembered the sensor this thread is about, and found it still superglued to the 9V block battery as in times of Motor Test Station. I superglued a little piece of white plastic to the spinner so that interrupts get generated:

Next I modified the code posted here before a bit:

#include "bitlash.h"

#define mx 10

int cnt=0;
unsigned long t0, tl=0, t; // board start
unsigned long dt=50;  // minimal dt for rising->falling

void change(void) {
  if (cnt<mx)
  {
    t = micros();
    
    if ( !digitalRead(3) && (t-tl > dt) ) {
        cnt++;
        if (cnt==mx) {
          tl = t;
          Serial.println( 1000000.0*cnt/(tl-t0) );
        }
    }
        
    tl = t;
  }
}

void resetVarA(void) {
    t0=micros();
    cnt=0;
}

void setup(void) {
    initBitlash(57600);		// must be first to initialize serial port

    addBitlashFunction("re", (bitlash_function) resetVarA);

    attachInterrupt(digitalPinToInterrupt(3), change, CHANGE);
}

void loop(void) {
    runBitlash();
}

I did run the fidget spinner several times, record was 25.09rps or 1505.4rpm:

bitlash here! v2.0 (c) 2013 Billbitlash here! v2.0 (c) 2013 Bill Roy -type HELP- 916 bytes free
> 10.20
re
> 11.19
re
> 11.46
re
> 9.67
re
> 19.59
re
> 25.09
re
> 16.57

Now knowing that rps value is below 90 would have allowed to measure with 90fps Raspberry video as well. But the spinner sounded as if much more speed was possible (maybe it is and I don't have the best technique to kick the spinner).

Hermann,