Cyton

The OpenBCI Cyton PCBs were designed with Design Spark, a free PCB capture program.

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) [inches]

  • Mount holes are 1/16 ID, 0.8 x 2.166 on center [inches]

Data Format

Binary Format

Byte No

Description

1

Start byte, always 0xA0

2

Sample Number

3-26

EEG Data, values are 24-bit signed, MSB first

27-32

Aux Data

33

Footer, 0xCX where X is 0-F in hex

EEG Data for 8 channels

24-Bit Signed.

Byte No

Description

3-5

Data value for EEG channel 1

6-8

Data value for EEG channel 2

9-11

Data value for EEG channel 3

12-14

Data value for EEG channel 4

15-17

Data value for EEG channel 5

18-20

Data value for EEG channel 6

21-23

Data value for EEG channel 7

24-26

Data value for EEG channel 8

EEG Data for 16 channels

24-Bit Signed.

Received

Upsampled board data

Upsampled daisy data

sample(3)

avg(sample(1),sample(3))

sample(2)

sample(4)

sample(3)

avg(sample(2),sample(4))

sample(5)

avg(sample(3),sample(5))

sample(4)

sample(6)

sample(5)

avg(sample(4),sample(6))

sample(7)

avg(sample(5),sample(7))

sample(7)

sample(8)

sample(7)

avg(sample(6),sample(8))

This transmission only applies to Cyton + Daisy and RFduino, if WiFi shield is used then all data is transmitted, and is not necessary to interpolate.

Aux Data

16-Bit Signed.

Stop Byte (33)

Byte 27

Byte 28

Byte 29

Byte 30

Byte 31

Byte 32

Name

0xc0

AX1

AX2

AY1

AY2

AZ1

AZ2

Standard with accel

0xC1

UDF

UDF

UDF

UDF

UDF

UDF

Standard with raw aux

0xC2

UDF

UDF

UDF

UDF

UDF

UDF

User defined

0xC3

AC

AV

T3

T2

T1

T0

Time stamped set with accel

0xC4

AC

AV

T3

T2

T1

T0

Time stamped with accel

0xC5

UDF

UDF

T3

T2

T1

T0

Time stamped set with raw aux

0xC6

UDF

UDF

T3

T2

T1

T0

Time stamped with raw aux

Aux Data

16-Bit Signed.

Byte 27

Byte 28

X

AX1

x

AX0

Y

AY1

y

AY0

Z

AZ1

z

AZ0

class openbci_stream.acquisition.cyton.Cyton(mode: Literal['serial', 'wifi', None], endpoint: Optional[Union[str, List]] = None, host: Optional[str] = None, daisy: Optional[List[Literal['auto', True, False]]] = None, montage: Optional[Union[list, dict]] = None, streaming_package_size: int = 250, capture_stream: Optional[bool] = False, number_of_channels: List = [])[source]

Cyton is a shortcut for CytonRFDuino or CytonWiFi:

>>> Cyton('serial', ...)

is equals to:

>>> CytonRFDuino(...)

and

>>> Cyton('wifi', ...)

the same that do:

>>> CytonWiFi(...)
Parameters
  • modeserial or wifi

  • endpoint – Serial port for RFduino or IP address for WiFi module.

  • host – IP address for the server that has the OpenBCI board attached, by default its assume that is the same machine where is it executing, this is the localhost.

  • daisy – Daisy board can be detected on runtime or declare it specifically.

  • montage – A list means consecutive channels e.g. [‘Fp1’, ‘Fp2’, ‘F3’, ‘Fz’, ‘F4’] and a dictionary means specific channels {1: ‘Fp1’, 2: ‘Fp2’, 3: ‘F3’, 4: ‘Fz’, 5: ‘F4’}.

  • streaming_package_size – The streamer will try to send packages of this size, this is NOT the sampling rate for data acquisition.

  • capture_stream – Indicates if the data from the stream will be captured in asynchronous mode.

__getattribute__(attr: str) Any[source]

Some attributes must be acceded from RPyC.

class openbci_stream.acquisition.cyton.CytonRFDuino(port: Optional = None, host: Optional[str] = None, daisy: Literal['auto', True, False] = 'auto', montage: Optional[Union[list, dict]] = None, streaming_package_size: int = 250, capture_stream: bool = False, board_id: str = '0', parallel_boards: int = 1)[source]

RFduino is the default communication mode for Cyton, this set a serial comunication through a USB dongle with a sample frequency of 250 Hz, for 8 or 16 channels.

Parameters
  • port – Serial port.

  • host – IP address for the server that has the OpenBCI board attached, by default its assume that is the same machine where is it executing, this is the localhost.

  • daisy – Daisy board can be detected on runtime or declare it specifically.

  • montage – A list means consecutive channels e.g. [‘Fp1’, ‘Fp2’, ‘F3’, ‘Fz’, ‘F4’] and a dictionary means specific channels {1: ‘Fp1’, 2: ‘Fp2’, 3: ‘F3’, 4: ‘Fz’, 5: ‘F4’}.

  • streaming_package_size – The streamer will try to send packages of this size, this is NOT the sampling rate for data acquisition.

  • capture_stream – Indicates if the data from the stream will be captured in asynchronous mode.

_get_gain() list[source]

Return the gains from ADS1299 register.

As defined in the datasheet

_get_serial_ports() Optional[str][source]

Look for first available serial port.

Returns

String with the port name or None if no ports were founded.

Return type

str

_stream_data(size: Optional[int] = 256, kafka_context: Optional[Dict] = {}) None[source]

Write binary raw into a kafka producer.

This method will feed the producer while the serial device has data to be read.

Parameters
  • size – The buffer length to read.

  • kafka_context – Information from the acquisition side useful for deserializing and that will be packaged back in the stream.

close()[source]

Close the serial communication.

read(size: int) bytes[source]

Read size bytes from the serial port.

Parameters

size – Size of input buffer.

Returns

Data read.

Return type

read

reset_input_buffer()[source]

Clear input buffer, discarding all that is in the buffer.

start_stream() None[source]

Initialize a Thread for reading data from the serial port and streaming into a Kafka producer.

stop_stream() None[source]

Stop the data collection that runs asynchronously.

write(data: bytes) None[source]

Write the given data over the serial port.

class openbci_stream.acquisition.cyton.CytonWiFi(ip_address: str, host: Optional[str] = None, daisy: Literal['auto', True, False] = 'auto', montage: Optional[Union[list, dict]] = None, streaming_package_size: int = 250, capture_stream: Optional[bool] = False, board_id: str = '0', parallel_boards: int = 1)[source]

This module implement a TCP connection for the WiFi module with a sample frequency from 250 Hz up to 16 kHz, for 8 or 16 channels (8 kHz for 16 channels).

Parameters
  • ip_address – IP addres for the WiFi shield.

  • host – IP address for the server that has the OpenBCI board attached, by default its assume that is the same machine where is it executing, this is the localhost.

  • daisy – Daisy board can be detected on runtime or declare it specifically.

  • montage – A list means consecutive channels e.g. [‘Fp1’, ‘Fp2’, ‘F3’, ‘Fz’, ‘F4’] and a dictionary means specific channels {1: ‘Fp1’, 2: ‘Fp2’, 3: ‘F3’, 4: ‘Fz’, 5: ‘F4’}.

  • streaming_package_size – The streamer will try to send packages of this size, this is NOT the sampling rate for data acquisition.

  • capture_stream – Indicates if the data from the stream will be captured in asynchronous mode.

_create_tcp_server() None[source]

Create TCP server, this server will handle the streaming EEG data.

_get_local_ip_address() str[source]

Get the current network IP assigned.

_start_loop()[source]

Start the TCP server on a thread asyncore loop.

_start_tcp_client()[source]

Connect the board to the TCP server. Sends configuration of the previously server created to the board, so they can connected to.

close() None[source]

Stops TCP server and data acquisition.

kafka_context() Dict[str, Any][source]

Kafka contex generator.

read(size=None) bytes[source]

Read the response for some command.

Unlike serial mode, over WiFi there is not read and write individual commands, the response is got in the same write command. This implementation tries to emulate the the behavior of serial read/write for compatibility reasons. Not all command return a response.

start_stream() None[source]

Initialize a TCP client on the WiFi shield and sends the command to starts stream.

stop_stream() None[source]

Stop the data collection that runs asynchronously and sends the command to stops stream.

write(data: Union[str, bytes]) None[source]

Send command to board through HTTP protocole.

Parameters

data – Commands to send, It should not be more than 31 characters long.