openbci-archive / OpenBCI_NodeJS_Wifi

NodeJS driver for the Wifi Shield
MIT License
16 stars 13 forks source link

signal stops when calling from javascript #33

Closed gerardklee closed 4 years ago

gerardklee commented 4 years ago

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.

Screen Shot 2020-01-09 at 2 11 48 PM
gerardklee commented 4 years ago

I wanted to add that streaming works perfectly fine with matlab.

Andrey1994 commented 4 years ago

I suppose you try to start streaming data from a board to openbci gui and to your js code at the same time. But it will never work as you expect because board sends data via tcp/udp socket without broadcast/multicast so there can be only one receiver.

If you need the same data in the GUI and in your JS code you should read data directly from a board in the GUI and stream it further using GUI networking widget but this SDK doesnt read data from networking widget this SDK reads data from a board. So you will need to write a code to receive it from scratch

gerardklee commented 4 years ago

Would you kindly and briefly tell me how I can implement receiving the data? Are there JS libraries for signal processing or anything for getting the data from OpenBCI type of GUI? When you say I have to write from 'scratch', does it mean I won't be able to use any JS signal processing libraries? Sorry for asking too many questions, but I really appreciate your help!

Andrey1994 commented 4 years ago

Try to use this sdk without GUI first so there will be only one data receiver.

If you wanna stream data from the GUI you can try js bunding for LSL or stream data via socket and read data from socket.

This lib has no signal processing algorithms its only for data acquisition, if JS is not crucial for you I would recommend to use brainflow instead https://brainflow.readthedocs.io/en/stable/ Currently there is no JS binding but there are signal processing API and many other languages. And I will add JS and julia later.

gerardklee commented 4 years ago

Thank you, @Andrey1994 . Your advice helped a lot!