Login | Register 
FEATURES
APPLICATIONS
DOWNLOADS
EDUCATION
BLOG
WIKI
FORUM
STORE

NeuroSky MindWave EEG system

Discuss graphics hardware, computer hardware, and input/output devices to use with TouchDesigner

NeuroSky MindWave EEG system

Postby jd » Mon Mar 05, 2012 5:05 pm

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: http://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 http://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
Attachments
EEG test 1.1.toe
(13.46 KiB) Downloaded 120 times
jd
 
Posts: 2
Joined: Sun Mar 04, 2012 1:17 pm

Re: NeuroSky MindWave EEG system

Postby jd » Mon Mar 05, 2012 5:26 pm

I've attached some example data from the DAT.
Attachments
example data.txt
(6.97 KiB) Downloaded 103 times
jd
 
Posts: 2
Joined: Sun Mar 04, 2012 1:17 pm

Re: NeuroSky MindWave EEG system

Postby rob » Mon Mar 05, 2012 6:31 pm

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
Attachments
EEG test 1.2.toe
(13.78 KiB) Downloaded 117 times
User avatar
rob
Staff
 
Posts: 1492
Joined: Tue Nov 13, 2007 1:14 am

Re: NeuroSky MindWave EEG system

Postby greenpattern » Tue Apr 10, 2018 12:03 pm

https://www.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!
User avatar
greenpattern
 
Posts: 193
Joined: Tue Dec 01, 2015 3:05 pm
Location: Edinburgh Scotland, but I'm french


Return to Hardware

Who is online

Users browsing this forum: No registered users and 2 guests