This Article is from Arek Stopczynski:
Just one year ago our team at Technical University of Denmark (DTU) started Project Smartphone Brain Scanner. We obtained one Emotiv Epoc gaming neuroheadset and asked ‘can we make it fully mobile?’. This is how it has begun.
If you managed to escape all the hype we got about this in the media, check out in the press tab.
The first platform of choice was the Nokia N900 mobile computer, a fully fledged portable Linux box (that can even make calls). Thanks to community efforts, a kernel with USB hostmode was already there, allowing us to utilize the Epoc dongle. I compiled a hidraw module and voilà: data was flowing in 32 bytes packages to /dev/hidraw1.
Data from the Emotiv Epoc is encrypted. It is part of the business model of the company, to sell different licenses (i.e. decryption keys) with different dongles, giving access to different levels of data (game controller, extracted features, raw EEG). As a university, our first and subsequent sets were purchased as Research editions, giving us access to everything in the signal stream (including raw EEG data). But only on Microsoft Windows.
Initially we used parts of the code from the Emokit project. Some enterprising folks broke the encryption scheme and published the keys. This allowed us to access decrypted and demultiplexed data on the phone, initially using Python and later C++. This was awesome, but just the beginning.
Raw data from EEG (here 14 channels, 128 Hz) is just… well, numbers flowing in. A wide range of EEG analysis methods exist (notably collected in Matlab toolbox EEGLAB.). How much could we do on the mobile phone and in real-time?
Carsten Stahlhut, my colleague (currently post-doc) does remarkable work in the field of source reconstruction of brain activity. To explain in very simple terms: the current we measure with an EEG electrode is a sum of all activations in the brain, propagated through the brain itself, scalp, skin etc,. So what we measure with electrode A doesn’t necessary originate in the place in the brain closest to this electrode. The main task is to reconstruct the sources of the signal in the brain, instead of focusing just on the measured current. Carsten’s thesis is a good read if this sounds interesting (and you don’t mind some badass math).
Source reconstruction is computationally expensive. We are talking a 1028-vertices brain model (every vertex is a potential source of the signal), matrices of 1028×1028 and larger, real-time AES decryption, recording data, visualization, and so on. We need to overclock the N900 (again, power kernel is an amazing community effort) as much as we can, going up to 1.15GHz. Some phones do not like it so much and become unstable; luckily we have plenty to choose from. Still, some simplification of the calculations are implemented, everything to pursuit this hard real-time operation of the system.
In the next installment I will try to explain why we pursued this mobile, real-time, and complex approach to EEG at all. Why not just settle either on simple 2-3 electrodes portable systems, or big-and-serious but not mobile solutions? Stay tuned!
Source Arek Stopczynski