MindStream – NeuroSky EEG Data Streamer

MindStream – NeuroSky EEG Data Streamer

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
(Visited 29,147 times, 1 visits today)

31 Responses

  1. 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

  2. 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 šŸ™‚

  3. optimizerx says:

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

  4. ericblue76 says:

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

  5. 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.

  6. 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.

  7. Yann R says:

    Check OpenViBE, you’ll be able to acquire the signals and process them in realtime
    http://openvibe.inria.fr

  8. 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.

  9. 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

  10. […] Mindstream – Neurosky EEG Data streamer […]

  11. 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.

  12. 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

  13. 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?

  14. 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!

  15. Ceria says:

    Thanks! =)

  16. 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

  17. 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

  18. 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

  19. 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.

  20. 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.

  21. 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

  22. ferran says:

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

  23. Robert says:

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

  24. Pas says:

    Hi Eric, is a pleasure to use your creation, is very useful, thanks for this…I would ask you how can i see the “blinkStrength” value in the csv file that i save during the analisys?
    Thank you very much

    • ericblue76 says:

      Hi,
      I would need to double check but I don’t believe Mindstream is currently writing that out to CSV. I do recall seeing it in the JSON debug output so it shouldn’t be too hard make the appropriate update.

  25. Selly says:

    Hello Eric,
    how can i configure the broadcast of “mindstream”? i have windows xp, if is relevant. I don’t know how to get started.
    Thank you for your help!
    Selly

  26. Miri says:

    Hi Eric, first of all congratulations for your work.
    I have the same issue of “Pas”, I see the blinkStrength in the JSON debug, but I would like to have even blinkStrength in output in csv file as it’s already for the other outputs.
    If you have time, I will appreciate any kind of help.
    Thank you

  27. Hazzardousmonk says:

    Hey, I see that in the CSV output, values are sampled somewhere around 1hz. Is it possible to get the data written to the csv file at the 50hz which the neurosky apparently samples at.
    Cheers

  28. JA says:

    Hi Eric,
    Thanks so much for writing this and making it available for everyone. I am trying to add the rawEEG and blinkStrength to the output file, it can easily make the changes in the MindStreamSystemTray.java file. However, I am having trouble recompiling/making the .jar. When I compile and make the .jar file I get no errors, however when I try to run the .jar file I get “Failed to load Main-Class manifest attribute from mind.jar”. Inside my manifest.txt file I have “Main-Class: com.ericblue.mindstream.systemtray.MindStreamSystemTray”. I also tried putting all the files in one big folder so I don’t have to use the subfolder notation. I would be nice to be able to edit/recompile on my own so I can eventually just start data collect directly from running the .jar file in terminal (I don’t want to use the gui interface). Can you or someone list/give command line instructions for how to recompile the executeable file??

  29. Caine says:

    ericblue76, I have try out your MindStream-1_02_debug version, it still doesn’t work fine, where it can save the mindstream.csv file, but it’s just empty file 0 bytes.
    It’s a bit similar case like Puzzlebox Synapse, where it fail to export the data by csv file, but work in txt file.
    Both issue also happen when want to save as csv file, where in Windows 7 64-bit.
    Hope you will still get my comment, since your post was at 2011. (:

Leave a Reply

Your email address will not be published. Required fields are marked *