NeuroSky MindWave EEG system

Hello,

I’m brand new to TD and I’ve been trying to read in EEG headset data from a NeuroSky Mindwave.

Here’s what I’ve hacked together using the Binary Socket Packet Format.The headset automatically starts transmitting at 1 Hz, which is fine for now (I don’t need the raw EEG data, only the highly processed eSense attention/relaxation values). See here for the format: cs.mcgill.ca/~bdever1/306/binary … otocol.pdf

I did this:

  1. Set up a TCP IN DAT on port 13854 set to one row per message. This gives one message per second. So far so good, data comes streaming in.
  2. Now, I would like to parse each message. In particular, I would like bytes 0x04 and 0x05, corresponding to the eSense attention/mediation values. I tried using string operations with an Evaluate DAT, eg. ctof(substr($V,6,1)) to try and parse out something useful. Hopefully I could also get the big-endian floats for low alpha, high alpha, low beta, and high beta (at index 18-21,22-25,26-29,30-33). However, parsing this out properly has stumped me.

Eventually I would like to communicate with the server to do things like change the sample rate. It looks like I would need a JSON parser to do things properly (see developer.neurosky.com/docs/lib/ … otocol.pdf ).

Any ideas on how to parse the binary so I could get some integers and floats for the right attention/relaxation/alpha/beta bytes? My newness to tscript has been holding me back here.

jd
EEG test 1.1.toe (13.5 KB)

I’ve attached some example data from the DAT.
example data.txt (6.97 KB)

Hi jd.

A few notes:

tcp/ip really just produces a stream, not discrete messages. Even though TouchDesigner offers ‘One Row Per Message’, there’s no guarantee each row will start with AA, AA (or 170, 170)
The most reliable setup, would be ‘One Row Per Byte’ and running a script to parse one byte at a time, looking for two consecutive AA’s etc. But for now, your setup should suffice.

To select out individual columns, use the select DAT.
First select out the value column (stripping out the first row of names).
Then convert that to a table by using space as a delimiter
Then select out the column you need.
You can then convert to a CHOP more readily.

Ive included a little toe file showing that.

It still assumes the bytes come in the same order, which the protocol says they may not.
Again, the best workaround would be a script parsing one byte at a time, keeping local variables.

In terms of converting 4 bytes to floats, could probably be done with an expression CHOP.
by following the ieee format.

Does that help move things further?

Cheers
Rob
EEG test 1.2.toe (13.8 KB)

youtube.com/watch?v=0ZQ3AjtknEk&t=195s

So you think we can do this with the data you guys extracted from device?

I’m surprised there is not more interest in possible telepathic link with touch designer!