Exercise:Logging Devices

From BCI2000 Wiki
Revision as of 23:32, 13 November 2012 by Jhill (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This exercise walks you through the process of connecting a human-interface device or other measurement device, and "logging" its output as state variables, synchronized with the brain signals you are recording.

  1. Copy one of the existing batch files and use it as a template to write your own batch file.
  2. In your new batch file, open the Operator, SignalGenerator, DummySignalProcessing and DummyApplication.
  3. Launch BCI2000 using your new batch file.
  4. In the Operator, open the View menu and select States.
  5. Note down the names of the state variables, then quit BCI2000 again.
  6. Edit your batch file such that the source module (in this case SignalGenerator) is started with the command-line option --LogMouse=1
  7. Relaunch BCI2000 using the updated batch file, and check the States again. Note that there are now additional state variables, in accordance to what the documentation on the mouse and joystick loggers tells us to expect.

What sorts of neuroscientific questions could you address, by recording signals from human-interface devices, synchronized in real-time to brain signal recordings? What sort of experiments would you imagine doing? Which state variables would be relevant, and how would you process them?

Now we need a way of visualizing the state variable(s) you find most interesting. The exact way you do this may depend on the state(s) you are interested in. A simple preliminary way might be to use the shell in the MatlabSignalProcessing module to repeatedly examine the global variable bci_States, or similarly, self.states from the shell of one of the Python modules. One of the most flexible ways would be to use the ExpressionFilter, which has been built into DummySignalProcessing for the purposes of this exercise. State variables can be drawn into the signal pipeline by entering their names into the Expressions parameter (found in the config dialog's Filtering tab). This also allows you to view the signal, if you fill the VisualizeExpressionFilter checkbox in the Visualize tab. If the signals are out of the range of visualization, the ExpressionFilter allows arithmetic expressions that can be used to compensate for this. For example, (MousePosX-1000)/1000 is a valid expression.

The following devices are supported on the workshop installations. You can log as many devices simultaneously as the CPU and number of available USB ports will allow (just keep appending the flags). For whichever device(s) you choose, check to see which states are added.

  • To log the mouse or trackpad, use --LogMouse=1
  • To log the joystick, use --LogJoystick=1
  • To log the 5DT Data Glove Ultra, use --LogDataGlove=1 . Please be gentle with the data glove.
  • To log the Nintendo Wiimote:
    1. Ensure that a Bluetooth dongle is attached.
    2. Press the (1) and (2) buttons simultaneously on the Wiimote. Lights will flash for several seconds, during which the Wiimote is receptive to pairing.
    3. Launch ConnectWiimotes.exe
    4. Wait for the program to find the Wiimote and pair with it.
    5. Since the Windows XP Bluetooth implementation is flaky, verify that the device is connected using the Start menu -> Control Panel -> Bluetooth Devices. You should see an entry for the Wiimote there: if it says "connected" underneath, connection has succeeded. If the word "connected" is absent, it has failed: close the control panel, re-run ConnectWiimote.exe, and re-open the control panel to verify. Repeat until it works.
    6. The Wiimote will now stay connected across multiple BCI2000 sessions, but there will be a constant drain on the batteries. Therefore, please disconnect it as soon as you are no longer using it (go to the control panel again, highlight the Wiimote and click "Remove").
    7. The flag you need when starting your source module is --LogWiimote=1

The BCI2000 platform also supports Tobii eyetrackers via the EyetrackerLogger and various forms of EEG-synchronized audio and video acquisition via the AudioExtension and WebcamLogger. See our contributed extensions page for more details.

What other hardware devices do you think it would be useful for BCI2000 to support? If you have custom hardware you wish to integrate into BCI2000, you may be interested in the programming tutorial on implementing an input logger.