Video/Audio Delay Test Arduino Leonardo + TSL 2561 (Light Sensor) + OLED 1306 Display 128×64

About: I like electronic things :-)

As the discussion with the new The C64 Mini regarding the joystick delay got bigger and bigger, I wanted to know more about it. On YouTube you could watch some delay tests, which were made with the help of video recordings. What I wanted, however, was automatic electronics that showed me the time in milliseconds. For video and audio separately.

That's the reason for this Project. An universal “Delay Test” with an Arduino Leonardo board, an OLED Display and 2 Buttons.

How it works:

The principle is actually quite simple. Via an Arduino pin or the USB interface, a trigger signal (Digital Output High/Low A2 Pin, USB Joystick, USB Keyboard, USB Mouse or USB Midi) is sent from the Arduino board to the system, which activates the delay Test App and outputs a tone, as well as changing the background color from black to white. These signals are then transmitted to the Arduino Board via the audio cable and the light sensor and the time that has elapsed between the transmitted trigger signal and the incoming audio and light signal is measured. Hint: For an USB Midi Delay Test you do not need a delay test app on the target system. For this purpose, a midi sequencer is sufficient, which emits a sound on incoming midi signals, which is then measured by the Arduino board.

Step 1: What You Need

For this Project you need these parts:
  • 1 x Arduino Leonardo
  • 1 x TSL 2561 (Light Sensor)
  • 1 x OLED 1306 Display 128×64 (I2C)
  • 2 x Buttons
  • 1 x Audio Stereo Jack

Step 2: Build the Delay Test Machine

What you have to do:

  • Download the "DelayTest_Package_V2" file
  • Unzip the downloaded "DelayTest_Package_V2" file
  • Start the Arduino IDE In the Arduino IDE and select Arduino -> Preferences -> Sketchbook location: press "Browse" and select the unzipped folder, then press "Ok" Restart the Arduino IDE
  • Open the "DelayTest.ino" in the Arduino IDE and upload the Sketch into the Leonardo Board
  • Connect the OLED with the Arduino Pins: SCA, SCL, 3,3V, GND
  • Connect the TSL 2561 Sensor with the Arduino Pins: SCA, SCL, 3,3V, GND
  • Connect the Audio Jack Pins with the Arduino Pins (A0, GND)
  • Connect the 2 Buttons with the Arduino Pins (D11, GND, D12, GND)

Step 3: Use It!

How to use it:

  • Load the "c64delaytest.prg" into the C64
  • Connect Audio-Jack with the C64
  • Connect the Light Sensor with the C64 Monitor
  • Power Up the Arduino Board (connect the USB Port)

On the OLED Display you will see the Menu.

Here you can select the "Trigger" Element:

  • Arduino Pin
  • USB Joy Button
  • USB Key
  • USB Mouse
  • USB Midi Note

Go back to the Menu and select "Start Delay Test"

Now the Arduino Board will trigger a Signal in an endless Loop and is showing the Audio/Video Delay.


The same you can do with an Android Device or with a MacOS Computer. I have serval TestApps for this systems, but can not upload it here at, because the Upload script thinks it is a virus (DelayTest.apk). If you want to download them, you can do it from my Website:

Arduino Contest 2019

This is an entry in the
Arduino Contest 2019



    • Gardening Contest

      Gardening Contest
    • Fandom Contest

      Fandom Contest
    • IoT Challenge

      IoT Challenge