Measuring time between two separate events (input lag)

I'm new to Arduino, and I have a project idea and I'd like to get some advice. My plan involves a computer racing game which requires split-second driver reactions to get the best performance, but some computer configurations or software settings cause a disinct lag between driver inputs (e.g. turning the steering wheel) and the resulting observed movement of the wheel on the screen. With some settings (such as vertical refresh sync) the lag between driver inputs and the movements displayed on the screen are noticeably delayed, and this invariably results in poorer driving and often losing control.

I'd like to measure this lag by setting up some sort of trigger on the wheel and another on the wheel displayed on the screen. I want to avoid tapping into the computer inputs so as to minimize the impact of the observation on the lag, so I am thinking of having the input trigger as a simple photocell with an LED on the wheel which would trigger the photocell when the wheel reaches a specific angle. The wheel shown on the screen has a bright red piece of tape at the 12 o'clock position. I thought I could set up a photocell in front of the monitor to trigger when the tape rotates to the position which correponds to the same angle triggered by the input trigger.

At 60 Hz display rate, the minimum delay between the triggers would probably be ~17ms. It would be great to set up either a USB output to a separate computer to log the delay, or use an LED display to show the time lag in milliseconds. I think with V-sync it could go up to 100+ms.

Perhaps there are better ways to configure such a test, or perhaps this kind of thing has been done before. Any help or advice is appreciated.

Use the Arduio interrupt to get the two timings. - -

If you got two times you can calc the delay...

Maybe a photo transistor taped to the screen and similar (with some silver tape and a LED) on the steering wheel.

Record the time that the steering wheel input goes low (or high depending on how it's wired) then start recording the times of pulses coming from the screen.

When you stop getting screen pulses the last time recorded minus the steering wheel time is the delay. This will not be very accurate though due to the 17mS timing of the screen scan line pulses.


Thanks people - I'll probably need more guidance later on when I get into the guts of the project, but at least now i have a better idea of what I'm going to do. Thanks!