# Configuration of MRI button box to record subject response

**URL:** <https://psychtoolbox.discourse.group/t/configuration-of-mri-button-box-to-record-subject-response/5273>\
**Category:** Hardware\
**Tags:** windows, linux, macos, io\
**Created:** [February 26, 2024, 10:08am UTC](https://psychtoolbox.discourse.group/t/configuration-of-mri-button-box-to-record-subject-response/5273 "2024-02-26T10:08:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Henrike96](https://avatars.discourse-cdn.com/v4/letter/h/7993a0/32.png) [@Henrike96](https://psychtoolbox.discourse.group/u/Henrike96)\
**Post date:** [February 26, 2024, 10:08am UTC](https://psychtoolbox.discourse.group/t/configuration-of-mri-button-box-to-record-subject-response/5273/1 "2024-02-26T10:08:20Z")

</div>

Dear community,  
I am trying to record subject responses with a MR compatible Current Designs button box. The software I am using is PTB 3.0.18, MATLAB 2016b, and Windows 10.  
I am using the KbCheck() function and have tried several device numbers as arguments in the KbCheck function including -1. Still, no response is recorded.  
The button box is properly connected to the PC as it can write output into the console when buttons are pressed. It just seems that it is not recognized as an input device.

Any help is greatly appreaciated!

---

<div class="post-metadata">

**Author:** ![keith](https://avatars.discourse-cdn.com/v4/letter/k/f05b48/32.png) [@keith](https://psychtoolbox.discourse.group/u/keith)\
**Post date:** [February 26, 2024, 1:56pm UTC](https://psychtoolbox.discourse.group/t/configuration-of-mri-button-box-to-record-subject-response/5273/2 "2024-02-26T13:56:23Z")

</div>

Hi Henrike,

Make sure to set your fORP box to “no auto-release” mode. Otherwise, when you press the button, the keypress is released automatically and quickly. The way that KbCheck() works is that it returns the keys that are down the instant it is called. You are just missing the keypresses because they happen so fast.

Keith

---

<div class="post-metadata">

**Author:** ![mariokleiner](https://avatars.discourse-cdn.com/v4/letter/m/13edae/32.png) [@mariokleiner](https://psychtoolbox.discourse.group/u/mariokleiner)\
**Post date:** [February 28, 2024, 2:59pm UTC](https://psychtoolbox.discourse.group/t/configuration-of-mri-button-box-to-record-subject-response/5273/3 "2024-02-28T14:59:59Z")

</div>

Also, as I’ve answered the same/similar question as part of paid support to a Linux user just last night, find various better / higher precision ways of doing it under the following link:

> <https://github.com/Psychtoolbox-3/Psychtoolbox-3/issues/828>
>
> \*\*\[For commercial support for bug reports, click this link\](https://www.psychtoo…lbox.net/license-key)\*\*
> 
> \*\*Describe the bug\*\*
> With ~75% probability, a while-loop using \`KbCheck(-3)\` fails to recognize a roughly ~10ms-long keypress trigger sent by a \[Current Designs 932\](https://www.curdes.com/fiu-932b.html). In an event-related fMRI design, this means we are 1 TR off from the experiment script's logs of when the events occurred. We're trying to nail down why this is happening. We don't seem to recall this happening on 2014 Matlab running on MacOS on our previous scanning set up, and this isn't as significant of a problem for block design studies, but for event-related design our modeling would be thrown off. What's worse is this happens stochastically, and we don't know why.
> 
> Here's the snippet:
> \`\`\`matlab
> % Define keys
> KbName('UnifyKeyNames');
> ESCAPE\_KEY = KbName('ESCAPE');
> TRIGGER\_KEY = \[KbName('=+'),KbName('+')\];
> 
> %% GET TRIGGER FROM SCANNER
> fprintf('\\n------------- WAITING FOR TRIGGER\\n');
> while 1
> \[keyIsDown, seconds, keyCode\] = KbCheck(-3);
> if keyCode(ESCAPE\_KEY)
> Screen('CloseAll');
> error('Experiment quit by pressing ESCAPE\\n');
> break;
> elseif ismember(find(keyCode,1),TRIGGER\_KEY) %keyCode(KbName(TRIGGER\_KEY))
> % After the trigger, get the onset of this run
> run\_start\_time = GetSecs;
> break
> end
> end
> 
> fprintf('\\n------------- TRIGGERED! STARTING RUN! Run onset %f\\n', run\_start\_time)
> \`\`\`
> 
> \*\*To Reproduce\*\*
> Steps to reproduce the behavior:
> 1. Run while-loop and wait for trigger
> 2. Observe the light on Current Devices 932 interface box when trigger is sent
> 3. Observe if script triggers at the exact same time, or at the next trigger (in our case, 1 TR = 2000ms later)
> 
> 
> \*\*Expected behavior\*\*
> Trigger at each pulse sent by the Current Devices 932 interface box.
> 
> \*\*Screenshots\*\*
> If applicable, add screenshots to help explain your problem.
> 
> \*\*Desktop (please complete the following information):\*\*
> - OS: Ubuntu 22.04.3
> - Runtime: Matlab R2021b
> - Graphics: renoir
> - Hardware: AMD Ryzen 7 pro 4750u with radeon graphics; ThinkPad T14s Gen 1
> - Version: Psychtoolbox 3.0.18
> 
> cc: @gretatuckute

Limitation is on Windows that regular keyboards (experimenter, subject) and such keyboard like response boxes can not be distinguished and treated separately due to MS-Windows operating system limitations.

---

<div class="post-metadata">

**Author:** ![Henrike96](https://avatars.discourse-cdn.com/v4/letter/h/7993a0/32.png) [@Henrike96](https://psychtoolbox.discourse.group/u/Henrike96)\
**Post date:** [February 29, 2024, 12:24pm UTC](https://psychtoolbox.discourse.group/t/configuration-of-mri-button-box-to-record-subject-response/5273/4 "2024-02-29T12:24:56Z")

</div>

Hey Keith, thanks so much that has solved the issue!
