Skip to main content

OpenSesame Plugin: Radboud Buttonbox

An OpenSesame plugin for the Radboud Buttonbox (BITSI): button responses, sound and voice key, and stimulus synchronization triggers to data acquisition systems.

Copyright (C) 2016-2026 Bob Rosbag

This plugin makes use of the RuSocSci python package developed by Wilbert van Ham. Radboud Buttonbox is developed by Pascal de Water. Exact references will follow in the future.

About

The Technical Support Group (Radboud University, Social Sciences) developed a USB Arduino based Buttonbox which can be used for time accurate (1ms) button press, voice key, sound key registration and sending parallel port like triggers. Upper case A, B, C, D, E (, F, G, H) are used for key presses, and lower case a, b, c, d, e (, f, g, h) are used for key releases. Uppercase S is used for sound key detection and uppercase V for voice key.

For more information:

https://tsgdoc.socsci.ru.nl/index.php/ButtonBox

This plugin consists of foreground and background (multithreaded) items.

Difference between foreground and background:

  • The foreground item registers buttons/signals until it detects an allowed button or the set duration has passed.
  • The background items are a 'start', a 'wait' and a 'stop' item. These are fully multi-threaded. After the start of the button/signal registration, the item will immediately advance to the next item. When the experiment reaches the 'wait' item, it will wait until a button/signal has been detected by the 'start' item or the duration has passed; the 'stop' item ends the registration right away.

This plugin has seven items:

  • radboudbox_init initialization of the buttonbox, this should be placed at the beginning of an experiment.
  • radboudbox_collect_buttons_fg (foreground) waits for a button press or release before continuing to the next item in the experiment.
  • radboudbox_collect_buttons_bg_start (background) starts a new thread which monitors for button presses/releases, it will directly advance to the next item in the experiment.
  • radboudbox_collect_buttons_bg_wait (background) waits until the thread from radboudbox_collect_buttons_bg_start is finished (has detected a button press/release) before advancing to the next item in the experiment.
  • radboudbox_collect_buttons_bg_stop (background) ends the thread from radboudbox_collect_buttons_bg_start right away (within 10 ms); the responses until then are logged. Use it instead of the wait item to end the registration at a moment of the experiment, or to end one without timeout.
  • radboudbox_send_control sends a control command to the buttonbox, for example 'Calibrate Sound' or 'Detect Sound'.
  • radboudbox_send_trigger sends a trigger to hardware with a parallel port, e.g. an EEG system.

Placing the background items. Put radboudbox_collect_buttons_bg_start and its radboudbox_collect_buttons_bg_wait or radboudbox_collect_buttons_bg_stop item in the same sequence, e.g. the trial sequence (one of them may be in a sequence inside it). When the start item runs, it checks that a wait or stop item has been prepared. OpenSesame prepares a sequence and the sequences in it before it runs them, but the item of a loop only when that loop runs. A start item outside a loop with its wait or stop item inside the loop therefore stops the experiment with the error that the wait or stop item is missing. At the end of the experiment, a collection that no wait or stop item ended gives a warning that its responses may be missing from the log file (also in dummy mode).

Renamed items (6.0.0). radboudbox_wait_buttons is now radboudbox_collect_buttons_fg, radboudbox_get_buttons_start is radboudbox_collect_buttons_bg_start and radboudbox_get_buttons_wait is radboudbox_collect_buttons_bg_wait. Experiments made with an older version open and run as they are, and OpenSesame saves them with the new item types; the names of the items, and so the variables in the log file, stay the same. An experiment saved with 6.0.0 or later needs 6.0.0 or later: an older version doesn't know the new item types (OpenSesame 4.1 then runs the experiment without these items, after a warning that a plugin is missing).

The time of a response is logged as time_response_[item_name].

Number of responses (radboudbox_collect_buttons_fg and radboudbox_collect_buttons_bg_start): the item collects up to this number of responses (the presses and releases in Allowed responses) within the timeout; infinite collects all of them until the timeout. The timeout is the time for all responses together. With infinite the timeout can be infinite too in radboudbox_collect_buttons_bg_start: a radboudbox_collect_buttons_bg_stop item then ends the registration (a radboudbox_collect_buttons_bg_wait item would wait forever, which is an error, and so is radboudbox_collect_buttons_fg while it runs); radboudbox_collect_buttons_fg needs a timeout. The first response is the response of the item (response_[item_name], response_time_[item_name], correct_[item_name] and time_response_[item_name]); all responses are logged in responses_[item_name] (e.g. A;a;B) and their timestamps in time_responses_[item_name] (in ms, the same clock as time_response_[item_name]), separated by ';' (None when there was none). The timestamp of a response is the moment the plugin reads it from the box, as for the first response: the box doesn't send times. The default, 1, collects one response, as the items did before.

Correct response and feedback (radboudbox_collect_buttons_fg and radboudbox_collect_buttons_bg_start): OpenSesame scores the response of the item against Correct response (correct_[item_name] and correct are 1 or 0) and counts it in its feedback variables (acc, avg_rt, total_responses, total_correct and total_response_time), as the responses of keyboard_response, so a feedback item shows them. Buttons are case sensitive: A is a press, a is its release. No response within the timeout is logged as None, as OpenSesame's own response items do; it is correct when Correct response is None (e.g. for no-go trials). In dummy mode a key also matches in the other case (a key press 'a' is correct for A), as in keyboard_response.

In dummy mode (an option of the Init item) the plugin runs without a buttonbox: the keyboard is used for button responses, and triggers and commands are not sent. radboudbox_collect_buttons_bg_start then waits for the key press itself, because the keyboard can't be read in the background (with number of responses and timeout infinite it collects one key, because nothing could end it).

Linux and Windows are supported (possibly also macOS, not tested). The plugin needs OpenSesame 4 (Python 3.10 or later) and the RuSocSci package, which is installed with it:

pip install opensesame-plugin-radboudbox

Buttonboxes

BITSI 2015 BITSI 2018
Board Arduino Duemilanove, FTDI USB (0403:6001) Teensy 3.6 (USB vendor 16C0)
Port on Linux /dev/ttyUSB*, /dev/serial/by-id/usb-FTDI_* /dev/ttyACM*
Simple mode hold A+H while connecting hold A+E while connecting
Extended mode hold B+H while connecting hold B+E while connecting

Firmware. The BITSI 2015 runs one of three firmware versions; the ID string it sends when it starts (extended mode) tells which:

Box Firmware ID string (extended mode)
BITSI 2015 2014 BITSI_extend mode, Ready!
BITSI 2015 2015-11-18 BITSI_extend mode, Ready! 2015-11-18
BITSI 2015 2018 BITSI_extend mode, Ready! w:2018
BITSI 2018 2018 (Teensy) BITSI_extend mode, Ready! w:2018

The sources of the 2014 and 2018 firmware, for the Duemilanove and the Teensy, are in the Buttonbox downloads of the TSG; the 2018 Duemilanove firmware uses the same pins as the 2014 firmware. The source of the 2015-11-18 firmware is not in these downloads.

Mode. The box stores its mode (simple or extended) itself. Bitsi Extended Mode in the Init item must match it: a box in the other mode sends wrong triggers. Init checks this with the ID string the box sends when it starts, and raises an error when the modes differ. When the ID string doesn't arrive in time, the mode can't be checked; there is a warning in the log.

Port. With port autodetect, Init takes the first buttonbox it finds (an FTDI, Arduino or Teensy USB device). Other USB serial devices, such as the serial port of an audio interface, are skipped. A Device id takes that position in the list of USB serial devices (0 is the device connected last). To choose a port yourself, set Port, e.g. /dev/ttyUSB0 or COM3.

Latency timer. The FTDI chip of the BITSI 2015 sends small amounts of data after its latency timer, 16 ms by default: button presses can then arrive up to 16 ms late. It must be 1 ms, and Init raises an error otherwise. On Windows, set it in the Device Manager (Ports, the COM port, Properties, Port Settings, Advanced, Latency Timer); it can change back, e.g. after a driver update. On Linux it is /sys/bus/usb-serial/devices/ttyUSB0/latency_timer; the chip starts at 16 ms each time it is connected, so set it permanently with a udev rule (Init's error gives the commands). On Linux the latency timer is the only setting: the USB transfer sizes are fixed in the driver, and the timeouts, the COM port number and the FIFO buffers of the BITSI 2018 exist only on Windows.

ModemManager (Linux). The Teensy of the BITSI 2018 says it takes modem commands, so ModemManager opens its port and sends modem commands to the box when it is connected. When ModemManager runs and no udev rule makes it ignore the box (ID_MM_DEVICE_IGNORE), Init writes a warning in the log with a rule that does. The udev rules of PJRC for the Teensy (00-teensy.rules) do the same. The Teensy box has no latency timer.

FIFO buffers (Windows). On Windows, the BITSI 2018 (Teensy) is a USB serial port (driver usbser.sys). Its port must have Use FIFO buffers off and the receive and transmit buffers at Low (1). Set them in the Device Manager (Ports, the COM port, Properties, Port Settings, Advanced): first set Receive Buffer and Transmit Buffer to Low (1), then uncheck Use FIFO buffers; unchecked first, the buffers stay at their values, greyed out. Init reads them from the registry (ForceFifoEnable, RxFIFO and TxFIFO in the port's Device Parameters) and raises an error when one of them is different. A setting that was never changed is not in the registry and counts as its default (FIFO buffers on, Receive Buffer 14, Transmit Buffer 16). Windows keeps the registry keys of boxes that were connected before, and two boxes can have the same COM port name; Init then reads the key of the connected box (by its USB serial number). When the port's registry key can't be found or read, or the connected box can't be told apart, there is a warning in the log. The values are on the experiment as radboudbox_fifo_settings.

COM port number (Windows). The port of the buttonbox (both types) must be COM1 to COM9; Init raises an error for COM10 and higher. Change it in the Device Manager (Ports, the COM port, Properties, Port Settings, Advanced, COM Port Number) to a free number below 10.

Port settings error (Windows). On Windows, Init lists all port settings of the box in one error. BITSI 2015: COM port number (below 10), USB transfer sizes Receive and Transmit (64 bytes), latency timer (1 ms) and minimum read and write timeouts (0 ms). BITSI 2018: COM port number and the FIFO buffers. Each setting is marked correct or incorrect, and the error says where to change them in the Device Manager and what to set. A setting that was never changed is not in the registry and counts as the driver's default (BITSI 2015: transfer sizes 4096 bytes, latency timer 16 ms, timeouts 0). The values are on the experiment as radboudbox_ftdi_settings (BITSI 2015) and radboudbox_fifo_settings (BITSI 2018).

Wrong port settings. Wrong port settings in the Init item chooses what happens when a port setting is wrong: error (the default) stops the experiment with the error above; warning writes the same text as a warning in the log, and the experiment continues. Use warning only for tests, e.g. on a computer where you can't change the settings: radboudbox_port_settings in the log file then says incorrect. The checks don't run in dummy mode.

Log variables. Init sets these variables, so a logger with Log all variables writes them to the log file (NA in dummy mode and for settings the box or the system doesn't have, unknown when they can't be read):

Variable Value
radboudbox_type BITSI 2015 or BITSI 2018 (by the USB vendor id)
radboudbox_port e.g. COM3 or /dev/ttyUSB0
radboudbox_driver e.g. FTSER2K or usbser (Windows), ftdi_sio or cdc_acm (Linux)
radboudbox_id_string the ID string the box sent (mode and firmware)
radboudbox_port_settings correct, incorrect or unknown
radboudbox_latency_timer ms (BITSI 2015)
radboudbox_receive_bytes, radboudbox_transmit_bytes USB transfer sizes (BITSI 2015, Windows)
radboudbox_min_read_timeout, radboudbox_min_write_timeout ms (BITSI 2015, Windows)
radboudbox_use_fifo_buffers on or off (BITSI 2018, Windows)
radboudbox_receive_buffer, radboudbox_transmit_buffer 1 (Low) to 14 or 16 (High) (BITSI 2018, Windows)
radboudbox_modemmanager not running, does not use the box or may use the box (BITSI 2018, Linux)

Triggers. Send Trigger works on all boxes, in both modes. Its pulse mode sets the value, waits for the pulse time and sets 0, so it also works with the 2014 firmware.

Send Control (extended mode only):

Command Sends 2015, fw 2014 2015, fw 2015-11-18 2015, fw 2018 2018 Teensy Notes
Calibrate Sound / Voice C S / C V yes not tested yes yes the item waits 1000 ms: be silent
Detect Sound / Voice D S / D V yes not tested yes yes the box sends S / V once; collect it with radboudbox_collect_buttons_fg or radboudbox_collect_buttons_bg_start (allowed response S or V)
Marker Out M value yes yes (tested) yes yes the output keeps the value until the next marker
Pulse Out P value no yes (tested) yes yes value for the pulse time, then 0 (default 100 ms)
Pulse Time X ms no yes (tested) yes yes pulse time of Pulse Out, 0-255 ms
Analog Out 1 / 2 Y / Z value yes not tested yes yes 0-255
Tone T yes not tested yes yes beep of 100 ms
Analog In 1-4 A 1-A 4 yes not tested yes yes the value is logged as analog_in_[item_name]
LEDs Off / Input / Output L X / L I / L O Off and Output Output (tested); Off and Input not tested yes no effect Input: the LEDs show the buttons; Output: the LEDs show the markers

The 2014 and 2018 columns follow the firmware sources; the 2015-11-18 column is what was tested on a box. Pulse Out and Pulse Time are an error on a box with the 2014 firmware (when its ID string arrived, and it ends with Ready!): that firmware doesn't have them.

License

This plugin is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version (GPL-3.0-or-later).

The full license text is in the file COPYING, and is also available at https://www.gnu.org/licenses/gpl-3.0.html.

Documentation

Installation instructions and documentation on OpenSesame are available on the documentation website:

Metadata

Release files for opensesame-plugin-radboudbox 7.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for opensesame-plugin-radboudbox 7.0.1
File Size Uploaded Provenance Actions
opensesame_plugin_radboudbox-7.0.1.tar.gz 61.8 kB Without provenance Details for opensesame_plugin_radboudbox-7.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for opensesame-plugin-radboudbox 7.0.1
File Interpreter ABI Platform Actions
opensesame_plugin_radboudbox-7.0.1-py3-none-any.whl Python 3 none any Details for opensesame_plugin_radboudbox-7.0.1-py3-none-any.whl

Total release size: 132.0 kB

Release files / opensesame_plugin_radboudbox-7.0.1.tar.gz

Download URL opensesame_plugin_radboudbox-7.0.1.tar.gz
Size 61.8 kB
Tags Source
SHA-256 checksum
How to use checksums
cffb82f28dcb47c7fef07e7185e74e8353352fbbaac06ad1bb541c25f8159aef
BLAKE2b-256 checksum
How to use checksums
373eb12a59e6417426e70b63175450522d86278c788723449ced826767a8fafc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Release files / opensesame_plugin_radboudbox-7.0.1-py3-none-any.whl

Download URL opensesame_plugin_radboudbox-7.0.1-py3-none-any.whl
Size 70.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aec13234800692c86d3f8c21848a5d4d5decd8bd8efc74facd3eb2ead36e21dc
BLAKE2b-256 checksum
How to use checksums
afc9f529750ecaae9b038585334b9300cae5219824e6117a245b94fe8fe74539
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Security for opensesame-plugin-radboudbox 7.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

7.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page