| Literature DB >> 33852129 |
Stefan Appelhoff1, Tristan Stenner2.
Abstract
Modern experimental research often relies on the synchronization of different events prior to data analysis. One way of achieving synchronization involves marking distinct events with electrical pulses (event markers or "TTL pulses"), which are continuously recorded with research hardware, and can later be temporally aligned. Traditionally, this event marking was often performed using the parallel port in standard personal computers. However, the parallel port is disappearing from the landscape of computer hardware, being replaced by a serial (COM) port, namely the USB port. To find an adequate replacement for the parallel port, we evaluated four microcontroller units (MCUs) and the LabJack U3, an often-used USB data acquisition device, in terms of their latency and jitter for sending event markers in a simulated experiment on both Windows and Linux. Our results show that all four MCUs were comparable to the parallel port in terms of both latency and jitter, and consistently achieved latencies under 1 ms. With some caveats, the LabJack U3 can also achieve comparable latencies. In addition to the collected data, we share extensive documentation on how to build and use MCUs for event marking, including code examples. MCUs are a cost-effective, flexible, and performant replacement for the disappearing parallel port, enabling event marking and synchronization of data streams.Entities:
Keywords: Event marking; Open-hardware; Parallel port; TTL; Trigger; USB
Mesh:
Year: 2021 PMID: 33852129 PMCID: PMC8613091 DOI: 10.3758/s13428-021-01571-z
Source DB: PubMed Journal: Behav Res Methods ISSN: 1554-351X
Fig. 1Testing setup. a Setup of the hardware. b Schematic representation of the signal time courses. For both panels, (1) the Teensy 3.2 keyboard simultaneously sends a key press to the PC and a TTL pulse to the LabStreamer; the PC receives the key press and sends (2) a timestamped LSL trigger via the network (marking timepoint zero), and (3) TTL pulse via the microcontroller (MCU), LabJack U3 (LU3), or parallel port (par) to the LabStreamer. This yields the latency of the tested device (b)
Latencies for all tested devices in milliseconds. The table includes an entry for the Teensy 3.2 device that simulated a keyboard in the test setup. Its latency is negative because the simulated keystroke happened prior to the timepoint zero (the LSL Trigger, cf. Fig. 1)
| Operating system | Device | Mean | SD | Median | IQR |
|---|---|---|---|---|---|
| Linux | Teensy 3.2 Keyboard | – 1.650 | 0.410 | – 1.672 | 0.574 |
| Linux | Parallel Port | 0.212 | 0.032 | 0.211 | 0.05 |
| Linux | Teensy 3.2 | 0.244 | 0.032 | 0.243 | 0.049 |
| Linux | Teensy LC | 0.254 | 0.032 | 0.255 | 0.052 |
| Linux | LabJack U3 (writeRegister) | 0.280 | 0.039 | 0.279 | 0.054 |
| Linux | Arduino Leonardo | 0.308 | 0.036 | 0.308 | 0.052 |
| Linux | Arduino Uno | 0.453 | 0.045 | 0.452 | 0.05 |
| Linux | LabJack U3 (setFIOStatus) | 0.616 | 0.120 | 0.603 | 0.057 |
| Windows | Teensy 3.2 Keyboard | – 1.756 | 0.334 | – 1.751 | 0.503 |
| Windows | Parallel Port | 0.210 | 0.030 | 0.209 | 0.049 |
| Windows | Teensy 3.2 | 0.296 | 0.030 | 0.296 | 0.05 |
| Windows | Teensy LC | 0.319 | 0.033 | 0.319 | 0.05 |
| Windows | Arduino Leonardo | 0.352 | 0.032 | 0.353 | 0.05 |
| Windows | LabJack U3 (writeRegister) | 0.439 | 0.287 | 0.401 | 0.082 |
| Windows | Arduino Uno | 0.505 | 0.031 | 0.507 | 0.051 |
| Windows | LabJack U3 (setFIOStatus) | 1.144 | 0.099 | 1.157 | 0.158 |
SD standard deviation, IQR interquartile range
Fig. 2Raincloud plot (Allen et al., 2021) of TTL pulse latencies for the parallel port, all tested MCUs, and the LabJack U3. The LabJack U3 was tested using two different methods; (i) through the standard LabJack setFIOState method, and (ii) through writing data directly to the register with the writeRegister method. Under Windows, the LabJack U3 (writeRegister) had 11 more measurements between 2.3 and 7 ms that are not shown in the figure (mean = 4 ms), as indicated with the red asterisk