Arduino Latency Meter

A simple DIY Arduino-based device to measure the input-to-action latency in 3D games.

Public Chat
Similar projects worth following

Arduino Latency Meter

A simple DIY Arduino-based device to measure the input-to-action latency in 3D games.

1. How it works

a. It works differently

  • Unlike other common HW latency meters, this device doesn't measure a "click-to-photon" latency, but rather an "aim-to-photon" latency.
  • The device presents itself to the PC as a mouse, and sends a mouse movement (not a click!) message.
  • Once the message is sent, the device measures the time until the image on screen changes.

b. Advantages over other latency metering devices

  1. You don't need bullets to measure latency, so you never run out of ammo - you can (quickly) make as much measurements as you wish. As a result, the device can work autonomously to collect unlimited number of measurement samples, reaching a much higher accuracy.
  2. The measurement doesn't rely on the muzzle flash animation, which (depending on developer) may be rendered with a delay, producing incorrect results.
  3. You can measure latency in games that don't shoot guns (e.g. shoot arrows or explore)
  4. You don't need to place the device in the middle of the screen every time. It is unobtrusive enough that you don't even have to take it off.
  5. The device requires only one connected wire for operation.
  6. The device can even estimate the effective framerate - something the other devices cannot do.
  7. And of course, last but not least - the device is open source, cheap, and easy to make!

c. So what about the "click-to-photon"?

  • The device can also measure "click-to-photon" by appropriately modifying the software it's running, if one wanted to.

2. Building the device

  • See building instructions below in the "Instructions" section.

3. Device placement

  • The device should be placed at the top edge of the monitor, approximately in the middle. I mean, it is also possible to place the device in the corner (like I did in the photo at the top) - but it ended up being easier to find suitable measurement scenes if the device was placed in the middle - see a section called "choosing the right scene for measurement" below.
  • Attach a piece of Velcro to the top of the monitor bezel to hold the device.
  • IMPORTANT!!! Be careful with the USB connector on the board - it's rather flimsy and will break off if you try to apply torque force to it. This mostly happens when you try to unstick the device from the Velcro by pulling on the wire towards yourself. :) Consider yourself warned...

4. Operating the software

a. Programming the Arduino board

  • Download Arduino IDE from here:
  • Use it to open the script - ArduinoLatencyMeter.ino
  • Connect the board, use Tools -> Port to select the correct port
  • Select the "Arduino Micro" board from Tools -> Board -> Arduino AVR Boards -> Arduino Micro.
  • A word of caution: this specific board can be slightly bricked by selecting the board type incorrectly - but this shouldn't be possible with the current code. In any case, it can be unbricked as well, but it's a bit of a hassle.

b. Using the Arduino IDE to interact with the software

  • Once the board is programmed, open the serial monitor via Tools -> Serial Monitor. You should see a printout that looks something like this:

Here is what this means:

  • The latency meter - speedwise - is equivalent to a high-speed camera running at about 55,000fps.
  • To start the measurement with a delay (to have enough time to Alt-Tab to the target application) - enter the number of timeout seconds in the input edit box (the one just above the printout).
  • An alternative (and more convenient) way to start and stop the measurement is to push the wire on the board to close the circuit. This way you don't need to Alt-Tab.
  • It helps to have a secondary monitor - with the Arduino IDE running there - to see the measurements appear in real time.
  • Any serial terminal can be used instead of the Arduino IDE - once the board has been programmed.

c. Choosing the right scene...

Read more »

  • 1
    a. What you'll need

    You should be able to make 3 devices for $44.43, or just under $15 plus tax per device...

  • 2
    b. Prepare the light sensor
    • Cut a piece of shrink tube about 2 lengths of the sensor and and insert the sensor into it. Align the edges.

    • Use a lighter (or matches) to shrink the shrink tube (don't apply the flame directly - just hold it near the tube). Bend the leads as shown - make sure that the longer lead is on the right.

  • 3
    c. Solder the light sensor to the board
    • Insert the light sensor into contacts marked 4 and 6 , bend and solder as shown. Pay attention that the longer lead is still on the right. Do not cut the leads just yet!

    • Cut only the left lead. Add some solder to the stub to make it nicer. Bend the right lead onto the stub - this will serve as an activation button. The wire should not be touching the contact - there should be a tiny gap.

    • Note: if you soldered the phototransistor incorrectly (i.e. in reverse) - don't worry, there is a "#define REVERSE_PHOTOTRANSISTOR" in the code that can solve the problem

View all 4 instructions

Enjoy this project?



Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates