muse-js icon indicating copy to clipboard operation
muse-js copied to clipboard

High incidence of NaNs running in Electron

Open jdpigeon opened this issue 6 years ago • 13 comments

I've been noticing a high incidence of NaN values in some of the experimental data collected in the BrainWave app.

One of the most recent experiments collected on OSX has NaNs throughout the entire dataset. NaNDataset.zip

I'll back when I get to the bottom of this. My suspicion is that this might be a web bluetooth specific issue

jdpigeon avatar Sep 27 '18 18:09 jdpigeon

Issue appears to get worse with high CPU usage

jdpigeon avatar Oct 13 '18 16:10 jdpigeon

From my experiences, NaNs usually indicate a bad link - For instance, I had many of them in my ngAtl 2018 talk, where I also had a really hard time connecting with the headset - probably due to some kind of radio interference in the venue.

Last year I experimented with different setups, and I found that Windows BLE Stack with the bluetooth adapter built into my laptop gave much worse results in comparison with an external BLE dongle with node-bluetooth-hci-socket (used by noble).

urish avatar Oct 13 '18 17:10 urish

Thanks Uri! That makes me feel a lot more comfortable, knowing that you've ran into the issue before. It's true, every time I've seen high NaNs is when using an internal bluetooth adapter rather than a dongle.

I imagine this is not something we'll have the power to fix ourselves. So, until web bluetooth gets another major update I'll make sure to go the dongle route when running really important demos.

Cheers

jdpigeon avatar Oct 13 '18 20:10 jdpigeon

@jdpigeon I'll just add that from my experience dealing with multiple stations (different laptops + muse) with over 100 hours usage per machine, bluetooth performs best using external dongle. even those cheap no-name brands always outperform the internal ones in terms of connection stability. crazy but true. perhaps the issues are related to the antenna, rather then the chipset.

oori avatar Oct 17 '18 07:10 oori

hi , i've implemented a webapp for classrooms and ran into this issue on some of the computers. We were in a small room and connecting 45 iMacs to 45 2016 muses. Some had good connections, some had almost half NaN. Seemed like students on the outside of the classroom had better luck. We guess it is older hardware in the iMacs and 45 bluetooth dongles may be needed for this kind of setup @urish @jdpigeon

kylemath avatar Jan 25 '20 21:01 kylemath

My guess is that it has to do with interference... Bluetooth has limited bandwidth, and 45 real-time EEG data streams sound too much

urish avatar Jan 25 '20 21:01 urish

I was impressed it worked at all. so if you are correct the dongle wouldn't help right

kylemath avatar Jan 25 '20 21:01 kylemath

"most of today’s Bluetooth technology use what’s called spread-spectrum frequency hopping. That is, they rotate between 70 randomly chose frequencies within their range, changing 1,600 times a second. This makes it unlikely that two devices will share the same frequency. And when they do, they won’t for very long. Other Bluetooth technology also employs what is called AFH, a technology that identifies “bad” channels (i.e. those that are already in use) and instigates a switch." - https://www.goldtouch.com/stop-bluetooth-interference-messing-devices/

kylemath avatar Jan 25 '20 21:01 kylemath

this is relevant: https://www.reddit.com/r/k12sysadmin/comments/993yab/bluetooth_headphones_in_classroom/

kylemath avatar Jan 25 '20 21:01 kylemath

Once during a live-demo of the Muse in my talk, I had an issue where I couldn't connect to the device at all. I'm not sure what was interfering on-stage, but I tried a dozen of times before in the adjacent room and it worked perfectly. You can watch me miserably try to make my computer speak to the muse with very little luck:

https://youtu.be/hTvWDkr7yrw?t=272

urish avatar Jan 25 '20 21:01 urish

oh yeah i've been there many times, also with paid participants and in the hospital in an experiment, that is why we love how each muse-js connects, thanks, תודה!

kylemath avatar Jan 25 '20 21:01 kylemath

I want to also chime in and say that we've also ran into on-stage bluetooth connectivity issues at CTRL-labs. It happens to everyone 😅

jdpigeon avatar Jan 26 '20 20:01 jdpigeon

Well all things considered our first try at running 45 muses in a class at once seems like a big success, actually biggest limiting factor was enough chairs for 90 students , not really a GitHub issue

kylemath avatar Jan 26 '20 20:01 kylemath