OpenBCI_Python and Unusual Dongle Behaviour

edited August 2016 in Cyton
Hi there. 

I have recently encountered an issue. I was attempting to stream from the OpenBCI board using Python and in the beginning it seemed to work fine, until midway through, the stream was lost. I stopped the stream and exited user.py. I reconnected the dongle, but this time, when I plugged it into my PC, the red LED started blinking a few seconds instead of the usual quick flash. When it switched off, leaving only the blue LED, I tried running user.py and I got this error. 

C:\OpenBCI_Python-master>python user.py -p=COM3 --add streamer_lsl
            USER.py
user.py: open_bci_v3...

------------SETTINGS-------------
('Notch filtering:', True)
user.py: Logging Disabled.

-------INSTANTIATING BOARD-------
Connecting to V3 at port COM3
Serial established...
Traceback (most recent call last):
  File "user.py", line 98, in <module>
    log=args.log)
  File "C:\OpenBCI_Python-master\open_bci_v3.py", line 88, in __init__
    self.print_incoming_text()
  File "C:\OpenBCI_Python-master\open_bci_v3.py", line 319, in print_incoming_text
    c = self.ser.read().decode('utf-8')
  File "C:\Python27\lib\encodings\utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xe3 in position 0: unexpected end of data

Could someone kindly explain this? I have encountered issues with the dongle before but they are mostly due to the driver. I am not sure about this one, though. 

Regards,
Sam

Comments

  • wjcroftwjcroft Mount Shasta, CA
    Sam, I assume that you eventually powered off everything and when you came back up it worked.

    The original mainboard / RFduinos firmware sometimes does hang, and when that happens it's best to turn off the mainboard, unplug the dongle. Then do reverse, plug in dongle and turn on mainboard. If you only unplugged / plugged dongle with the mainboard still on, it may have left the mainboard in a 'partial' state where there were some garbage characters in the pipe. Seeing that garbage, Python balked.

    I'll mention Jeremy @jfrey here also. I'm not sure why the code is calling a utf-8 decoder. Utf-8 is a system for allowing arbitrary fonts and multibyte characters. So again, with some partial garbage in the pipeline, Utf decoder got out of sync. But it may be possible to use just decode('ascii') instead, which would never hiccup like this with a Unicode error.

  • @wjcroft

    I have tried your method and I am glad to inform you that it has worked. Thank you very much. 

    Regards,
    Samuel
Sign In or Register to comment.