Python Data Stream On Mac

edited June 30 in Cyton

I am using MacOS 14.5. I tried OpenBci GUI to stream the data from my cython-daisy 16-channel board, and randomly, it opened the streaming, but after 5 seconds, it said there was no change in data and then stopped. Also, most of the time, the streaming will not start, and it says, please select 8 channels. However, I have 16 channels. Also, I used brain flow in Python to stream and collect the data, but that one also is not working, and once I run the code, it will not stop.
I would greatly appreciate your help.

here is my code:

BoardShim.enable_dev_board_logger()
# use synthetic board for demo
params = BrainFlowInputParams()
params.serial_port ="/dev/tty.usbserial-D200QEPF"
board = BoardShim(2, params)
board.prepare_session()
board.start_stream()
time.sleep(36)
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=33)

Comments

  • wjcroftwjcroft Mount Shasta, CA

    Hi Sorous,

    Your serial port is using the /dev/tty___ name, and instead should be using the /dev/cu___ name (same that the GUI uses). Have you tried running the example:

    https://brainflow.readthedocs.io/en/stable/Examples.html#python-get-data-from-a-board

    Also suggest using the official defined board id identifier, BoardIds.CYTON_DAISY_BOARD rather than a numeric value.

    Brainflow questions are best asked on the Brainflow Slack. Sign up using the link on this page.

    https://brainflow.org/

    William

  • Hi William,

    Thank you so much for the information. I modified and it worked perfectly.

    Thank you!

    Soroush

  • It seems you're encountering issues with both the OpenBCI GUI and BrainFlow when trying to stream data from your Cyton-Daisy board. The OpenBCI GUI error, where it asks to select 8 channels despite having 16, may be due to a misconfiguration in the channel selection within the software. Make sure you're manually selecting the correct number of channels in the GUI. For the BrainFlow code, verify that the BoardShim(2, params) line is using the correct board ID for your Cyton-Daisy board—ensure you're not using a synthetic board ID by mistake. Double-check the serial port (/dev/tty.usbserial-D200QEPF) for correctness, as it might change if the device is reconnected. Additionally, the code with time.sleep(36) assumes continuous streaming, so check that the stream isn’t halting unexpectedly. Lastly, ensure that all dependencies are up to date and compatible with macOS 14.5, as this could impact connectivity and functionality.

  • wjcroftwjcroft Mount Shasta, CA

    Hi @jamesbrook23, thanks for you tips, but Sorous already said on June 29 (previous comment), that changing the serial port name string, and the Board Id string fixed the problem: "...it worked perfectly."

Sign In or Register to comment.