openbci-archive / openbci_nodejs_wifi Goto Github PK
View Code? Open in Web Editor NEWNodeJS driver for the Wifi Shield
License: MIT License
NodeJS driver for the Wifi Shield
License: MIT License
My Wifi shield has an address of 10.0.1.12 and is attached to a Ganglion board.
Able to connect and stream data using auto-detect and wifi direct on a Mac running OS X Mojave with OpenBCI_NodeJS_Wifi tests and in the Hub.
Using a Windows 10 machine, getStreamingWiFiDirect.js produces an error. This same error is happening in the current GUI when trying to connect, along with other errors stemming from a failure to connect.
PS C:\Users\Retiutut\Documents\GitHub\OpenBCI_NodeJS_Wifi\examples\getStreamingWiFiDirect> node getStreamingWifiDirect.js
TCP: on port: 51599
Attempting to connect to 10.0.1.12
-> POST: 10.0.1.12/tcp {"ip":"192.168.56.1","output":"raw","port":51599,"delimiter":false,"latency":16667}
server listening 192.168.56.1:62971
STATUS: 504
No more data in response.
BODY: {"connected":false,"delimiter":false,"ip":"192.168.56.1","output":"raw","port":51599,"latency":16667}
Error: ERROR: CODE: 504 MESSAGE: {"connected":false,"delimiter":false,"ip":"192.168.56.1","output":"raw","port":51599,"latency":16667}
at IncomingMessage.res.once (C:\Users\Retiutut\Documents\GitHub\OpenBCI_NodeJS_Wifi\openBCIWifi.js:1120:16)
at Object.onceWrapper (events.js:276:13)
at IncomingMessage.emit (events.js:193:15)
at endReadableNT (_stream_readable.js:1129:12)
at process.internalTickCallback (internal/process/next_tick.js:72:19)
Hi!
I was investigating connection issues related to our WiFi shield as can be seen on my forum post and finally narrowed it down to a very similar issue as #26.
We operate in a corporate setting where every machine has multiple network interfaces, the main one being an Ethernet connection that is heavily secured and through which any OpenBCI data transmission is hopeless. We thus opted for WiFi direct through a usb wifi antenna. When connecting the shield's network through this interface, we can see its ip address as 192.168.4.1
, and our computer's is 192.168.4.2
. However, the current nodejs implementation assumes that the local ip address must be the one assigned through Ethernet
, which in our case is a completely different address assigned starting with different numbers. As i long suspected, this is the source of our connection problems, as sockets between ip addresses of the shield's interface and our coporate addresses simply do not work.
Hardcoding 192.168.4.2
inside Wifi.prototype.getLocalIPAddress
solved the connection problem and I was able to see data streaming in the GUI for the first time, confirming this mismatch was definitely the issue.
As I can see, the current solution, implemented when solving #26, was based on @retiutut having the reverse problem, and thus Wifi.prototype.getLocalIPAddress
was hardcoded to use the address from the Ethernet interface. A more robust solution could either:
Wifi.prototype.getLocalIPAddress
to dynamically return an ip address that is "compatible" with the shield's address. This could be done by checking that both start with the same numbers in the first 2 "fields" of the ip, but there is probably a non-hacky way to do that with node APIs (I'm really not good at networking stuff)I will try to submit a PR regarding this, I think it would help adoption of the shield in more complex networking environments.
Hub version: 2.1.0
GUI version: 4.1.6
Shield firmware: 2.0.5
Hello,
As soon as I call the javascript function to start streaming, the signals on GUI completely stops. I am new to javascript, so I don't know if this is my code issue or the wifi shield issue. Attached is my block of code to get the data from the board. I would appreciate any help!
I am using macOS Mojave 10.14.6, OpenBCI_GUI 4.1.5
Thank you.
Hi,
I'm using this code as fundament in an electron app with the use of openbci-observables and eeg-pipes. I'm running on a MacBook Pro Late 2013. The sample rate is set to 200hz and latency to 10ms. When I run the electron application, it always stops after a couple seconds and returns "bad stop byte" and a different hexa-code every time. I've tried the application on a newer Macbook without problem. When I run the code only in terminal on my own Mac without electron, there's no problem. I really need some help regarding this.
Best,
Aksel
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.