EEG or electroencephalography are since Hans Berger in 1929 exposed that the activity of the brain could be measured from electrodes situated in the human skull. With EEG we could measure in fact, the functional state of the brain and diagnose some future or actual problems. This is the most common way to measure injuries in the brain and functional brain disturbances, but the creation of the signal is not well understood.
Different regions of the cortex have different cytoarchitectures and each region has its own morphological patterns, aspects of intrinsic organization of the cortex are general. Most of the cortical cells are arranged in the form of columns, in which the neurons are distributed with the main axes of the dendritic trees parallel to each other and perpendicular to the cortical surface. This radial orientation is an important condition for the appearance of powerful dipoles. Figures below lists the parts of human brain cortex and zones of interest.. These layers are places of specialized cell structures and within places of different functions and different behaviors in electrical response. An area of very high activity is, for example, layer IV, which neurons function to distribute information locally to neu- rons located in the more superﬁcial (or deeper) layers. Neurons in the superﬁcial layers receive information from other regions of the cortex. Neurons in layers II, III, V, and VI serve to output the information from the cortex to deeper structures of the brain.
Different layers (columns) of the brain cortex. Pyramidal cells in layers III and V are mainly responsible for the generation of the EEG.
The EEG signal consists of spontaneous potential ﬂuctua- tions that also appear without a sensory input. It seems to be a stochastic signal, but it is also composed of quasi- sinusoidal rhythms. The synchrony of cerebral rhythms may occur from pacemaker centers in deeper cortical layers like the thalamus or in subcortical regions, acting through diffuse synaptic linkages, reverberatory circuits incorporating axonal pathways with extensive ramiﬁcations, or electrical coupling of neuronal elements. The range of amplitudes is normally from 10mV to 150mV, when recorded from electrodes attached to the scalp. The EEG signal consists of a clinical relevant frequency range of 0.5–50 Hz (10).
The most common frequency bands of EEG are the most common way of analysis. This information can reveal physiological and statistical evidence but each band could vary on people and animals with is behaviours and metal sanity, age, etc. The most important patterns of human EEG are described below.
Example of EEG Bands
The phenomena of alpha de-synchronization channel could be used to get the eyes closed/open detection.
The appearance of delta waves are common in neonatal and infant EEGs and during in sleep stages in adult EEGs. If delta EEGs appears by itself in a adult it means cerebral injury
In the beginning where part of the delta waves, but scientists discovered the importance activity of these waves. Its region of interaction is between thalamic region and play dominant part in childhood and infancy. The normal adult waking of theta waves are a few or small amount of these frequencies observed in drowsiness and sleep. Large amount of theta waves are associated between different amount of pathologies.
These are originated on the posterior half back of the head and are from occipital an parietal regions. These waves are observed during conditions of awakeness, physical relaxation and mental innactivity. Can be blocked by mental activity or an influx of light when eyes are opened.
Are presented in a healthy addult and the area of formation are in the frontal and central region of the cortex. Typical voltage of beta waves are less than 30uV. Beta activity increase when the organism is added with barbiturerates, some non barbiturates sedatyves and minor tranquilizers. It also appears during mental activity and tension.
The most common EEG uses up to 30 landmarks on the skull using bipolar derivation (two electrodes on the skull and the difference is the gradient of potential). Unipolar derivation is done with an electrode or group of electrodes with the active part (activity) and the inactive part (usually nose or ear). The advantage of unipolar derivation are that the amplitude of each deﬂection is proportional to the magnitude of the potential change that causes it and the demonstration of small time differences between the occurrence of a widespread discharge at several electrode.
Common areas of bipolar EEG sensory.
The below paragrah was extracted from Neurosky directly
Measuring Electroencephalogram (EEG) activity has historically required complex, intimidating and immovable equipment costing thousands of dollars. NeuroSky is unlocking a new world of solutions for education and entertainment with our research-grade, mobile, embeddable EEG biosensor solutions. Precisely accurate, portable and noise-filtering, our EEG biosensors translate brain activity into action.
Our EEG solution digitizes analog electrical brainwaves to power the user-interface of games, education and research applications. We amplify and process raw brain signals to deliver concise input to the device. Our brainwave algorithms, developed by NeuroSky researcher and our partner universities and research institutions are uncovering new ways to interact with our world.
Mindwave Mobile EEG Neuroheadset
Both EEGs are good. Neurosky Mindwave is cheap, easy to hack and usefull for develop simple applications and filters for study brainwave signals. One thing to note is that Neurosky EEG is only for develop games and must not be used to study the signals as a medical device, this is not the goal of this company. The cost of the Neurosky Mindwave Mobile is about 100 USD.
Emotiv EEG is good at a clinical level because gives you a lot of information of regions from F1 to F15, has an gyroscope to sense orientation of the head and a SDK for developer or researcher in Linux and Windows. The cost of the EEG rounds about 300 USD. But if you need to get raw data for better analysis you need to buy the complete package of EEG neuroheadset, and software, its around 750 USD.
Because ease of use this note is based on Neurosky Mindwave.
Pairing the Mindwave Mobile with the Bluetooth Device.
The first thing is to detect the Mac Address of your device. For achive this task you must download to your andriod phone a bluetooth mac address finder like are in the play store. I recommend you Bluetooth Address Finder.
Next turn on the mindwave mobile and wait the blue light to start blinking. When the light comes on hold again to the top position a few seconds the switch and will start to blink a little faster.
Then start the bluetooth application on your phone and in a few seconds you will have the mac address that you want like this below.
The BD_ADDR (Bluetooth Device Address) of the my Mindwave Mobile.
Just for information. The three lower bytes are called LAP (Lower Address Part) of your bluetooth device. Next we must set our bluetooth device. I am using a Roving Network RN-41 Module.
6/14/2014 15:11:55.888 [TX] – $$$
6/14/2014 15:11:55.959 [RX] – CMD<CR><LF>
6/14/2014 15:12:03.871 [TX] – SM,3<CR><LF>
6/14/2014 15:12:03.957 [RX] – AOK<CR><LF>
6/14/2014 15:12:06.655 [TX] – SP,0000<CR><LF>
6/14/2014 15:12:06.751 [RX] – AOK<CR><LF>
6/14/2014 15:12:35.424 [TX] – SR,74e5439c6264<CR><LF>
6/14/2014 15:12:35.600 [RX] – AOK<CR><LF>
6/14/2014 15:12:50.152 [TX] – R,1<CR><LF>
6/14/2014 15:12:50.223 [RX] – Reboot!<CR><LF>
For the next step now you will need only to turn on the bluetooth of the mindwave mobile, wait some seconds and they will automatically pair. The scenario should act and finalize exactly like that figure below.
Bluetooth connection for PC and Mindwave Mobile completely paired
Midwave Mobile Frames
First letx explain the frame output of mindwave mobile. There are two frame that are outputed at variable rates.
AA 04 80 02 00 56 27 AA AA 04 80 02 00 53 2A AA AA 20 02 38 83 18 02 43 EA 00 03 90 00 00 89 00 00 47 00 00 1E 00 00 28 00 00 3B 00 00 27 04 00 05 00 E7 AA AA 04 80 02 00 53 2A AA AA 04 80 02 00 55 28 AA AA 04 80 02 00 54 29 AA AA 04 80 02 00 54 29 AA
Purple frame is outputted every 512 Hz and is not exchangeable the frequency time of output.
Green frame is outputed every 1 Hz and is not exchangeable the frequency time of output.
The frames contains useful information about raw values and calculated values. The below table lists the different frames that are output of every frame.
For the 512 Hz frame the information output is:byte: value // Explanation [ 0]: 0xAA // [SYNC] [ 1]: 0xAA // [SYNC] [ 2]: 0x04 // [PLENGTH] (payload length) of 8 bytes [ 3]: 0x80 // [RAW_WAVE_VALUE] 16-bit two's-compliment signed value (high-order byte followed by low-order byte) (-32768 to 32767) [ 4]: 0x02 // [VLENGHT] (payload variable length) of 'n' bytes [ 5]: 0x00 // [RAW_HIGH] high order byte of raw data two's compliment signed value [ 6]: 0x53 // [RAW_LOW] low order byte of raw data two's compliment signed value [ 7]: 0x2A // [CHKSUM] (1's comp inverse of 8-bit Payload sum)
For the 1 Hz frame the information output is:byte: value // Explanation [ 0]: 0xAA // [SYNC] [ 1]: 0xAA // [SYNC] [ 2]: 0x20 // [PLENGTH] (payload length) of 32 bytes [ 3]: 0x02 // [POOR_SIGNAL_QUALITY] (0 to 255) [ 4]: 0x38 // 56 of 255 [ 5]: 0x83 // [ASIC_EEG_POWER] eight big-endian 3-byte unsigned integer values representing delta, theta, low-alpha, high-alpha, low-beta, high-beta, low-gamma, and mid-gamma EEG band power values [ 6]: 0x18 // upper byte of EEG_POWER_DELTA [ 7]: 0x02 // middle byte of EEG_POWER_DELTA [ 8]: 0x43 // lower byte of EEG_POWER_DELTA [ 9]: 0xEA // upper byte of EEG_POWER_THETA : 0x00 // middle byte of EEG_POWER_THETA : 0x03 // lower byte of EEG_POWER_THETA : 0x90 // upper byte of EEG_POWER_LOW_ALPHA : 0x00 // middle byte of EEG_POWER_LOW_ALPHA : 0x00 // lower byte of EEG_POWER_LOW_ALPHA : 0x89 // upper byte of EEG_POWER_HIGH_ALPHA : 0x00 // middle byte of EEG_POWER_HIGH_ALPHA : 0x00 // lower byte of EEG_POWER_HIGH_ALPHA : 0x47 // upper byte of EEG_POWER_LOW_BETA : 0x00 // middle byte of EEG_POWER_LOW_BETA : 0x00 // lower byte of EEG_POWER_LOW_BETA : 0x1E // upper byte of EEG_POWER_HIGH_BETA : 0x00 // middle byte of EEG_POWER_HIGH_BETA : 0x00 // lower byte of EEG_POWER_HIGH_BETA : 0x28 // upper byte of EEG_POWER_LOW_GAMMA : 0x00 // middle byte of EEG_POWER_LOW_GAMMA : 0x3B // lower byte of EEG_POWER_LOW_GAMMA : 0x00 // upper byte of EEG_POWER_MID_GAMMA : 0x00 // middle byte of EEG_POWER_MID_GAMMA : 0x27 // lower byte of EEG_POWER_MID_GAMMA : 0x04 // [ATTENTION] eSense (0 to 100) : 0x00 // Attention level : 0x05 // [MEDITATION] eSense (0 to 100) : 0x00 // Meditation level : 0xE7 // [CHKSUM] (1's comp inverse of 8-bit Payload sum)
More information about the protocol and de-packing could be encountered here.
LABVIEW Graphical Code
Because for my use there was no way to start the Thinkgear communication API in LabVIEW, i decided to make my own thinkgear library.
LabVIEW Front Panel of the Application. This displays all signals captured by the Neurosky Mindwave and finally makes the FFT Power Spectrum. You can also copy and paste the data to make further analysis in Matlab or any favorite software.
LabVIEW Block Diagram of the Application. Basically you must start the VI (MindwaveInit.vi) and start capturing frames (MindwaveStream.vi); finally when you are finished then close the VI (MindwaveCLOSE.vi).
There are several blocks of work that i have created, and are hidden in the structure of the project. You could download the project and navigate to the structure of the Neurosky folder. Should look like this:
Image of non-hidden and hidden function blocks for Mindwave Mobile.
This function basically starts the bluetooth SPP (Serial Port Profile) hardware with the baudrate desired. It is used to start receiving packets from our headset device.
Mindwave stream does the complete job of unpack the received data of the frames of 512 Hz and 1 Hz filling a structure that you could access later to make calculations.
This block is a variation of the above MidwaveStream.vi, the difference is that you could wait to capture the RAW EEG (512 Hz frame) or the Variable Length (1 Hz frame) via an input.
This block as above blocks do the recopilation of information of the frames, but sequentially, first the raw eeg and then later the variable lenght data.
When you are done with communications you must close the serial port channel for other programs to start using this resource.
Here is the Github code that i developed. Remember this content is under Creative Commons license..
Finally here is a video of explanation of the use of Mindwave and LabVIEW.