Recording tutorial

From BrainControlClub
Jump to: navigation, search

The following is based on Selfie EEG recordings by Robert, Nijmegen, 2016-11-14

EEGsynth modules used in this tutorial

  • Redis
  • Buffer
  • LaunchControl (you can do without, see below)
  • Openbci2ft
  • Record

Setting up instrumentation

We will use the fully bipolar configuration in /module/openbci2ft/openbci2ft.ini

In /module/openbci2ft/openbci2ft.ini: Switch off all channels except for 1, 2 and 3 under [ChannelEnable] by commenting the other channels with ‘;’ or with ‘off’ Rename the 3 channels under [ChannelLabel] for ECG, EOG and EEG The timestamp channel is automatically added to the last channel (i.e. 4).

Check that the port where the openbci dongle is connected is the correct one, for this run

>ls /dev/ttyUSB*

And change assign to the variable serial the ttyUSB that correspond to the dongle

serial = /dev/ttyUSB1

You will need 7 electrodes 1 connected to agnd. Best to use a stable spot anywhere on the body, such as mastoid or back of the neck. 2 connected to left and right collarbone (for ECG) 2 above and below the left or right eye (for EOG) 1 on Fpz (middle of the forehead) and 1 on Oz (EEG)

The last channel is also quite sensitive to the eyeblinks, but the EOG channel is not sensitive to the alpha.

Setting up recording

You have several options to start/stop data recording. Files will automatically get a postfix -0, -1, -2, etc.

Configure the recording module (/modules/record/record.ini) to start/stop at button press, e.g. using the Launch Control. See below an excerpt:

[general]

debug=2

[redis]

hostname=localhost

port=6379

[fieldtrip]

hostname=localhost

port=1972

[recording]

file=/home/pi/20161114_robert.edf

blocksize=1  ; in seconds

record=launchcontrol.note042 ; Record can be on or off, I assigned it here to a toggle on the LaunchControlXL

2. You can also (have someone) enter the following in the terminal instead:

redis-cli

SET launchcontrol.note042 127

SET launchcontrol.note042 0

3. Or specify “record=1” in the record.ini file, in that case it will start recording as soon as you start the recording module.

Start acquisition

For openbci2ft I had some issues in starting it (the bluetooth synchronization sometimes fails). So I did

cd /module/buffer

./buffer.sh -start

./openbci2ft.sh start

tail -f openbci2ft.log ; To see the log file output of the openbci2ft application (which starts in the background).

This gives something like:

openbci2ft: sample count = 899430

openbci2ft: sample count = 899440

openbci2ft: sample count = 899450

openbci2ft: sample count = 899460

openbci2ft: sample count = 899470

openbci2ft: sample count = 899480

openbci2ft: sample count = 899490

openbci2ft: sample count = 899500

openbci2ft: sample count = 899510

etc.

Data

EEG data is available from:

https://dl.dropboxusercontent.com/u/3206396/20161114_robert-0.edf

https://dl.dropboxusercontent.com/u/3206396/20161114_robert-1.edf

https://dl.dropboxusercontent.com/u/3206396/20161114_robert-2.edf

https://dl.dropboxusercontent.com/u/3206396/20161114_robert-3.edf

The video corresponding to recording “2” is at: https://youtu.be/_uK92GA7e6E

Recording 0, 1 and 2 are 1 or 2 minutes each. The recording “3” is the one that was running while I was typing this documentation and is a long one.

Visualizing

For the real-time monitoring I used the “viewer” application from fieldtrip/realtime/bin/maci64. Please note that about 2 weeks ago I renamed it from bufferViewer to viewer. On Windows it is called viewer.exe. I also added a low-pass filter option, but have not yet recompiled on computers other than 64-bit OS X.

I also used the ft_realtime_ouunpod example application (from fieldtrip/realtime/online_eeg with cfg.dataset='buffer://synthpi.local:1972' and I switched to channel 1 and 3 and adjusted the scaling.

Note that about 2 weeks ago I also updated the openbci2ft application (which is maintained in FieldTrip), it now has an extra option to output the original sample numbers to detect missing blocks.

Exploring the dataset offline worked fine in MATLAB with:

cd ~/Dropbox/Public/

cfg = []

cfg.dataset = '20161114_robert-2.edf'

cfg.viewmode = 'vertical'

cfg.preproc.demean = 'yes'

cfg.preproc.lpfilter = 'yes'

Cfg.preproc.lpfreq = 35

ft_databrowser(cfg)

At 45.00 seconds the alpha starts