Arduino Latency Meter for Gaming

Eugene Fainstain's Pro Micro-powered device measures movement inputs versus on-screen results.

JeremyCook
about 2 years ago Gaming

When playing video games or performing other computing-intensive operations, lag time is critical. It’s easy enough to get the screen refresh rate in FPS, or measure network latency in ms, but what about the time it takes between a button input and action on the screen? The Arduino Latency Meter by Eugene Fainstain aims to answer this question once and for all, acting as an HID mouse input and measurement device.

Hardware-wise, the setup is extremely simple. It uses a Pro Micro to move the cursor from a dark on-screen area to a light area, then measures the change via a phototransistor straddling two IO pins. Velcro allows the device to attach to the top edge of a monitor, and the cursor must be initially positioned so that it gets moved between sufficiently dark and light areas.

Cleverly, the start button is formed by leaving one phototransistor lead long and bending it between two GPIO pins. A bit of pressure then completes the circuit for initialization.

Once activated, the Pro Micro outputs latency information to the serial port, showing the user how long it takes between a mouse movement and the results showing up. Results are averaged together, and the screen's framerate is estimated based on the randomness of latency measurements.

Of course, you might question when movements are registered in the game versus when they become visible, or consider the hardware and software factors that affect this latency reading at the Arduino level. So besides giving you gaming stats, the build is a great illustration of the finesse and judgement required when making precision measurements.

Code for the project is available on GitHub if you want to create your own and/or get into the measurement weeds!

JeremyCook

Engineer, maker of random contraptions, love learning about tech. Write for various publications, including Hackster!

Latest Articles