An integration of the g.STIMbox with BCI2000
Griffin Milsap (firstname.lastname@example.org)
- 2013/09/23: Initial public release;
Source Code Revisions
- Initial development: 4580
- Tested under: 4580
- Known to compile under: 4580
- Broken since: --
The g.STIMbox is a USB digital I/O card. This simple filter extension resides in the Application module and makes input and output with the card easy.
Integration into BCI2000
Compile the extension into your source module by enabling contributed extensions in your CMake configuration. You can do this by going into your root build folder and deleting
CMakeCache.txt and re-running the project batch file, or by running
cmake -i and enabling BUILD_STIMBOXFILTER. Once the extension is built into the source module, enable it by starting the source module with the
--StimBoxFilter=[COMPORT] command line argument (NB, as explained below, the numeric value here matters, and denotes the COM port to be used: =1 means COM port 1).
The StimBoxFilter is configured in the g.STIMbox tab. The configurable parameters are:
Enables/Disables the StimBoxFilter. This parameter performs double-duty as the COM port selector. NOTE: The COM port that the g.STIMbox is connected to can be determined by accessing the Device Manager within the Windows control panel.
-  - Disabled
- Any other number indicates the COM port to attempt communication with the g.STIMbox on.
This matrix of expressions that controls the outputs on the device. The g.STIMbox has 16 digital outputs which can be controlled via expressions in this matrix. Some of the outputs can only be accessed via the D-SUB connector on the front of the box. To control a port, create a new row in this matrix and change the row label to the number of the port you wish to control. If the expression in column 1 in that row evaluates to True, the port will be set high, and the port will be set low whenever the expression evaluates to False. If an 'F' is specified immediately after the row label (for example, '3F'), that port is assumed to be in 'Frequency Mode' and the port frequency will be set to whatever the expression evaluates to. If the expression evaluates to 0 or False, the port will be set low (off). Note that changing the frequency while in frequency mode will reset the port to 'high' immediately. This means that changing the frequency too often will result in the port reading 'high' all the time.
|(Row Label)||(Column 1)||(Description)|
|1||1||// Output 1 is always high|
|2||0||// Output 2 is always low|
|5||0.5||// Outputs don't need to be specified in order, 0.5 evaluates to True|
|3||Signal(1,1) > 50||// Output 3 is high when the input signal exceeds 50.|
|4F||StimulusType||// Output 4 will evaluate the state "StimulusType" to determine output frequency.|
|5||!StimBoxInput1||// Line 3 is ignored, Output 5 = Input 1|
- Valid frequencies for frequency mode are between 1 and 50 Hz.
The StimBoxFilter outputs the following state variables:
There are 14 digital inputs on the StimBox. Some of the inputs can only be accessed via the D-SUB connectors on the front of the box. These inputs are asynchronously sampled at 256 Hz and set as BCI2000 states once per block. Note that this means there is data loss if your signal changes more than once per BCI2000 block. Clocking BCI2000 at >256 blocks per second is also inadvisable, so this is expected.