OpenBCI, LSL, and Matlab 2016b

GattaKatGattaKat Seattle
edited January 2017 in Software
Hi all,

Is anyone else unable to get OpenBCI data into Matlab 2016b?  I'm running OpenBCI_Matlab

https://github.com/OpenBCI/OpenBCI_MATLAB

and can see the stream through the terminal, but picking up the stream in Matlab just leads to "Looking for a device with type='EEG' ..."  I've tried both the master and devel branches of BCILAB as well (as recommended here: https://github.com/sccn/BCILAB/issues/11), and I've checked the StreamInfo() name matches (per the advice given here: http://openbci.com/index.php/forum/#/discussion/761/unable-to-input-openbci-lsl-stream-in-bcilab)

System:
MacBook Pro (Late 2013)
OS X Yosemite (10.10.5)
Matlab 2016b
Cyton board (not daisy-chained)

Thanks,
-Katherine

Comments

  • wjcroftwjcroft Mount Shasta, CA
    Katherine, hi.

    Mentioning @GabeIbagon, the author of that Github page.

    There is also a forum for EEGLAB / BCILAB questions, have you tried there?

    https://sccn.ucsd.edu/wiki/EEGLAB_mailing_lists

    William

  • GabeIbagonGabeIbagon San Diego, California
    Hi Katherine,

    That repo is a bit outdated. New documents should be coming in the next few weeks. Instead, try following the instructions on the OpenBCI_LSL repo to set up an LSL stream with OpenBCI (https://github.com/OpenBCI/OpenBCI_LSL).

    Use the following command to start streaming with the default parameters:

    `python openbci_lsl.py --stream`

    followed by "/start" when the prompt appears.

    To test if the stream is being sent correctly, run this python script while you are running the openbci_lsl script. This should print out the values of an active EEG stream: https://github.com/sccn/labstreaminglayer/blob/master/LSL/liblsl-Python/examples/ReceiveData.py

    Let me know if the issue continues.
  • edited July 2017
    Hi @Gabelbagon,

    I am having the same as Katherine did now. I can be successful to open a LSL stream from OpenBCI_GUI using the Networking widget and receive the data in the terminal by running the python script ReceiveData.py.

    However, I cannot receive the data in Matlab. The call inlet.pull_sample() always returns empty values. Moreover, sometimes the call can make Matlab crash. 

    System:
    MacBook Pro (Mid 2015)
    macOS Sierra (10.12.5)
    Matlab R2017a
    Cyton board (not daisy-chained)

    Could you give me any idea to fix it?

    Thanks,
    Anh
  • Hi all, 

    I also had the same problem as Anh and Katherine. The streaming worked on Python but not on Matlab. I just found out why it didn't work. It seems that one of the mex file couldn't be found so I had to copy the content of one folder in another. Just follow the instructions given here at the end of the page ("in Matlab, 2"):


    I hope it helps...

    Hannah
  • Hi all, Hi @GabeIbagon

    After running the openbci_lsl.py and obtaining the result further down, in order to confirm that the stream is well received in Python, do I run the
    ReceiveData.py https://github.com/sccn/labstreaminglayer/blob/master/LSL/liblsl-Python/examples/ReceiveData.py with a specific modification e.g. to indicate the name of the stream (openbci_eeg)?

    i.e. replace: streams = resolve_stream('type', 'EEG')
    with this: streams = resolve_stream('EEG', 'openbci_eeg')


    I only receive the message: "looking for an EEG stream..."
    Thank you in advance for your help
    I mention below what I receive after running openbci_lsl.py
    (I use the Ganglion with Linux).


    python openbci_lsl.py /dev/pts/17 --stream



    -------INSTANTIATING BOARD-------
    Connecting to V3 at port /dev/pts/17
    Serial established...
    --------------------------------------
    LSL Configuration:
      Stream 1:
          Name: openbci_eeg
          Type: EEG
          Channel Count: 8
          Sampling Rate: 250.0
          Channel Format: float32
          Source Id: openbci_eeg_id99
      Stream 2:
          Name: openbci_aux
          Type: AUX
          Channel Count: 3
          Sampling Rate: 250.0
          Channel Format: float32
          Source Id: openbci_aux_id99

    Electrode Location Montage:
    ['Fp1', 'Fp2', 'C3', 'C4', 'T5', 'T6', 'O1', 'O2']
    ---------------------------------------

    --------------INFO---------------
    Commands:
        Type "/start" to stream to LSL
        Type "/stop" to stop stream.
        Type "/exit" to disconnect the board.
    Advanced command map available at http://docs.openbci.com

    -------------BEGIN---------------

    --> /start
    Streaming data...

    -->

  • Hi @ElisabethSmithie!

    I don't believe you'll have to change that and from what it looks like, you're able to successfully get LSL streaming to work with python. If you're trying to receive the data in python (I haven't tried this myself) I think you'll have to find a way to either run both scripts (openbci_lsl.py and ReceiveData.py) some how OR you can start an LSL stream through the OpenBCI GUI and THEN use ReceiveData.py in python. For me, the latter option is easier. To start the LSL stream from the GUI, follow my guide at my Github: https://github.com/faheemersh/Senior_Design_Dry_EEG_BCI/tree/Streaming-via-LSL#2-lsl-through-openbci-gui

    Then go to python and run ReceiveData.py. Let me know what happens!
  • Hi @faheermersh!

    Thank you for your advice!

    Best wishes

    Elisabeth
  • KCDTylerKCDTyler Melbourne, Australia
    edited May 2019
    Hi Katherine (from 2017!)

    Did you (or anyone else!) ever find the solution to this problem?

    I seem to be having the same problem, and it is not clear to me if the solution is in any of the answers above.

    I am wanting to stream EEG online using lab streaming layer and then analyse the data online with Matlab. 
    I can only get as far as the Matlab prompt: ""Looking for a device with type='EEG'"......

    Then....nothing...........

    Not sure at all where to go after that and I can't see any tutorial that explains what to do.

    **************

    I can open the stream using Python and the terminal in my Mac:

    `python openbci_lsl.py --stream` 
    then
    /start

    The OpenBCI dongle shows the red light at this point, so it does appear the data has started flowing.

    Then in Matlab (2019a) I open the BCI lab gui, and go to: Online analysis.../Read input from.../Lab streaming layer....

    This opens a blue-ish EEGLAB like gui, notably with the 'Data stream query' box set to 'type='EEG'".


    After pressing 'OK', I just get the Matlab promt saying ""Looking for a device with type='EEG" and nothing else.

    Not sure if I have done something wrong, not set a variable up properly, or whether there is still a bug somewhere.

    If anyone has any ideas about this that would be much appreciated. 
    If there is a clear tutorial that explains what to do at this point, that would also be great because all of the tutorials I can find re using Matlab, and streaming with lab streaming layer just stop at this point. 

    Thanks in advance.

    Kaelasha 


  • KCDTylerKCDTyler Melbourne, Australia
    edited May 2019
    Hi all (and thanks William),

    There are a few threads around dealing with this issue. Just in case anyone stumbles across this thread in the future, this worked for me:

    Solution from @mizanur36, posted on other thread,

    It appears the issue was the liblsl64.dylib version. I have downloaded a newer version from https://github.com/Epist/bci_focus/blob/master/Server/bin/liblsl64.dylib link and now I can see LSL stream in MATLAB
Sign In or Register to comment.