Brain Computer Interface

Interpreting data in *.csv files generated by EEG Analyzer

2015-01-06 Analysis, Brain Computer Interface 4 comments

Introduction

Sometimes people send me e-mails concerning EEG Analyzer app. Usually they are not sure how to interpret or analyze results generated by the app and uploaded to Dropbox server. My app is quite “raw” and simple, because it is additional project created during writing my Master Thesis, which helped me to perform some experiments and analysis of EEG data. That’s why I didn’t focused on generating reports from gathered data. I focused only on reading and gathering data from MindWave Mobile device. In this article I’ll show you how to interpret data generated by EEG Analyzer and draw simple plots showing change of attention level, meditation level and blink strength.

Step #1 – download and install LibreOffice Calc

LibreOffice Calc is free software similar to MS Office. Currently, I’m using Linux, so I’ve chosen this tool, but if you are using MS Windows, you can perform similar operations in MS Office and MS Excel.

Step #2 – gather EEG and eye blinking data

Download EEG Analyzer app to your mobile device, connect it with MindWave, go to the settings and enable “Save EEG and eye blinking data” option. After that, go back to the main screen. Wait for some time and let the app record your EEG data. Next, go to the Settings screen again. You should see that “Number of the signals saved on the device” is greater than zero, so your data was recorded. Click button “Export data to Dropbox”. After that, you should see a message informing you that data was exported successfully.

Step #3 – access gathered and uploaded data

Go to your Dropbox directory on your disk or Dropbox website. Next, go to the “EEG_Analyzer” directory. You should see files containing your exported signals in that directory. Names of the files should look like that: egg_analyzer_data_20140830_183410.csv. First section with the numbers represents date. 20140830 means 30th of August 2014. Second section represents time. 183410 means 18:34, 10 sec. (6:34 PM, 10 sec.)
When you open this file in a text editor, you should see something like in table below.

See raw *.csv file here.

Values on the top describes contents of the columns. _id is id of the record in SQLite database table on the device, type represents type of the signal (4 – attention, 5 – meditation, 22 – blink strength), level represents attention level (from 0 to 100), meditation level (from 0 to 100) or blink strength (I don’t know maximum value, but it’s always positive integer value), milliseconds represents Unix Timestamp in milliseconds. We can extract date and time in many ways. E.g. using website currentmillis.com or by writing our own script, software or formula in spreadsheet software like LibreOffice or MS Excel.

Step #4 – open exported file in LibreOffice Calc and draw plots

Below, you can follow the steps, which allow you to analyze EEG data and generate plots presenting change of attention level, meditation level and blink strength in time. I am using Polish version of the Ubuntu and LibreOffice, but you can find the same options in your language in the same places.

Step #4.1 – open *.csv file with LibreOffice Calc

eeg_librecalc_tut_01

Step #4.2 – import data

eeg_librecalc_tut_02

Step #4.3 – display data

When you confirm importing of the data, you should see data in LibreOffice Calc.

eeg_librecalc_tut_03

Step #4.4 – add data auto-filter

Mark “type” column and from menu choose “Data” » “Filter” » “Auto”.

eeg_librecalc_tut_04

Step #4.5 – apply filter

After adding filter, you should see little arrow in the “type” column. When you click on the arrow you can filter all signals representing attention by choosing type = 4 and “unchecking” other types.

eeg_librecalc_tut_05

When you click “OK”, you should see only “attention” signals.

eeg_librecalc_tut_06

Step #4.6 – draw the chart

Choose option “Insert” » “Object” » “Chart (Plot)”

eeg_librecalc_tut_07

Or click on the icon:

eeg_librecalc_tut_08

Define initial plot parameters:

eeg_librecalc_tut_09

Click “Next” to see “Range of data”. Don’t do anything and click “Next” again. Click “Add” below “Data series” field.

eeg_librecalc_tut_10

Click “choose data range for Y values” and mark values in the “level” column.

eeg_librecalc_tut_11

Afterwards, you can click “Next” and adjust Chart parameters.

eeg_librecalc_tut_12

Click “Finish” and your chart is ready.

eeg_librecalc_tut_13

You can draw plots of change of meditation level and eye blink strength in time in the same way by filtering other signals.
I hope this tutorial is useful for you and clears up doubts connected with data generated by EEG Analyzer. In addition it shows simple way of generating plot of the attention level change in time what can be useful for displaying EEG data in a graphical way.

EEG Analyzer – Android app

2014-09-01 Android, Brain Computer Interface, Master Thesis 28 comments

I recently published my side project connected with BCI and EEG technology in Google Play Store.

unnamed

EEG Analyzer reads electrical activity of the brain with EEG technology and blink strength with EMG sensor from NeuroSky MindWave Mobile device connected via Bluetooth to Android device. In order to use this application, you need to have NeuroSky MindWave Mobile device, which can be ordered from http://neurosky.com/ website. Direct link to the mentioned product: http://store.neurosky.com/products/brainwave-starter-kit
Application has the following features:

  • Reading attention level
  • Reading meditation level
  • Reading blink strength
  • Reading brain waves
  • Reading raw signal
  • Drawing plots of attention level change in time
  • Drawing plots of meditation level change in time
  • Saving attention level, meditation level and blink strength change history
  • Exporting saved signal to Dropbox servers in *.csv format
  • Possibility to turn on voice feedback informing about high attention or meditation level

Application is available in English and Polish language version.

google_play_en_generic_rgb_wo_60

Update

EEG Analyzer was featured on official NeuroSky Store at: http://store.neurosky.com/products/eeg-analyzer.

Brain-Computer Interface for mobile devices – Master Thesis presentation

2014-07-08 Android, Brain Computer Interface, Master Thesis 1 comment

Recently, I graduated from my university. Below, you can browse my Master Thesis presentation about Brain-Computer Interface for mobile devices. If you are interested in writing mobile Android applications communicating with NeuroSky MindWave Mobile device, you can check my EEG Reader project on GitHub, which can be treated as a basis for more advanced projects. During writing my Master Thesis, I created two another projects using similar concepts. Mentioned code may be a little bit outdated comparing to the newest Android trends, but feel free to fork and upgrade it.

Update: You can read a publication based on my Master Thesis in the Journal Of Medical Informatics & Technologies Vol. 24/2015, ISSN 1642-6037:
Brain-Computer Interface for Mobile Devices

Brain Computer Interface for mobile devices – introduction

2013-06-05 Android, Brain Computer Interface, Master Thesis, Mobile No comments

Currently, I work on my Final Project and Master Thesis at Silesian University of Technology in Gliwice, Poland (original University name in Polish: Politechnika Śląska). I’ve decided to choose unconventional topic, which will allow me to use the knowlegde I already have, extend it and learn something new. Topic of my thesis is: Brain Computer Interface for mobile devices. BCI is a topic, which is not completely discovered nowadays. EEG and BCI have their origins in 1924, but up to now, they don’t have so many real life applications. We can find only some experiments and simple games. Recently, companies, engineers and scientists started to focus on brain waves, so this topic is worth investigation and it may be the future of modern computing.

In my project, I am going to use BCI for controlling mobile devices with Android OS. In my opinion, connecting brain to the smartphone can have really interesting outcome. Below, you can browse my presentation, which I have shown on my Final Project Seminar today.