flood's input lag measurements

Everything about latency. Tips, testing methods, mouse lag, display lag, game engine lag, network lag, whole input lag chain, VSYNC OFF vs VSYNC ON, and more! Input Lag Articles on Blur Busters.
Kulagin
Posts: 37
Joined: 27 Feb 2016, 08:17

Re: flood's input lag measurements

Post by Kulagin » 23 Aug 2017, 20:43

flood wrote:lol haven't checked this thread in a while
if i forget about this, pm spacediver and he can email me :P
spacediver wrote::)
So it's been almost a month. I couldn't catch flood online in Steam since he added me. Spacediver, could you email flood for me, please? It would be nice to have a free rig for tests :D

And could you please also give me access to send PMs on this forum? It says I can't do that:
Image

Kulagin
Posts: 37
Joined: 27 Feb 2016, 08:17

Re: flood's input lag measurements

Post by Kulagin » 23 Aug 2017, 20:56

So I finally made my own input lag tester based on Arduino Leonardo and LM393 light sensor(photoresistor):
Image

I wanted to keep it simple so I wrote a simple lag tester in HTML5:
http://plnkr.co/edit/Q8CzgCo451XKKFbdmJAH?p=preview

And code for Arduino:

Code: Select all

// Mouse - Version: Latest
#include <Mouse.h>

// light sensor pin
const byte lightSensorPin = 11;
// the number of the pushbutton pin
const byte buttonPin = 2;

// used in tests to get time when test starts
unsigned long startTime;
// used in tests to get time when sensor responded to pixel changes
unsigned long endTime;

// variable for reading the pushbutton state
bool buttonState = 0;

// variable for reading the light sensor state
bool newLightSensorState = 0;
// variable for storing previous state of light sensor
bool oldLightSensorState = 0;

void setup() {
  
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
  // initialize mouse
  Mouse.begin();
  
  // initialize the pushbutton pin as an input:
  pinMode(buttonPin, INPUT_PULLUP);
  // initialize light sensor pin as an input
  pinMode(lightSensorPin, INPUT);
  // initialize the LED pin as an output:
  pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
  // read the state of the pushbutton value:
  int buttonState = digitalRead(buttonPin);

  // check if the button is pressed. If it is, the buttonState is LOW:
  if (buttonState == LOW) {
    // turn LED on:
    digitalWrite(LED_BUILTIN, HIGH);
    
    oldLightSensorState = newLightSensorState; // store previous state of light sensor
    newLightSensorState = digitalRead(lightSensorPin); // get new state of light sensor
    
    
    //Serial.println(newLightSensorState);
    Mouse.press();
    startTime = micros();
    delay(0);
    // wait until sensor's state is changed
    while(newLightSensorState == 1 && buttonState == LOW)
    {
      oldLightSensorState = newLightSensorState; // store previous state of light sensor
      newLightSensorState = digitalRead(lightSensorPin); // get new state of light sensor
      buttonState = digitalRead(buttonPin);
      delay(0);
    }
    
    endTime = micros();
    Mouse.release();
    
    float responseTime = (endTime - startTime)/1000.0;
    Serial.print("startTime: ");
    Serial.print(startTime);
    Serial.print(", ");
    Serial.print("endTime: ");
    Serial.print(endTime);
    Serial.print(", ");
    Serial.print("responseTime: ");
    Serial.println(responseTime);
    delay(200);
  } else {
    // turn LED off:
    digitalWrite(LED_BUILTIN, LOW);
  }
}
 
How it works:
1. Put light sensor as close to LCD as possible. My sensor is in the top left corner of the monitor 3mm away from the display.
2. Open lag tester web app. I launch it locally in full screen(F11 key to go in full screen mode).
3. Press and hold a button(I use a toggle button) on Arduino, it will take motion to photon latency measurements every ~200ms until you release a button and print on the Monitor(analog of console.log in browsers) it through serial port.

That's just a prototype. I guess I'll try to make it to automatically gather data and save it to Google Spreadsheet or something.

Now I'll test all of these threads claiming they reduce input lag in video games Image

Few days ago I saw this video:
phpBB [video]


Looks like it is flood's video but I can't find this map anywhere. Can anyone help me to find this map?
Last edited by Kulagin on 23 Aug 2017, 22:22, edited 1 time in total.


Sparky
Posts: 682
Joined: 15 Jan 2014, 02:29

Re: flood's input lag measurements

Post by Sparky » 23 Aug 2017, 21:40

Kulagin wrote:So I finally made my own input lag tester based on Arduino Leonardo and LM393 light sensor(photoresistor):
Image

I wanted to keep it simple so I wrote a simple lag tester in HTML5:
http://plnkr.co/edit/Q8CzgCo451XKKFbdmJAH?p=preview

And code for Arduino:

Code: Select all

// Mouse - Version: Latest
#include <Mouse.h>

// light sensor pin
const byte lightSensorPin = 11;
// the number of the pushbutton pin
const byte buttonPin = 2;

// used in tests to get time when test starts
unsigned long startTime;
// used in tests to get time when sensor responded to pixel changes
unsigned long endTime;

// variable for reading the pushbutton state
bool buttonState = 0;

// variable for reading the light sensor state
bool newLightSensorState = 0;
// variable for storing previous state of light sensor
bool oldLightSensorState = 0;

void setup() {
  
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
  // initialize mouse
  Mouse.begin();
  
  // initialize the pushbutton pin as an input:
  pinMode(buttonPin, INPUT_PULLUP);
  // initialize light sensor pin as an input
  pinMode(lightSensorPin, INPUT);
  // initialize the LED pin as an output:
  pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
  // read the state of the pushbutton value:
  int buttonState = digitalRead(buttonPin);

  // check if the button is pressed. If it is, the buttonState is LOW:
  if (buttonState == LOW) {
    // turn LED on:
    digitalWrite(LED_BUILTIN, HIGH);
    
    oldLightSensorState = newLightSensorState; // store previous state of light sensor
    newLightSensorState = digitalRead(lightSensorPin); // get new state of light sensor
    
    
    //Serial.println(newLightSensorState);
    Mouse.press();
    startTime = micros();
    delay(0);
    // wait until sensor's state is changed
    while(newLightSensorState == 1 && buttonState == LOW)
    {
      oldLightSensorState = newLightSensorState; // store previous state of light sensor
      newLightSensorState = digitalRead(lightSensorPin); // get new state of light sensor
      buttonState = digitalRead(buttonPin);
      delay(0);
    }
    
    endTime = micros();
    Mouse.release();
    
    float responseTime = (endTime - startTime)/1000.0;
    Serial.print("startTime: ");
    Serial.print(startTime);
    Serial.print(", ");
    Serial.print("endTime: ");
    Serial.print(endTime);
    Serial.print(", ");
    Serial.print("responseTime: ");
    Serial.println(responseTime);
    delay(200);
  } else {
    // turn LED off:
    digitalWrite(LED_BUILTIN, LOW);
  }
}
How it works:
1. Put light sensor as close to LCD as possible. My sensor is in the top left corner of the monitor 3mm away from the display.
2. Open lag tester web app. I launch it locally in full screen(F11 key to go in full screen mode).
3. Press and hold a button(I use a toggle button) on Arduino, it will take motion to photon latency measurements every ~200ms until you release a button and print on the Monitor(analog of console.log in browsers) it through serial port.

That's just a prototype. I guess I'll try to make it to automatically gather data and save it to Google Spreadsheet or something.

Few days ago I saw this video:
phpBB [video]


Looks like it is flood's video but I can't find this map anywhere. Can anyone help me to find this map?
The map is earlier in this thread: http://forums.blurbusters.com/viewtopic ... 665#p15665

As for your test setup, can you measure the latency of your setup responding to the LED it illuminates? Is there any change if you delete those "delay(0);"s?

For saving stuff in a spreadsheet, I just output a CSV format over serial. Stupid simple, and any spreadsheet program can import it.

Kulagin
Posts: 37
Joined: 27 Feb 2016, 08:17

Re: flood's input lag measurements

Post by Kulagin » 23 Aug 2017, 22:56

Sparky wrote:As for your test setup, can you measure the latency of your setup responding to the LED it illuminates?
Yes, I was thinking about that, to determine the deviation. But I don't know what's the deviation of LEDs themselves, like, in what time range LEDs light up? Is it, let's say, 10.5-10.75 ms or is it 10-15 ms? Of course, different LEDs have different 'light up deviation'. So which one I would want to use to test deviation? There are like over9000 models of them.

In LM393 datasheet it says response time ~1.3 us. I've also read that if you go deep enough you can get Arduino to measure with a precision of 125 ns or something. I wanted to use TCS230 color sensor, it said in datasheet that it has 100 ns response time. But I couldn't find it in the local stores.
I think any deviation/latency below 1ms isn't that important, IMHO.
Sparky wrote:Is there any change if you delete those "delay(0);"s?
Yes, it glitches out for some reason and 50% of the time I get the same results as with delays but then I get 0 or 150-200% bigger number than average. So results would be something like: 0-55-0-56-0-57 or 56-101-58-102-57-101. Sometimes it would glitch out 1 time after another(glitched-normal-glitched-normal-glitched-normal) and sometimes it would glitch out only once in few measurements or multiple times in a row.
I thought it was a problem with Arduino code but as soon as I added delays bug disappeared.
I was trying to find my mistakes in the code for an hour or two and then I remembered all of that debouncing stuff and how they all recommend to wait a little after you take a measurement(or press a button). So I added little delays and it started working properly. I don't know why, I wanted to ask that on Arduino forums myself.
Sparky wrote:The map is earlier in this thread: viewtopic.php?p=15665#p15665
Thanks. Image

Sparky
Posts: 682
Joined: 15 Jan 2014, 02:29

Re: flood's input lag measurements

Post by Sparky » 24 Aug 2017, 05:31

Kulagin wrote:
Sparky wrote:As for your test setup, can you measure the latency of your setup responding to the LED it illuminates?
Yes, I was thinking about that, to determine the deviation. But I don't know what's the deviation of LEDs themselves, like, in what time range LEDs light up? Is it, let's say, 10.5-10.75 ms or is it 10-15 ms? Of course, different LEDs have different 'light up deviation'. So which one I would want to use to test deviation? There are like over9000 models of them.
10~15 milliseconds is really high, It should be more like tens of microseconds.

In LM393 datasheet it says response time ~1.3 us. I've also read that if you go deep enough you can get Arduino to measure with a precision of 125 ns or something. I wanted to use TCS230 color sensor, it said in datasheet that it has 100 ns response time. But I couldn't find it in the local stores.
I think any deviation/latency below 1ms isn't that important, IMHO.
That's just the response time of the comparator, not the whole sensor circuit.
Sparky wrote:Is there any change if you delete those "delay(0);"s?
Yes, it glitches out for some reason and 50% of the time I get the same results as with delays but then I get 0 or 150-200% bigger number than average. So results would be something like: 0-55-0-56-0-57 or 56-101-58-102-57-101. Sometimes it would glitch out 1 time after another(glitched-normal-glitched-normal-glitched-normal) and sometimes it would glitch out only once in few measurements or multiple times in a row.
I thought it was a problem with Arduino code but as soon as I added delays bug disappeared.
I was trying to find my mistakes in the code for an hour or two and then I remembered all of that debouncing stuff and how they all recommend to wait a little after you take a measurement(or press a button). So I added little delays and it started working properly. I don't know why, I wanted to ask that on Arduino forums myself.
Does that sensor board put any positive feedback/hysteresis into that comparator? It sounds like the measurement is changing state when it shouldn't.
Also, you may be unintentionally synchronizing latency measurements to your refresh rate. Try making that 200ms delay a random delay between 100 and 300ms.

Also try replacing the delay(0); with delayMicroseconds(3);
delay(0); is about 5us, but not terribly consistent.

spacediver
Posts: 505
Joined: 18 Dec 2013, 23:51

Re: flood's input lag measurements

Post by spacediver » 24 Aug 2017, 12:21

Kulagin wrote:
flood wrote:lol haven't checked this thread in a while
if i forget about this, pm spacediver and he can email me :P
spacediver wrote::)
So it's been almost a month. I couldn't catch flood online in Steam since he added me. Spacediver, could you email flood for me, please? It would be nice to have a free rig for tests :D

And could you please also give me access to send PMs on this forum? It says I can't do that:
Image
I've just emailed flood. As for PM access, I'll contact Mark and ask him if he can get you access.

spacediver
Posts: 505
Joined: 18 Dec 2013, 23:51

Re: flood's input lag measurements

Post by spacediver » 24 Aug 2017, 12:25

so you need 5 posts for PM access. You're just one away :)

br00m
Posts: 28
Joined: 19 Apr 2017, 15:03

Re: flood's input lag measurements

Post by br00m » 05 Sep 2017, 15:51

Im very interested in how far my feeling that 1.6 is more responsive than csgo is a placebo. Could anyone or maybe even flood himself explain the provided data on the first page (https://docs.google.com/spreadsheets/d/ ... =207953886) to me? Under best conditions whats the lowest input lag for csgo and 1.6? the way i read the data, csgo has an average input lag of 6.5ms and cs 1.6: 2ms.

spacediver
Posts: 505
Joined: 18 Dec 2013, 23:51

Re: flood's input lag measurements

Post by spacediver » 05 Sep 2017, 17:01

Broom, in the link you provided, I don't see any difference between CSGO and CS 1.6 - both show an input lag of ~2 ms when framerate is uncapped.

Post Reply