question on EMG with LSL

2»

Comments

  • wjcroftwjcroft Mount Shasta, CA

    Where is the source file for LSL_Stream_Facial_Multiple_LEDs.py, I'm not seeing it online.

    Are you aware that there are different versions of the Python interpreter? The source you have may not match the version of your interpreter.

  • amiltonamilton Campinas, SP Brazil

    TKS

  • amiltonamilton Campinas, SP Brazil

    Dear William
    I'm happy to inform that I'm able to run the script lslStreamTest.py with success consistently.
    Unfortunately I can't say the same for the script LSL_Stream_Music.py, which qives an error every time I run it. The system does not find the stream.
    The set up preparation is exactly the same , even the widgtes positions. The only difference is in the stream type, that is EEG (kept the GUI original) for the streamTest script and EMG for the streamMusic script.
    I change the stream tupe by selcting the box and replacing the word EEG bu EMG (typing). I the click somewhere else in the widget so that green line around the word changes to black.
    Looking at the console log, the only difference is for the StringList. The size is 5 in both cases but the contents reads as follows:
    Success case (streamTest script) [ "EMG", "obci_eeg1", "EEG", "8", "false" ]
    Fail case (streamMUSIC script) [ "EMG", "obci_eeg1", "\u0000EMG", "8", "false" ]
    Would that be the cause for the error? Please advise.
    Regards
    Amilton
    PS.: I should stream one channel only and not 8 but I think it should not matter for my purpose.

  • wjcroftwjcroft Mount Shasta, CA

    Richard @retiutut, do you have any suggestions?

  • retiututretiutut Louisiana, USA
    edited May 2023

    Fail case (streamMUSIC script) [ "EMG", "obci_eeg1", "\u0000EMG", "8", "false" ]

    https://github.com/OpenBCI/OpenBCI_Tutorials/blob/master/EMG_Controlled_Music/LSL_Stream_Music.py

    This script looks for an LSL stream of type "EMG". And in what you just shared your type name is "\u0000EMG". Some weird character is making it into your text field. I see you are from Brazil and you may have a different keyboard layout. Try to make sure that only the English E M G characters make it into this textfield.

  • amiltonamilton Campinas, SP Brazil

    Richard, I found out how to fix it. I'll post shortly. Regards Amilton

  • retiututretiutut Louisiana, USA

    Cool! Thanks for testing these examples. Are there any we should look at for errors?

  • amiltonamilton Campinas, SP Brazil

    Dears, there are 2 ways to solve the problem:
    A) solution 1
    1) First, in the LSL widget replace EEG por EMG (typing box )
    2) Then select EMG in the drop down menu
    The Console log will show that the StringList content is now [ "EMG", "obci_eeg1", "EEG", "8", "false" ]
    3) I runs

    B) Solution 2
    1) Select EMG on the drop down menu
    2) Replace EEG by EMG (typing box)
    3) Open the console log and look for the StringList content
    It may be: [ "EMG", "obci_eeg1", "\u0000EMG", "8", "false" ] (example)
    4) Open the MUSIC script and replace EMG by \u0000EMG in the resolve_stream line
    FROM: streams = resolve_stream('type', 'EMG') TO: streams = resolve_stream('type', '\u0000EMG')
    5) It runs
    Regards
    Amilton

  • amiltonamilton Campinas, SP Brazil

    I'm still strugling with the error in the LSL_Stream_Facial_Multiple_LEDs.py)
    C:\Program Files\Python311>python.exe LSL_Stream_Facial_Multiple_LEDs.py
    Traceback (most recent call last):
    File "C:\Program Files\Python311\LSL_Stream_Facial_Multiple_LEDs.py", line 8, in
    ser = serial.Serial('COM6', 9600)
    ^^^^^^^^^^^^^
    AttributeError: module 'serial' has no attribute 'Serial'

    Please help me.
    Regards
    Amilton

  • wjcroftwjcroft Mount Shasta, CA

    The syntax '\u', followed by 4 digits, is how Unicode byte values are represented in programs. One would suggest not using or inserting such bogus characters into programs. Unicode byte value 0000, I believe is their 'null' character. Means nothing, a filler.

    https://www.compart.com/en/unicode/U+0000

  • amiltonamilton Campinas, SP Brazil

    I'm happy cause we figure out how find the streams. But I do have problems (see above) with the script LSL_Stream_Facial_Multiple_LEDs.py
    Regards

  • wjcroftwjcroft Mount Shasta, CA

    @amilton said:
    I'm happy cause we figure out how find the streams. But I do have problems (see above) with the script LSL_Stream_Facial_Multiple_LEDs.py

    I already gave some links for that issue. The Python code seems to be calling on an older API version of the Serial module. Just adjust the source code to use the current API. API = Application Program Interface, the function calls used by programmers to invoke library routines.

  • amiltonamilton Campinas, SP Brazil

    I'll try again tomorrow .
    Got go teach classes now

  • amiltonamilton Campinas, SP Brazil

    Hi William, I'm using the pyserial 3.5.
    Finnaly we got the LEds experiment to work.
    I've learned a few things:
    1) Open de Arduino IDE and start the script to ensure that a communication port is secured.
    2) Set up the GUI interface and start streaming data (LSL inclusive).
    3) Check the COM port and the StringList variable content in the CONSOLE LOG. You may need to edit the Python script to avoid errors.
    4) Make sure the COM ports (Arduino and OPENBCI) are different. Example: COM7 and COM5.
    5) Edit the Python script if needed.
    6) In Step 3 of the EMG Controlled LED, in the Important Note paragraph, it is crucial to close the Arduino IDE as a whole and not only the Serial Monitor.
    After this, the example runs just fine.
    Regards, Amilton

Sign In or Register to comment.