How to guarantee the time delay in monitoring the keyboard?

Hello all,

In psychopy, for example, when you push a button, how is the delay between your pushing action and computer monitoring the real keyboard event due to the impact of different time slice scheduling? Is there any influence on time recording when you use the Clock in psychopy? (i.e. Will the recoding time of clock be different on different computers? Or will the delay caused by the clock have an impact on the experimental results at the level of 100 milliseconds?)

I would be appreciated if anyone can help.

1 Like

Thanks Mike.

Since the delay can not be reduced, what if I use a CED device to control the clock via serial communication? Then all the events will be recorded via the generation by crystal oscillator, so as to reduce the delay as soon as possible, because of that delay of millisecond level in neural signal is unacceptable. What do you think of this measure? If it is worth trying, I’ll go implement it.

I have to confess I don’t know what a CED is.

You can get around a lot of the problem simply by not using a consumer grade keyboard, with its unknown lag and variability, and instead use dedicated hardware like the Millikey from LabHackers:

https://www.labhackers.com/millikey.html

This is relatively affordable and almost certainly a better option than trying to implement your own solution. But I’m not really sure what your particular concerns are. With careful programming, and good hardware, you can achieve precision and lag values that are completely dwarfed by the physiological variability of the response you are measuring, and by the relatively slow screen refresh rate of most displays.

Going back to your original question, if you use the new Keyboard class in PsychoPy, rather than the older event module for detecting key presses, then the lag between the key press and detecting it will be in the millisecond realm (subject to using quality hardware, rather than a regular keyboard).

1 Like

Thanks again for your effort Mike.

Using a special keyboard button seems a reasonable method. I’ll try as you suggested. I’m sorry I didn’t explain the CED. CED(Cambridge Electronic Design Limited) is a kind of electrophysiological experiment device which has multiple electrodes input and output for data collection analysis and data interface. And you are right that in behavioral level, the delay caused by PsychoPy can be ignored. So we will consider how to combine and synchronize PsychoPy with neural signal collection software.

Thanks again.
Best regards