Jump to content

Contributions:OpenBCISource

From BCI2000 Wiki
Revision as of 22:28, 18 September 2017 by Pbrunner (talk | contribs)

OpenBCISource

Introduction

OpenBCISource

OpenBCISource can require data from OpenBCI Cyton board through serial port. It can automatically open port, set up baud rate and set up parity.

OpenBCI

The OpenBCI is a low-cost, high-quality biosensing hardware for brain computer interfacing. This arduino compatible biosensing board provides high resolution imaging and recording of EMG, ECG, and EEG signals. This device has been used by researchers, makers, and hobbyists in over 60+ countries as brain computer interfaces to power machines and map brain activity. OpenBCI allows anyone interested in biosensing and neurofeedback to purchase high quality equipment at affordable prices.

More information on OpenBCI can be found at: [1]

OpenBCI Cyton Board

Cyton Board Specs

Power with 3-6V DC Battery ONLY

PIC32MX250F128B Micrcontroller with chipKIT UDB32-MX2-DIP bootloader

ADS1299 Analog Front End

LIS3DH 3 axis Accelerometer

RFduino BLE radio

Micro SD card slot

Voltage Regulation (3V3, +2.5V, -2.5V)

Board Dimensions 2.41” x 2.41” (octogon has 1” edges)

Mount holes are 1/16” ID, 0.8” x 2.166” on center

Breakout Pins

Program pins for bootloading PIC, PGC, PGD, VDD, MCLR, GND

Serial pins for programming RFduino, RFTX, RFRX, RFRST, GND

SPI bus pins on the 3V side for Daisy Module expansion DVDD, GND, MISO, MOSI, SCK, CS, CLK, RST

Unused PIC32 pins D11 (A5), D12 (A6), D13 (A7), D17, D18

Push Buttons

The RST pushbutton is connected to MCLR on the PIC. Pressing it will reset the PIC. To put the PIC into bootloader mode so that it can be re-programmed, press the RST button and hold it down. Then press the PROG button. Then release the RST button, and the blue LED will blink pleasantly, announcing that the PIC is ready to accept new code.

Slide Switch

Slide switch is power for the board. The slide switch has three positions:

BLE activates a pull-up on RFduino pin 4

OFF disconnects the battery input

PC does NOT activate pull-up on RFduino pin 4

Cyton Data Format

Each packet contains a header followed by a sample counter, followed by 8 ADS channel data, followed by the three axes values of the accelerometer, followed by a footer. The accelerometer data are optional, and don’t need to be sent with every packet when used. if unused, the bytes will read 0. This allows for user defined auxiliary data to be sent in the last six bytes before the footer. Also, there may be room for compressing more samples. Here are details on the format

Header

Byte 1: 0xA0

Byte 2: Sample Number

EEG Data

Note: values are 24-bit signed, MSB first

Bytes 3-5: Data value for EEG channel 1

Bytes 6-8: Data value for EEG channel 2

Bytes 9-11: Data value for EEG channel 3

Bytes 12-14: Data value for EEG channel 4

Bytes 15-17: Data value for EEG channel 5

Bytes 18-20: Data value for EEG channel 6

Bytes 21-23: Data value for EEG channel 7

Bytes 24-26: Data value for EEG channel 8

Bytes 27-28: Data value for accelerometer channel X

Bytes 29-30: Data value for accelerometer channel Y

Bytes 31-32: Data value for accelerometer channel Z

Footer

Byte 33: 0xCX where X is 0-F in hex

24-BIT SIGNED DATA VALUES

For the EEG data values, you will note that we are transferring the data as a 24-bit signed integer, which is a bit unusual. We are using this number format because it is the native format used by the ADS1299 chip that is at the core of the Cyton board. To convert this unusual number format into a more standard 32-bit signed integer, you can steal some ideas from the example Processing (aka, Java) code:

int interpret24bitAsInt32(byte[] byteArray) {

   int newInt = (  
    ((0xFF & byteArray[0]) << 16) |  
    ((0xFF & byteArray[1]) << 8) |   
    (0xFF & byteArray[2])  
   );  
   if ((newInt & 0x00800000) > 0) {  
     newInt |= 0xFF000000;  
   } else {  
     newInt &= 0x00FFFFFF;  
   }  
   return newInt;  

}

Steps to use OpenBCISource

1.Plug in Bluetooth dongle and turn OpenBCI board to PC mode.

2.Check the port of the Bluetooth dongle

3.Run OpenBCISource and set the port number

4.Click start button.

5.User can see the current working condition of the hardware from operator log

Parameters:OpenBCISource

SourceCh

The total number of channels: EEG.

SampleBlockSize

Samples per channel per digitized block. Together with the sampling rate, this parameter determines how often per second data are collected, processed, and feedback is updated. For example, at 500 Hz sampling and a SampleBlockSize of 20, the system (e.g., source signal display, signal processing, and stimulus presentation) will be updated 25 times per second. For OpenBCI Cyton the sampling rate is 250Hz and it sends data to buffer every half second. So the suggest value for sample bock size is 125.

SamplingRate

The sample rate of the system. All data is either acquired at 250Hz In case you are experiencing problems by higher sampling rates (e.g., data loss, jerky display, etc.), increase the SampleBlockSize so that you are updating the system less frequently (usually, updating the system 20-30 times per second is sufficient for most applications), and increase Visualize->VisualizeSourceDecimation. This parameter will decrease the number of samples per second that are actually drawn in the Source display.

SourceChGain

Gain for each channel.

SourceChOffset

Offset for each channel.

ChannelNames

Names of each channel.

PortName

The port name is depend on where the user plug in the Bluetooth dangle. One the experimenter plugs in the dangle, he can check the port name from Device and Printer on Windows.

See also

User Reference:Filters, Contributions:ADCs