OpenBci on Macbook M chip

Hi Everyone,
Hope all is well

I am working on EEG using OpenBCi cap and am streaming the code with Python, and also checking the signal with Openbci Gui,

The code for streaming is as follows:
The question is how can I access the serial port in MAC to replace it wit Com 3, Python, bc this code is working on Windows properly but now I am switching to MacBook M series

BoardShim.enable_dev_board_logger()
# use synthetic board for demo
params = BrainFlowInputParams()
params.serial_port = "COM3"
board = BoardShim(2, params)
board.prepare_session()
board.start_stream()
time.sleep(35)
data = board.get_board_data()
board.stop_stream()
board.release_session()
eeg_channels = BoardShim.get_eeg_channels(2)
eeg_data = data[eeg_channels, :]
eeg_data = eeg_data / 1000000  # BrainFlow returns uV, convert to V for MNE
# Creating MNE objects from brainflow data arrays
ch_types = ['eeg'] * len(eeg_channels)
ch_names = BoardShim.get_eeg_names(BoardIds.SYNTHETIC_BOARD.value)
sfreq = BoardShim.get_sampling_rate(2)
info = mne.create_info(ch_names=ch_names, sfreq=sfreq, ch_types=ch_types)
raw = mne.io.RawArray(eeg_data, info)
raw.crop(tmin=3,tmax=30)
# raw.plot()
# raw.export('SR04.edf', fmt='auto',overwrite=True)

Hello,

This is a python serial question, it would be better suited for e.g. StackOverflow.
It has no attachment to MNE-Python.

That said, have a look to:

from serial.tools import list_ports

from the library pyserial.

Mathieu

1 Like