OpenBCI_Python user.py: access Bluetooth on Ganglion

NikoKoroNikoKoro Athens, Greece
edited March 2017 in Software
Greetings! I recently received my Ganglion board and I am facing some problems.
I tried to access the Ganglion from the user.py file, but when I run it I get the following error message:

OSError: Cannot find OpenBCI port


The setting for the port was on auto.

Afterwards I found the bluetooth port address which is the following: /dev/bus/usb/002/004
I used user.py with -p=/dev/bus/usb/002/004
and I got another error this time:


  File "/usr/local/lib/python2.7/dist-packages/serial/serialposix.py", line 268, in open
    raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg))
serial.serialutil.SerialException: [Errno 13] could not open port /dev/bus/usb/002/004: [Errno 13] Permission denied: '/dev/bus/usb/002/004'


I can connect to the Ganglion normally when using the OpenBCI_GUI so I'm guessing the problem is that Python can't access the Bluetooth correctly for some reason.
I tried running user.py from Windows 10 and it couldn't find the Bluetooth so I switched to Ubuntu to find the proper address but still the error persists.

The CSR driver was installed in Windows.

I am sorry for the long post.
Thanks in advance for any help!

Comments

  • wjcroftwjcroft Mount Shasta, CA
  • NikoKoroNikoKoro Athens, Greece
    Oh I see! Thank you very much! Back to work again.
  • NikoKoroNikoKoro Athens, Greece
    Hello and thanks for the replies! I managed to connect to the board through NodeJS. I also tried user.py again and it connects to the board,
    but I get the message "Warning: Dropped 1 packets" when I type something. I'm sorry that I ask this in a different question, but how can I alter
    the bluetooth adapter settings in Ubuntu? I can't seem to find something.

    Thanks again!
  • This problem of dropped packets is likely to be addressed by the commands I put on my post:

    sudo echo 9 > /sys/kernel/debug/bluetooth/hci0/conn_min_interval

    sudo echo 10 > /sys/kernel/debug/bluetooth/hci0/conn_max_interval

    "hci0" being the name of your bluetooth dongle.
  • NikoKoroNikoKoro Athens, Greece
    I tried to execute the commands above, but I couldn't even with sudo. 
    I'll try again as root. Will post results! Thank you!
  • NikoKoroNikoKoro Athens, Greece
    Hi again! So I managed to write the values to the conn_min_interval and conn_max_interval file but the problem persisted.
    I decided to abandon that plan for now, and switched to the node.js library.

    I managed (with the help of a friend) to communicate with the board using the node.js library, and to send the data to a python script via the nanomsg library, which in turn uses the nnpy library to get the data from the node.js server.

    The data is sent through tcp/ip .

    If anyone would like to get the code, I'd me more than glad to send it!

    Thanks again for all the help!
  • Too bad that it did not work, I could not test it on many dongles so I don't know if there are other causes for the dropped packets problems. If you have several BLE adapter (e.g. one on your laptop + one dongle) you might confuse hci0 / hci1, otherwise I don't see.

    When you display the values of min/max interval (e.g. with "echo") are the "9" and "10" timings there? You may also try even lower values...

    There is a "sample rate" plugin, could you run it to assess roughly how many packet you loose on average?

    For the record, and possibly for future debug, could you tell us what is the brand and model of your adapter?

  • NikoKoroNikoKoro Athens, Greece
    I am using the adapter that was provided to me along with the ganglion(CSR8510 a10)
    I have already tested the hci0/hci1 and the bluetooth is the hci1 device, which is the one I configured.
    The values displayed (with "echo" or "cat") are 9 & 10.

    I'll try some lower values and will send feedback!

  • NikoKoroNikoKoro Athens, Greece
    Hello again! I forgot to mention that a friend of mine was able to receive data using my bluetooth adapter and ganglion, but he 
    had that 15% data loss that you mentioned in your post. Now I was thinking that because he plugged the adapter on a USB 3.0 port
    (I don't have one on my laptop), everything was working as expected. Could this be the reason that I'm losing all my data? 
Sign In or Register to comment.