1/12/13

brainwaves

bought mindwave

A while back, I got a NeuroSky MindWave Mobile. I tried it out, and it showed me a bunch of real-time stats for things like "delta" and "gamma" waves, but the numbers seemed erratic. It even coalesced these into "attention" and "meditation", but even those numbers seemed erratic.

I figured that these numbers might make more sense if I averaged them over a longer timespan, like a minute. But I couldn't find a tool that would just record what my brain did for a minute, and show me a graph.

So I looked at their developer tools. They have something called ThinkGear Connector, which is a local server process that exposes serial-port data coming from the bluetooth headset as a socket. I connect to this with node.js.

recorded data

Here is a link to my code. It also has some data.

A couple technical notes:

1. The ThinkGear Connector server needs to be turned on somehow before it connects to the headset and streams data. I think this can be done by sending an appropriate command to it over the socket. However, I found it easier for now to run the MindWave Mobile Tutorial, which turns it on, and then I essentially eavesdrop on socket data that is intended to be read by that program.

2. Update: I had originally thought that the JSON data streaming from the ThinkGear Connector was overwriting itself in a weird way. Actually, ThinkGear Connector was sending '\r' instead of '\n' for newlines, and this was being displayed in a weird way in my terminal window. Oops.

results

Here is my "attention" and "meditation" levels over the course of one minute:


It seems that I was attentive for the first 30 seconds, and then more meditative. The two seem to be opposites of each other.

Here's the Mathematica (Really? Mathematica? Yup, I paid $150 for a 1-year "home" subscription. We'll see how it goes. I would have used Excel, but it isn't installed since I wiped my machine. I know people have their open-source programmatic plotting libraries of choice, but I haven't seen one as easy as Excel. If you know of one, especially one that works with node.js, let me know.) code for generating that plot:

a = Import["~/Dropbox/github/node-mindwave/attention.txt", "Table"]

m = Import["~/Dropbox/github/node-mindwave/meditation.txt", "Table"]

ListPlot[{a, m}, Joined -> True, PlotStyle -> {Red, Blue}, PlotLegends -> {"attention", "meditation"}, PlotRange -> {{0, 60}, {0, 100}}]

Also, here's my average attention: N[Mean[a[[All, 2]]]] = 54.65

And here's my average meditation: N[Mean[a[[All, 2]]]] = 48.1667

I believe these are on a scale from 0 to 100, where I guess I'm in the middle.

future work

I'm thinking of recording these stats periodically, to perhaps get a sense for my biorhythms. I'm not sure where to record it. I'll probably put it in this blog for now, but I suspect there is some sort of online tool for recording personal stats over time, and seeing graphs (let me know!).

I'm also planning to run a Fourier transform on the raw EEG data, and see how that compares to the coalesced data coming from the device itself.

No comments:

Post a Comment