Skip to content

ADD: WiFi Shield support #51

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
andrewjaykeller opened this issue Sep 9, 2017 · 14 comments
Open

ADD: WiFi Shield support #51

andrewjaykeller opened this issue Sep 9, 2017 · 14 comments

Comments

@andrewjaykeller
Copy link

Driver for openbci wifi shield!

Let's do it!

@jfrey-xx
Copy link
Contributor

jfrey-xx commented Sep 9, 2017

It'd be my pleasure to look into that... should I have a wifi shield to get my hands on 😛

Is the only difference the way to acquire raw data (i.e. through wifi instead of BLE)? Apart from that did the protocole change?

andrewjaykeller pushed a commit to andrewjaykeller/OpenBCI_Python that referenced this issue Sep 9, 2017
@andrewjaykeller
Copy link
Author

@jfrey-xx i think the first thing i will so is just build the device discovery part, add a function to connect, and send commands to the board, and stream data over in JSON with nano_volts. I don't really want to spend all the time on the raw mode hahah if you want to, you can take the code i write for connecting to it and such and write the code to have the board send raw. Faster sample rates are possible with raw for sure! but sample rates (500Hz daisy) and (800Hz) ganglion should be possible with JSON. Going for MVP here. Going to write these types of drivers in as many languages as i can :)

@andrewjaykeller
Copy link
Author

yea i think you need a wifi shield!

@andrewjaykeller
Copy link
Author

Is the only difference the way to acquire raw data (i.e. through wifi instead of BLE)? Apart from that did the protocole change?

Yes! In raw mode, the wifi shield will send the classic 33byte with 0xA0 and 0xCn where n is 0-F. The ganglion over raw mode with wifi will send the same thing, just have four empty channels, but will have full 24bit resolution instead of 18/19 bit delta compression.

@jfrey-xx
Copy link
Contributor

jfrey-xx commented Sep 9, 2017

Same raw format and a JSON version? Neat ;)

@andrewjaykeller
Copy link
Author

andrewjaykeller commented Sep 9, 2017

Yea the raw format is so you can pipeline to existing parsers. The JSON sends:

{
  "chunk": [
    {
      "timestamp": ...,
      "data": [
         ....
       ]
    },
    {
      "timestamp": ...,
      "data": [
         ....
       ]
    }
  ]
}

Time is in micro seconds and data is in nano volts. Time is from an NTP server.

The WiFi shield knows the gains for each channel so the hard work is done on the board!

andrewjaykeller pushed a commit to andrewjaykeller/OpenBCI_Python that referenced this issue Sep 12, 2017
andrewjaykeller pushed a commit to andrewjaykeller/OpenBCI_Python that referenced this issue Sep 13, 2017
andrewjaykeller pushed a commit to andrewjaykeller/OpenBCI_Python that referenced this issue Sep 13, 2017
@andrewjaykeller
Copy link
Author

@jfrey-xx hey i need some help/advice

I am trying to open a tcp server and have it run all from the init function of OpenBCIWifi() but the thing is the server requires an asyncore.loop() which is blocking. So how do i start the server and keep going with the init function?

Thanks!

@jfrey-xx
Copy link
Contributor

It has been a long time since I fought with TCP directly, quickly I'd say you could use a timeout parameter (if effective) to avoid anything blocking, or just use a dedicated (sub)class using Thread for opening socket and sending/receiving data. ...but you must have thought of this, no? I might be missing the point.

andrewjaykeller pushed a commit to andrewjaykeller/OpenBCI_Python that referenced this issue Sep 13, 2017
@andrewjaykeller
Copy link
Author

Well i got an MVP working, it's printing JSON data to the console. I need some help making it route nicely like yours does but it's a rough demo and more importantly you can check out how cool and easy it is!!!! AH i love it haha

andrewjaykeller pushed a commit to andrewjaykeller/OpenBCI_Python that referenced this issue Sep 13, 2017
@andrewjaykeller
Copy link
Author

Thread for opening socket and sending/receiving data

Probably a good way to do this. This is so easy in javascript land haha

andrewjaykeller pushed a commit to andrewjaykeller/OpenBCI_Python that referenced this issue Sep 21, 2017
@andrewjaykeller
Copy link
Author

Picking this back up this weekend to add the high speed streaming that is now standard on 2.0.2

andrewjaykeller pushed a commit to andrewjaykeller/OpenBCI_Python that referenced this issue Jan 13, 2018
@andrewjaykeller
Copy link
Author

andrewjaykeller commented Jan 13, 2018

@jfrey-xx

I am making this a legit PyPi package like the TODO requested :)

andrewjaykeller pushed a commit to andrewjaykeller/OpenBCI_Python that referenced this issue Jan 13, 2018
andrewjaykeller pushed a commit to andrewjaykeller/OpenBCI_Python that referenced this issue Jan 13, 2018
@andrewjaykeller andrewjaykeller mentioned this issue Jan 13, 2018
Merged
@jfrey-xx
Copy link
Contributor

jfrey-xx commented Jan 29, 2018

...I did not have the opportunity to catch-up with your last dev; passing by to congratulate you, @aj-ptw you did an impressive amount of work. With proper documentation, tests, packaging, the branch you are working on will deserve the mighty "1.0.0" milestone ;)

@posipunk
Copy link

Just sent a pull request. I found the Wifi support challenging to get up and running. Had to make several modifications and additions per Cyton SDK to get channels set up.
Still not sure the data coming back from the Cyton is correct though - doesn't appear to be parsed similarly to how the GUI would parse the data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants