establish BrainFlow connection between Cyton-Daisy and Jetson Nano [resolved]
I am working on getting my Ultracortex Mark IV w/ Cyton-Daisy (16 channel) working on my Jetson Nano. After not being able to get the OpenBCI Hub connected to the OpenBCI GUI, I'm now moving onto using Brainflow to stream the raw EEG data, but am unfortunately encountering some issues. I'm running the code:
from pyOpenBCI import OpenBCICyton
def print_raw(sample):
print(sample.channels_data)
board = OpenBCICyton(daisy = True)
board.start_stream(print_raw)
but am getting the error:
raise OSError('Cannot find OpenBCI port.')
OSError: Cannot find OpenBCI port.
I know that the official OpenBCI team probably hasn't thoroughly tested running on the Jetson Nano, but does anyone have suggestions as to what I should do? Any help or tips would be greatly appreciated. Thanks in advance!
~JJ
Comments
You said you were moving to BrainFlow? Yet the above code seems to be using pyOpenBCI.
https://brainflow.readthedocs.io/en/stable/Examples.html
@wjcroft You're right, I mispoke. The code I was using was pyOpenBCI, not Brainflow. I successfully installed Brainflow on my Nano, but when I run the example code called Python Get Data From a Board using the command:
sudo python3 brainflow-first-stream.py --serial-port COM8 --board-id 0I get the following output:
After doing some research around this issue, I've realized that this likely means there is no compatible library with that name in the library cache. To try to resolve this I added the path /home/jj/.local/lib/python3.6/site-packages/brainflow/lib to my computer's ld.so.conf file (located in etc/) and ran sudo ldconfig to update library cache, but this didn't work. Do you have any idea what could be causing this?
JJ, hi.
Mentioning Andrey @andrey1994 Parfenov, BrainFlow founder.
When you unplug, plug in the dongle to the machine, do you see a serial port device appear in the /dev folder? What is the name, read/write permissions (ls -l /dev)? The earlier pyOpenBCI error may have been due to a device name mismatch or permissions issue. The Nano runs what variant of Linux? If it is Ubuntu as the search results suggest, you might have a file permissions issue with the device. It needs to have both read and write permissions for owner or group. And sometimes those are only turned on for a particular group by default.
https://www.google.com/search?q=ubuntu+serial+port+group+permissions
You can add yourself to the 'dialout' group with the shell command:
sudo usermod -a -G dialout [yourusername]https://www.google.com/search?as_q=linux+dialout&as_sitesearch=openbci.com
Regards, William
Additionally, the command example you gave uses a Windows format device name 'COM8', not Linux device name. Check the documentation.
William, thank you for the reply!
To answer your question, yes, the serial port device ttyUSB0 appears in my /dev folder when it's plugged in. If I do an ls -l /dev, I get the following output from ttyUSB0:
crw-rw-rw- 1 root dialout 188, 0 Mar 30 01:10 ttyUSB0I'm running Ubuntu 18.04 LTS. I tried all of the following, but am still receiving the same error:
1. sudo usermod -a -G dialout jj (and then rebooting and replugging in)
2. Following the steps in this guide (and then rebooting and replugging in)
3. sudoedit /etc/udev/rules.d/50-ttyusb.rules and then adding the following code:
KERNEL=="ttyUSB[0-9]*",NAME="tts/USB%n",SYMLINK+="%k",GROUP="uucp",MODE="0666"If there is any other helpful information I can give you about my system configuration please feel free to ask. I'm completely stumped on this one.
First of all as @wjcroft mentioned COM8 is definitely wrong serial port and you need to find a correct one using ls -l /dev/ and add user to dialout group if you want to run it without sudo.
For BrainFlow I dont provide compiled libraries for ARM in general and for jetson nano particularly, but you still might be able to run it if you compile it by yourself directly on jetson. If you have 64bit OS and 64bit compiler it as simple as https://brainflow.readthedocs.io/en/stable/BuildBrainFlow.html#linux and after that https://brainflow.readthedocs.io/en/stable/BuildBrainFlow.html#python
Since we never considered 32bit Linux, to build it on 32bit Linux machine maybe some minor changes in lib names are required specially in CMakeLists.txt, setup.py and in code which performs dlopen in python
after compilation you will need to reinstall python package using
dont install it from PYPI
@Andrey1994 Thank you so much for your suggestions, I got the script running and successfully retrieving data from my Cyton-Daisy! For anybody else who is having issues running Brainflow on their Jetson Nano, follow these steps:
1. Uninstall brainflow if it's already installed (pip uninstall brainflow or pip3 uninstall brainflow)
2. Download the brainflow library into your desktop folder (or any other preferred location) and follow the steps here. The commands you'll need to run are:
Next, follow the steps listed here. Navigate to the brainflow library and run the below commands:
Once again, thank you for everybody's help in resolving this issue! I greatly appreciate it
glad to heat that it just works, btw @wjcroft if you know any CI systems like travis,appveyour, circle ci which are free for open souce projects and supports ARM we can set up automatic tests for ARM too
and I wanna use jetson nano for my own projects with brainflow too, so feel free to ask or share you results
@Andrey1994 I'll definitely let you know if I run into more compatibility issues. This is unrelated to this particular thread, but when do you expect the OpenBCI Hub to be completely eliminated and replaced by Brainflow? Sometime in the next few months? It would be nice to have the OpenBCI GUI so that I can make sure all the channels are connected properly and not railing before I use Brainflow to collect the EEG stream. As I mentioned previously, the GUI is currently unusable on the Jetson Nano due to the OpenBCI Hub.
In GUI 5.0 and I think it will be released soon, more likely smth like ~month. If you need smth like visualizer right now maybe one of these 2 apps will do the trick on jetson https://brainflow.readthedocs.io/en/stable/Gallery.html
Another nice feature of brainflow - streaming board, it allows you to start streaming on jetson and stream data from jetson via multicast socket to another process on your PC, so in theory you can use streaming board on your desktop with mne scan or timeflux