user.py works but Standalone GUI doesn't: java.net.ConnectException: Connection refused
pycy
Hong Kong
First day playing with Cyton+Daisy and just trying to reproduce the examples in Getting Started.
The Problem:
After playing around with permissions and drivers I get a blue light on the USB dongle, a working /dev/ttyUSB0, a successful connection to the Cyton card, and even raw data via OpenBCI_Python. However, I can't get the standalone Java GUI working.
Some Extra Incidental Information:
I'm using Centos 7 (kernel is 4.8.12-1.el7.elrepo.x86_64) - my other
Centos Box running a slightly older kernel (3.10) and version of
ftdi_sio.ko doesn't seem detect the USB at all. I plan to fix that later (and advice on that welcome!). But for now, I'd just like to see some pretty pictures.
1) The Hardware is OK:
# lsusb
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 002: ID 045e:0745 Microsoft Corp. Nano Transceiver v1.0 for Bluetooth
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 002: ID 0403:6015 Future Technology Devices International, Ltd Bridge(I2C/SPI/UART/FIFO)
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
2) We can connect to the Cyton (and Daisy) card:
# python ./user.py -p /dev/ttyUSB0 --add print --add csv_collect foo.csv
------------user.py----------- --
Board type: OpenBCI Cyton (v3 API)
('Port: ', '/dev/ttyUSB0')
------------SETTINGS---------- ---
Notch filtering:True
user.py: Logging Disabled.
-------INSTANTIATING BOARD-------
Connecting to V3 at port /dev/ttyUSB0
Serial established...
OpenBCI V3 8-16 channel
On Board ADS1299 Device ID: 0x3E
On Daisy ADS1299 Device ID: 0x3E
LIS3DH Device ID: 0x33
Firmware: v3.0.0
$$$
No daisy:
(8, 'EEG channels and', 3, 'AUX channels at', 250.0, 'Hz.')
------------PLUGINS----------- ---
Found plugins:
[ sample_rate ]
[ streamer_tcp ]
[ streamer_lsl ]
[ streamer_osc ]
[ csv_collect ]
[ noise_test ]
[ print ]
[ udp_server ]
Activating [ print ] plugin...
Print activated
Plugin [ print] added to the list
Activating [ csv_collect ] plugin...
Will export CSV to:foo.csv_2017-10-1_18-27-52. csv
Plugin [ csv_collect] added to the list
--------------INFO------------ ---
User serial interface enabled...
View command map at http://docs.openbci.com.
Type /start to run (/startimp for impedance
checking, if supported) -- and /stop
before issuing new commands afterwards.
Type /exit to exit.
Board outputs are automatically printed as:
% <tab> message
$$$ signals end of message
-------------BEGIN------------ ---
--> ?
% gs to default$$$moved$$$updating channel settings to default$$$
% Board ADS Registers
% ADS_ID, 00, 3E, 0, 0, 1, 1, 1, 1, 1, 0
% CONFIG1, 01, B6, 1, 0, 1, 1, 0, 1, 1, 0
% CONFIG2, 02, C0, 1, 1, 0, 0, 0, 0, 0, 0
% CONFIG3, 03, EC, 1, 1, 1, 0, 1, 1, 0, 0
% LOFF, 04, 02, 0, 0, 0, 0, 0, 0, 1, 0
% CH1SET, 05, 68, 0, 1, 1, 0, 1, 0, 0, 0
% CH2SET, 06, 68, 0, 1, 1, 0, 1, 0, 0, 0
% CH3SET, 07, 68, 0, 1, 1, 0, 1, 0, 0, 0
% CH4SET, 08, 68, 0, 1, 1, 0, 1, 0, 0, 0
% CH5SET, 09, 68, 0, 1, 1, 0, 1, 0, 0, 0
% CH6SET, 0A, 68, 0, 1, 1, 0, 1, 0, 0, 0
% CH7SET, 0B, 68, 0, 1, 1, 0, 1, 0, 0, 0
% CH8SET, 0C, 68, 0, 1, 1, 0, 1, 0, 0, 0
% BIAS_SENSP, 0D, FF, 1, 1, 1, 1, 1, 1, 1, 1
% BIAS_SENSN, 0E, FF, 1, 1, 1, 1, 1, 1, 1, 1
% LOFF_SENSP, 0F, 00, 0, 0, 0, 0, 0, 0, 0, 0
% LOFF_SENSN, 10, 00, 0, 0, 0, 0, 0, 0, 0, 0
% LOFF_FLIP, 11, 00, 0, 0, 0, 0, 0, 0, 0, 0
% LOFF_STATP, 12, 00, 0, 0, 0, 0, 0, 0, 0, 0
% LOFF_STATN, 13, 00, 0, 0, 0, 0, 0, 0, 0, 0
% GPIO, 14, 0F, 0, 0, 0, 0, 1, 1, 1, 1
% MISC1, 15, 00, 0, 0, 0, 0, 0, 0, 0, 0
% MISC2, 16, 00, 0, 0, 0, 0, 0, 0, 0, 0
% CONFIG4, 17, 00, 0, 0, 0, 0, 0, 0, 0, 0
%
% LIS3DH Registers
% 0x07 00
% 0x08 00
% 0x09 00
% 0x0A 00
% 0x0B 00
% 0x0C 00
% 0x0D 00
% 0x0E 00
% 0x0F 33
%
% 0x1F 00
% 0x20 08
% 0x21 00
% 0x22 00
% 0x23 18
% 0x24 00
% 0x25 00
% 0x26 00
% 0x27 00
% 0x28 00
% 0x29 00
% 0x2A 00
% 0x2B 00
% 0x2C 00
% 0x2D 00
% 0x2E 00
% 0x2F 20
% 0x30 00
% 0x31 00
% 0x32 00
% 0x33 00
%
% 0x38 00
% 0x39 00
% 0x3A 00
% 0x3B 00
% 0x3C 00
% 0x3D 00
$$$
3) We have data
The Problem:
After playing around with permissions and drivers I get a blue light on the USB dongle, a working /dev/ttyUSB0, a successful connection to the Cyton card, and even raw data via OpenBCI_Python. However, I can't get the standalone Java GUI working.
Some Extra Incidental Information:
I'm using Centos 7 (kernel is 4.8.12-1.el7.elrepo.x86_64) - my other
Centos Box running a slightly older kernel (3.10) and version of
ftdi_sio.ko doesn't seem detect the USB at all. I plan to fix that later (and advice on that welcome!). But for now, I'd just like to see some pretty pictures.
1) The Hardware is OK:
# lsusb
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 002: ID 045e:0745 Microsoft Corp. Nano Transceiver v1.0 for Bluetooth
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 002: ID 0403:6015 Future Technology Devices International, Ltd Bridge(I2C/SPI/UART/FIFO)
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
2) We can connect to the Cyton (and Daisy) card:
# python ./user.py -p /dev/ttyUSB0 --add print --add csv_collect foo.csv
------------user.py-----------
Board type: OpenBCI Cyton (v3 API)
('Port: ', '/dev/ttyUSB0')
------------SETTINGS----------
Notch filtering:True
user.py: Logging Disabled.
-------INSTANTIATING BOARD-------
Connecting to V3 at port /dev/ttyUSB0
Serial established...
OpenBCI V3 8-16 channel
On Board ADS1299 Device ID: 0x3E
On Daisy ADS1299 Device ID: 0x3E
LIS3DH Device ID: 0x33
Firmware: v3.0.0
$$$
No daisy:
(8, 'EEG channels and', 3, 'AUX channels at', 250.0, 'Hz.')
------------PLUGINS-----------
Found plugins:
[ sample_rate ]
[ streamer_tcp ]
[ streamer_lsl ]
[ streamer_osc ]
[ csv_collect ]
[ noise_test ]
[ print ]
[ udp_server ]
Activating [ print ] plugin...
Print activated
Plugin [ print] added to the list
Activating [ csv_collect ] plugin...
Will export CSV to:foo.csv_2017-10-1_18-27-52.
Plugin [ csv_collect] added to the list
--------------INFO------------
User serial interface enabled...
View command map at http://docs.openbci.com.
Type /start to run (/startimp for impedance
checking, if supported) -- and /stop
before issuing new commands afterwards.
Type /exit to exit.
Board outputs are automatically printed as:
% <tab> message
$$$ signals end of message
-------------BEGIN------------
--> ?
% gs to default$$$moved$$$updating channel settings to default$$$
% Board ADS Registers
% ADS_ID, 00, 3E, 0, 0, 1, 1, 1, 1, 1, 0
% CONFIG1, 01, B6, 1, 0, 1, 1, 0, 1, 1, 0
% CONFIG2, 02, C0, 1, 1, 0, 0, 0, 0, 0, 0
% CONFIG3, 03, EC, 1, 1, 1, 0, 1, 1, 0, 0
% LOFF, 04, 02, 0, 0, 0, 0, 0, 0, 1, 0
% CH1SET, 05, 68, 0, 1, 1, 0, 1, 0, 0, 0
% CH2SET, 06, 68, 0, 1, 1, 0, 1, 0, 0, 0
% CH3SET, 07, 68, 0, 1, 1, 0, 1, 0, 0, 0
% CH4SET, 08, 68, 0, 1, 1, 0, 1, 0, 0, 0
% CH5SET, 09, 68, 0, 1, 1, 0, 1, 0, 0, 0
% CH6SET, 0A, 68, 0, 1, 1, 0, 1, 0, 0, 0
% CH7SET, 0B, 68, 0, 1, 1, 0, 1, 0, 0, 0
% CH8SET, 0C, 68, 0, 1, 1, 0, 1, 0, 0, 0
% BIAS_SENSP, 0D, FF, 1, 1, 1, 1, 1, 1, 1, 1
% BIAS_SENSN, 0E, FF, 1, 1, 1, 1, 1, 1, 1, 1
% LOFF_SENSP, 0F, 00, 0, 0, 0, 0, 0, 0, 0, 0
% LOFF_SENSN, 10, 00, 0, 0, 0, 0, 0, 0, 0, 0
% LOFF_FLIP, 11, 00, 0, 0, 0, 0, 0, 0, 0, 0
% LOFF_STATP, 12, 00, 0, 0, 0, 0, 0, 0, 0, 0
% LOFF_STATN, 13, 00, 0, 0, 0, 0, 0, 0, 0, 0
% GPIO, 14, 0F, 0, 0, 0, 0, 1, 1, 1, 1
% MISC1, 15, 00, 0, 0, 0, 0, 0, 0, 0, 0
% MISC2, 16, 00, 0, 0, 0, 0, 0, 0, 0, 0
% CONFIG4, 17, 00, 0, 0, 0, 0, 0, 0, 0, 0
%
% LIS3DH Registers
% 0x07 00
% 0x08 00
% 0x09 00
% 0x0A 00
% 0x0B 00
% 0x0C 00
% 0x0D 00
% 0x0E 00
% 0x0F 33
%
% 0x1F 00
% 0x20 08
% 0x21 00
% 0x22 00
% 0x23 18
% 0x24 00
% 0x25 00
% 0x26 00
% 0x27 00
% 0x28 00
% 0x29 00
% 0x2A 00
% 0x2B 00
% 0x2C 00
% 0x2D 00
% 0x2E 00
% 0x2F 20
% 0x30 00
% 0x31 00
% 0x32 00
% 0x33 00
%
% 0x38 00
% 0x39 00
% 0x3A 00
% 0x3B 00
% 0x3C 00
% 0x3D 00
$$$
3) We have data
Here we can even see the data get dumped and the values move around when I put my finger on the pins as per the tutorial
# head foo.csv_2017-10-1_18-27-52.csv
%2017-10-1_18-27-52
63.9079949856,0,-149565. 826305,-73732.5935045,-149967. 867132,-150050.523883,-149872. 559294,-67782.2015026,-149977. 545438,-149660.731812,0.04,-0. 052,0.482,
63.9119901657,1,-149566. 228636,-73715.9638066,-149956. 601853,-150368.745669,-149850. 252253,-67762.0402291,-149949. 449295,-149682.323597,0.0,0.0, 0.0,
63.9159660339,2,-149561.53477, -73710.3758705,-149916.346361, -150800.55902,-149886.886762,- 67745.9469731,-150005.529822,- 149649.891216,0.0,0.0,0.0,
63.9219050407,3,-149561. 981805,-73736.0803766,-149885. 568009,-150855.097277,-149879. 644797,-67765.8847291,-150004. 881621,-149614.687218,0.0,0.0, 0.0,
63.9240169525,4,-149564. 261683,-73763.5730223,-149882. 036433,-150827.8505,-149856. 935424,-67788.7952672,-149985. 100327,-149616.207137,0.0,0.0, 0.0,
63.9278349876,5,-149561. 423011,-73786.4612086,-149893. 279361,-150796.155726,-149854. 968471,-67800.4852296,-149959. 015841,-149622.77855,0.0,0.0, 0.0,
63.9322280884,6,-149554. 717488,-73802.8226856,-149904. 92462,-150759.096534,-149877. 074346,-67802.7427557,-149955. 551321,-149646.404343,0.0,0.0, 0.0,
63.9360470772,7,-149556. 349165,-73820.189991,-149888. 429032,-150724.205461,-149853. 046221,-67812.8010407,-150016. 281011,-149637.418942,0.084,- 0.1,0.968,
63.9401521683,8,-149556. 773848,-73843.547564,-149892. 161774,-150694.544696,-149860. 176427,-67825.9438665,-150007. 228554,-149622.733846,0.0,0.0, 0.0,
tail foo.csv_2017-10-1_18-27-52.csv
125.866744995,158,84090. 7048095,-14302.7248147,-58312. 3932257,-58549.2099582,-2006. 85137592,-55487.8703341,94936. 8664547,121414.988806,0.0,0.0, 0.0,
125.868765116,159,84090. 7942165,-14373.8257139,-58304. 234839,-58476.8797132,-2024. 64336451,-55490.0384533,94938. 498132,121417.156925,0.0,0.0, 0.0,
125.872619152,160,84089. 5201671,-14445.4854066,-58307. 9675803,-58343.506854,-2041. 49657983,-55491.9159999,94938. 8334082,121417.939236,0.0,0.0, 0.0,
125.878283024,161,84089. 2742979,-14487.8196106,-58371. 0442032,-58206.1553843,-2031. 97473669,-55463.7751536,94940. 6662513,121420.241466,0.0,0.0, 0.0,
125.881510973,162,84089. 1848909,-14497.7884886,-58364. 6516043,-58638.1251977,-1997. 32953278,-55404.1630511,94942. 3873356,121422.454288,0.09,-0. 092,0.974,
125.88560605,163,84089. 1625391,-14527.0022186,-58308. 0122838,-59244.3492108,-1984. 03024483,-55367.7744112,94944. 1307717,121424.600056,0.0,0.0, 0.0,
125.890715122,164,84086. 7932542,-14592.3140159,-58284. 0065103,-59336.3266392,-2010. 5617655,-55368.6908327,94943. 5943298,121424.533001,0.0,0.0, 0.0,
125.893676996,165,84086. 8826612,-14659.5480632,-58283. 6488823,-59263.5270075,-2037. 58502455,-55375.7986874,94945. 5612833,121426.924637,0.0,0.0, 0.0,
125.896604061,166,84086. 6591438,-14727.9220495,-58280. 6761003,-59193.2978264,-2064. 65298708,-55383.0183009,94947. 1035537,121428.936294,0.0,0.0, 0.0,
125.901865959,167,84084. 6921903,-14805.8402307,-58281. 6148736,-59123.6497907,-2099. 02997005,-55387.3768911,94946. 723574,121429.092756,0.0,0.0, 0.0,
%2017-10-1_18-27-52
63.9079949856,0,-149565.
63.9119901657,1,-149566.
63.9159660339,2,-149561.53477,
63.9219050407,3,-149561.
63.9240169525,4,-149564.
63.9278349876,5,-149561.
63.9322280884,6,-149554.
63.9360470772,7,-149556.
63.9401521683,8,-149556.
tail foo.csv_2017-10-1_18-27-52.csv
125.866744995,158,84090.
125.868765116,159,84090.
125.872619152,160,84089.
125.878283024,161,84089.
125.881510973,162,84089.
125.88560605,163,84089.
125.890715122,164,84086.
125.893676996,165,84086.
125.896604061,166,84086.
125.901865959,167,84084.
Only thing I don't like about this output is that it appears that I am only getting 8 channels rather than 16 I expect with the Daisy plugged in.
4) BUT I can seem to get OpenBCI_GUI to work
4) BUT I can seem to get OpenBCI_GUI to work
The GUI starts up nicely and works with synthetic data but when I click on "Live (from Cyton)" I get:
"Unable to establish link to Hub" at the bottom of the GUI
terminal stderr output from the GUI:
# ./OpenBCI_GUI
Launching application from local data dir
OpenBCI_GUI: hubStart: OS Detected: Linux
Welcome to the Processing-based OpenBCI GUI!
Last update: 9/5/2016
For more information about how to work with this code base, please visit: http://docs.openbci.com/ OpenBCI%20Software/
Graphics & GUI Library: ControlP5 2.2.6 infos, comments, questions at http://www.sojamo.de/ libraries/controlP5
attempting to load images for presentation...
DONE loading images!
java.net.ConnectException: Connection refused (Connection refused)
at java.net.PlainSocketImpl. socketConnect(Native Method)
at java.net. AbstractPlainSocketImpl. doConnect( AbstractPlainSocketImpl.java: 350)
at java.net. AbstractPlainSocketImpl. connectToAddress( AbstractPlainSocketImpl.java: 206)
at java.net. AbstractPlainSocketImpl. connect( AbstractPlainSocketImpl.java: 188)
at java.net.SocksSocketImpl. connect(SocksSocketImpl.java: 392)
at java.net.Socket.connect( Socket.java:589)
at java.net.Socket.connect( Socket.java:538)
at java.net.Socket.<init>(Socket. java:434)
at java.net.Socket.<init>(Socket. java:211)
at processing.net.Client.<init>( Unknown Source)
at OpenBCI_GUI$Hub. startTCPClient(OpenBCI_GUI. java:12101)
at OpenBCI_GUI$Hub.<init>( OpenBCI_GUI.java:12077)
at OpenBCI_GUI.systemUpdate( OpenBCI_GUI.java:927)
at OpenBCI_GUI.draw(OpenBCI_GUI. java:428)
at processing.core.PApplet. handleDraw(PApplet.java:2437)
at processing.opengl. PSurfaceJOGL$DrawListener. display(PSurfaceJOGL.java:849)
at jogamp.opengl. GLDrawableHelper.displayImpl( GLDrawableHelper.java:692)
at jogamp.opengl. GLDrawableHelper.display( GLDrawableHelper.java:674)
at jogamp.opengl. GLAutoDrawableBase$2.run( GLAutoDrawableBase.java:443)
at jogamp.opengl. GLDrawableHelper.invokeGLImpl( GLDrawableHelper.java:1293)
at jogamp.opengl. GLDrawableHelper.invokeGL( GLDrawableHelper.java:1147)
at com.jogamp.newt.opengl. GLWindow.display(GLWindow. java:759)
at com.jogamp.opengl.util. AWTAnimatorImpl.display( AWTAnimatorImpl.java:81)
at com.jogamp.opengl.util. AnimatorBase.display( AnimatorBase.java:452)
at com.jogamp.opengl.util. FPSAnimator$MainTask.run( FPSAnimator.java:178)
at java.util.TimerThread. mainLoop(Timer.java:555)
at java.util.TimerThread.run( Timer.java:505)
Instantiating hub object...
click
SHUTDOWN HOOK
X11Util.Display:
Shutdown (JVM shutdown: true, open (no close attempt): 2/2, reusable
(open, marked uncloseable): 0, pending (open in creation order): 2)
X11Util: Open X11 Display Connections: 2
X11Util: Open[0]: NamedX11Display[:0, 0x7ff1c0001850, refCount 1, unCloseable false]
X11Util: Open[1]: NamedX11Display[:0, 0x7ff1c000e530, refCount 1, unCloseable false]
Killed: 6936 pts/3 00:00:00 OpenBCIHub
Killed: 6941 pts/3 00:00:00 OpenBCIHub
Killed: 6981 pts/3 00:00:00 OpenBCIHub
SHUTDOWN HUB
Launching application from local data dir
OpenBCI_GUI: hubStart: OS Detected: Linux
Welcome to the Processing-based OpenBCI GUI!
Last update: 9/5/2016
For more information about how to work with this code base, please visit: http://docs.openbci.com/
Graphics & GUI Library: ControlP5 2.2.6 infos, comments, questions at http://www.sojamo.de/
attempting to load images for presentation...
DONE loading images!
java.net.ConnectException: Connection refused (Connection refused)
at java.net.PlainSocketImpl.
at java.net.
at java.net.
at java.net.
at java.net.SocksSocketImpl.
at java.net.Socket.connect(
at java.net.Socket.connect(
at java.net.Socket.<init>(Socket.
at java.net.Socket.<init>(Socket.
at processing.net.Client.<init>(
at OpenBCI_GUI$Hub.
at OpenBCI_GUI$Hub.<init>(
at OpenBCI_GUI.systemUpdate(
at OpenBCI_GUI.draw(OpenBCI_GUI.
at processing.core.PApplet.
at processing.opengl.
at jogamp.opengl.
at jogamp.opengl.
at jogamp.opengl.
at jogamp.opengl.
at jogamp.opengl.
at com.jogamp.newt.opengl.
at com.jogamp.opengl.util.
at com.jogamp.opengl.util.
at com.jogamp.opengl.util.
at java.util.TimerThread.
at java.util.TimerThread.run(
Instantiating hub object...
click
SHUTDOWN HOOK
X11Util.Display:
Shutdown (JVM shutdown: true, open (no close attempt): 2/2, reusable
(open, marked uncloseable): 0, pending (open in creation order): 2)
X11Util: Open X11 Display Connections: 2
X11Util: Open[0]: NamedX11Display[:0, 0x7ff1c0001850, refCount 1, unCloseable false]
X11Util: Open[1]: NamedX11Display[:0, 0x7ff1c000e530, refCount 1, unCloseable false]
Killed: 6936 pts/3 00:00:00 OpenBCIHub
Killed: 6941 pts/3 00:00:00 OpenBCIHub
Killed: 6981 pts/3 00:00:00 OpenBCIHub
SHUTDOWN HUB
Appreciate your help in advance!
Comments
Turns out that ./application.linux64/data/OpenBCIHub requires a fairly recent version of libstdc++.so.6 (GLIBCXX_3.4.21) and doesn't actually start up. You can tell by running it:
./OpenBCIHub
and getting an exception.
problem was you can't really tell from the GUI stderr as the error is probably caught in a try catch loop. When I get more familiar with this code, hopefully I can try to push some cleaner error reporting.
I "fixed" this by using v2.2 rather than v3.01 of the GUI.
Hope this is useful for someone.