Home » Brain, Featured, Headline, Java, Open Source, Quantified Self, Technology

MindStream – NeuroSky EEG Data Streamer

Submitted by on July 24, 2011 – 11:33 am 13,172 views 24 Comments

Since I last posted on the NeuroSky Brainwave Visualizer, I decided to write a simple app to “stream” brainwave/EEG data from NeuroSky devices (the MindWave & MindSet).  I couldn’t find any apps to save the EEG data so I decided to write a system tray app that will save data to a file and broadcast so other applications can consume the data.  The app is released as open source, requires Java (1.6 and above), and is currently in an alpha release.  Here is a brief overview from my new GitHub page https://github.com/ericblue/MindStream:

README

# Author: Eric Blue
# 	url   = http://eric-blue.com/
#   email = ericblue76 (at) gmail (dot) com
# Project: Neurosky Mindstream - System tray app to stream EEG data 

[Overview]

Mindstream is a simple java-based system tray app that streams EEG brainwave data from
NeuroSky devices (MindWave,MindSet).  The app interfaces to NeuroSky devices using the
ThinkGear Socket protocol (connecting on localhost:13854), retrieves data in JSON
Format, and can "stream" to other applications.  Mindstream can save the following
data:

	* Focus levels
		- attention
		- meditation
	* EEG values
		- delta
		- theta
		- lowAlpha
		- highAlpha
		- lowBeta
		- highBeta
		- lowGamma
		- highGamma
	* Headset signal strength
		- poorSignalLevel

Streaming functions will include:

    * Saving EEG data to a CSV File
    * Listen on a socket and replay data from localhost:13854
    	- allowing other applications to connect
    * Broadcast to a URL - supporting POST/M-POST and streaming real-time data
    	- future use? Processing Javascript version of the
                Neurosky BrainWave Visualizer
    		http://eric-blue.com/2011/07/13/neurosky-brainwave-visualizer/

[Current Status]

- Alpha state
- Streaming only supports writing to a CSV file
- Tested on Linux and Windows with Java 1.6 and the MindWave headset

Post to Twitter Post to Delicious

24 Comments »

  • Stephen Lark says:

    This isn’t directly related to NeuroSky (good work BTW – try not to brick your brain if you jailbreak it – it would be a bugger to plug it into iTunes to restore it to factory settings :) , but I thought of you & your QS comrades when I read this:

    Apple’s Adoption of Bluetooth Low Energy Paves Way for New Possibilities
    http://www.macrumors.com/2011/07/25/apples-adoption-of-bluetooth-low-energy-paves-way-for-new-possibilities/

    FTA:

    Possible uses commonly listed for Bluetooth Low Energy include:

    • Find Me – electronic leash applications
    • Proximity – wireless locking and unlocking, out of range alerts
    • Sports / Running – stats and vitals
    • Health – heart rate monitor, blood pressure, glucose

  • ericblue76 says:

    Hi Stephen,

    Thanks for the article. This IS very interesting!

    And yes, I’m definitely staying away from any jailbreaking in this category :)

  • optimizerx says:

    Hi, Eric.

    “Broadcast to a URL” – could this feature also support multiple users contributing their individual brain scans?

  • ericblue76 says:

    Hi,

    Absolutely. I was envisioning some sort of web service that could simultaneously plot brainwave activity for multiple people.

  • tom says:

    Hi Eric, I was hoping to find a web-based version of Neurosky’s visualizer. Like to be able to see a client’s live eeg waves (through visualizer) from a remote location during phone consultation. Any advice appreciated.

  • ericblue76 says:

    Hi Tom,

    I modified the Processing-based brainwave visualizer (http://eric-blue.com/2011/07/13/neurosky-brainwave-visualizer/) to work with Neurosky. My plan was to eventually port this to Processing.js and create a web version. You could then use MindStream to send data to this web site in real-time and visualize the data.

    I don’t have a definite timeframe right now. But over the next few weeks I’ll start adding some of these features and will post on my progress.

  • tom says:

    Nice!!

  • Yann R says:

    Check OpenViBE, you’ll be able to acquire the signals and process them in realtime

    http://openvibe.inria.fr

  • Reggie says:

    Any way to get the CSV file working on a mac? I can copy and paste the output on a mac to a text file, but it would require some heavy manipulation in excel to extract the data.

  • ericblue76 says:

    Hi Reggie,

    There was an issue with saving CSV files on some platforms. I put the fix in place and you can download the updated version at https://github.com/ericblue/MindStream

  • [...] Mindstream – Neurosky EEG Data streamer [...]

  • Eric says:

    Hi, I was just trying out your app and while it seems to record & display data, It won’t save the CSV to the designated location still.

    I’m on Windows 7.

    Thanks for your work.

  • Alex says:

    Hi,
    I just tried your eeg data streamer, and it works wonderfully.
    Just when I try to save the csv data, it creates the file but won’t write the data to file.
    Could anyone here who uses Mac give some insight into this issue.

    Thanks,
    Alex

  • Mark says:

    Great idea, much appreciated.
    One question – I am trying to use the software with a MyndPlay BrainBand, which uses the Neurosky hardware.
    I am able to connect to the BrainBand with ThinkGearConnector, can see the real-time EEG data (via JSON), but no joy trying to save the CSV file.
    Have tried on both PC and Mac, seems to work but the file is not generated.
    Is it the hardware or perhaps I’m missing a step?

  • JA says:

    Directions on how to output data to a file using Mac:
    1. Open terminal, cd ~/ericblue-MindStream-e3ae354
    2. Enter java -Djava.ext.dirs=lib -jar dist/mindstream.jar as given in the README file
    3. In terminal, it prints “loading prefs…”
    3. The mindstreamsystemtray icon will open at the top of the screen, click on it and select “Connect to ThinkGear Socket”. In terminal, it prints “Starting new connection…”
    4. To start collecting data directly to file, click again on the systemtray icon and select “MindStream” and “Save (File)”
    5. The data will printout in the open terminal window as it saves each line (sample) of data to the file. The file saves in directory /Users/computername/mindstream.csv by default, but you can change this by clicking on the systemtray icon and selecting “Preferences”. I changed my data output to a different file location and I output to a .txt file so I can import it into Matlab, instead of .csv.

    Note: I do get a JSON Error (JSONObject["poorSignalLevel"] not found.) notice because when you have a good connection the poor signal level measurement value is 0. It is a little annoying but I am sure you can turn off the notification somewhere in the code.

    Hope this helps! ^_^ Happy recording!

  • Ceria says:

    Thanks! =)

  • jeff lovely says:

    Hi Eric,

    Sorry for asking a stupid question but I have downloaded the zip file and the builds individually. I don’t really understand code. Any chance of getting some simple instructions on how to correctly download this. I would love to use it. I just opened and set up my unit and am shocked as well at the lack of actual apps. Luckily, I just want to be able to view my EEG data. You’re program looks perfect.

    Thanks, Jeff

  • sorin says:

    Hi,
    Is there any description on how to get your software running on windows?
    I’m not a wizard in programming and thus any help will be very much appreciated.

    Thank you in advance,
    Sorin

  • Ching Tat Lai says:

    Hi Eric

    I tried out your programs (MindSteamer and the brain grapher). Nice work. However, I like others have trouble save the data in CSV.

    I am using Win7 for testing.

    Thanks, CTLai

  • ericblue76 says:

    Hi CTLai,

    There were some edge conditions that may have caused problems with writing files in Windows. I’ve incorporated some bug fixes and uploaded a debug build (v1_02_debug). You can download this version at:

    https://github.com/ericblue/MindStream/tree/v1_02_debug

    Please give this a try and let me know if you have any further issues.

  • ericblue76 says:

    Hi @Sorin and @Jeff. For future versions the plan is to have an installer for Windows and Mac that fully automates the setup process. This is a bit of work, so for the time being on Windows there is a .bat file to launch the Mindstream program.

    1. Download the mindstream.zip file and unzip to a directory

    2. Make sure you have Java installed on your PC(http://java.com/en/download/index.jsp)

    3. Add the JAVA_HOME environment variable http://stackoverflow.com/a/6521412

    4. Add JAVA_HOME/bin to your PATH so you can run java in any directory
    http://stackoverflow.com/a/3024721

    5. Open up a command prompt (cmd), cd to the mindstream directory. Type mindstream.bat. If you get an error try typing:

    java -Djava.ext.dirs=lib -jar dist\mindstream.jar

    If you’ve done steps 3 and 4 this should work.

  • Caio says:

    Hello,
    I would like to know how I read the data on the mindtream.
    In other words I would like to know what the numbers such as
    low beta (25652) means.

    Thank You

  • ferran says:

    hi eric,

    is it possible to create an app for iphone or android that would stream from in situ experiences?

  • Robert says:

    Hi Eric,

    Is it possible to use Java to gather the raw eeg signal?

Leave a comment!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.