I'm wanting to build a computer keyboard-to-display lag measuring tool using an Ardunio:
- User places the photosensor right-up to their computer monitor.
- User presses a button on the Ardunio.
- The button press starts a high-resolution timer on the Arduino and also sends-out a USB HID mouse-move event to the computer.
- Using mouse-move events means the computer would use the hardware cursor which eliminates the frame (16ms) of lag caused by using desktop composition in most modern desktop computer operating-systems.
- The mouse cursor on the display itself would be pre-positioned so be directly visible by the photosensor, so when the mouse-move event is handled the color of the pixels where the mouse is would change.
- The Arduino then looks for changes in photosensor output that would indicate the mouse cursor (or rather: display pixels) had changed and then report the timer readings to determine end-to-end lag.
My thought was to set my mouse-cursor to be a big black cursor over a white background and use a simple photoresistor, but I learned that photoresistors have a physical lag up to 10ms from dark-to-light and up to 1000ms for light-to-dark which may make it unsuitable for my application where I'd like to reliably measure end-to-end lag within 1ms - so using a photoresistor is probably not appropriate.
My fall-back idea is to use the Ardunio to fire off a USB event while simultaneously lighting an LED directly attached to the Arduino board (so there should be effectively zero latency between pressing the button and the light coming on) and then using my iPhone's 240fps camera (4.2ms resolution) to record the time between the LED being lit and my computer display changing. As I run it at 60Hz, a 4.2ms resolution is (barely) sufficient - but ideally I'd like sub-1ms measurements.
- Would a photocell like this begin to change its output within 1ms of detecting a change or would the signal be too noisy or meaningless without waiting the 10ms (for dark-to-light changes).
- What other sensors could be used to detect any change in light (either light-to-dark, dark-to-light, color changes, etc) with minimal latency such that an Ardunio could detect the change within 1ms of it happening in real-life?