You are here: Home » Wiki » MRI » Teensy Box

Teensy Box

Inspired by the excellent Wiki page of the Stanford university and the pages of Chris Rorden's Neuropsychology Lab Chris Rorden's Neuropsychology Lab we built our own Teensy Boxes to convert the TTL signals from the MR scanner and the response to a more useful one.


Via USB cable the Teensy Box is connected with your stimulus PC / Laptop and will be recognized as USB HID keyboard without driver installation (Windows, Mac OS, Linux). We use a Teensy board programmed using a simple teensyduino sketch. All variants listen for input pulses from the MR scanner and for pulses from the response buttons. The input is converted to keyboard events:

MR Trigger


Response Button 1


Response Button 2


Response Button 3


Response Button 4


Teensy Boxes are offered at the following devices:

7T Magnetom

The Teensy Box at the 7T (Siemens) only has the standard features.


3T Achieva dStream

The Teensy Box at the 3T Achieva dStream (Philips) has an LCD display, an SD card slot and a rotary knob. Please hold the knob and plug in the USB cable to enter the configuration menu. In the menu you can choose the 'Covilex type':

  1. Covilex 1.x, Standard behavior as mentioned above
  2. Covilex 2.x, Store dynamic response data on SD card (csv file). In addition values above 'button threshold' will be converted into key events ('1', '2')
  3. Simulation mode. Send a 't' every 'Simulation TR'

'Save settings' will save the actual settings permanently in the EEPROM.

'QUIT' will use the current settings. After restart the saved settings will be used.

IMG_20140619_101941.jpg IMG_20140619_134527.jpg


The acquisition of the dynamic data will wait for the first MR trigger. To simulate a trigger, push the button. The button will also start the simulation in simulation mode.

To stop the acquisition / simulation, push the button again.

During the experiment the trigger and responses are displayed and counted. In case of dynamic data, the response is plotted in real time.

Emulation of parallel port

The Teensy Box can emulate a parallel port to send event codes to other modalities (e.g. EEG) via serial port. To use this feature you need a driver for your OS.

This feature is only available in Covilex 1.x mode.

Disconnect the Covilex 2.x Box and connect the D-SUB 25 cable with e.g. your EEG system. Enable 'EV code' (1) in the configuration menu.

Configure your software to use the serial port as output port (Linux: /dev/ttyACM0. Windows: our stimulation PC: COM9)

Any event code will now send to the parallel port with a default speed of 2 kHz.

Recording button press duration / FlipFlop option

For measuring button press duration the menu option "FlipFlop" has to be set to 1. This will enable recording both button press and release with two separate events.

FlipFlop option
The FlipFlop option is accessible from the menu and offers two modes.

  • Mode 0: Original behavior, transmitting only the event of button press (not release) via USB.
  • Mode 1: Both button press and release events are transmitted to enable recording button press duration.

See table below for detailed event codes.

Response buttonPress event codeRelease event code
1 1 5
2 2 6
3 3 7
4 4 8
Using PsychtoolBox under Linux

For using the TeensyBox as keyboard device in PsychtoolBox, please use USB-ID 6, as shown exemplary in source code snippet below:

[keyboardIndices, productNames, allInfos] = GetKeyboardIndices;
deviceid = keyboardIndices(6);

Other sites

DZNE Magdeburg: Verio

We built a Teensy Box for the 3T Verio (Siemens) at the DZNE in 2013. It has the standard features and a button to simulate a trigger.


DZNE Magdeburg: TMS

We built a Teensy Box for the Transcranial magnetic stimulation system at the DZNE in 2014. Any event code sent via serial port by the stimulation software will produce a TTL signal. Each TTL signal triggers a TMS pulse.

Umeå University, Sweden: 3T GE

We built a Teensy box for a 3T GE scanner to convert the MR trigger in 2014.


Institute for Neurology, Magdeburg: 3T Prisma

We built a Teensy Box for the 3T Prisma (Siemens) similar to the Verio version without button in 2014.


Magdeburg: 3T Skyra

We built a Teensy Box for the 3T Skyra (Siemens) similar to the Verio version in 2015.