Method for EEG Signals Pattern Recognition in Embedded Systems

The rapid increase of many disorders, such as stroke, amyotrophic lateral sclerosis (ALS) or various other spinal cord injuries, strongly affects the society. This results in growing need for the improvement of communication methods in order to enable quick and efficient interaction with the environment, where in some particularly difficult cases this may be the only possible communication way. Therefore Brain-Computer Interfaces (BCI) seem to be an excellent solution not only for the, above mentioned - severe cases, but also for non-disabled, healthy users. The main purpose for the research presented in this paper was to invent easy, but efficient method for the analysis of the EEG signals and its implementation for the control purpose. As the implementation of EEG signals in BCI systems has become recently more and more popular within the last few years, lots of similar solutions have been developed. The method developed by the authors of this paper presents an innovative approach in analysis of the electroencephalographic signals. The proposed method is novel not only because of its efficiency, but also because of the choice of the applied equipment. The signal processing method was implemented on an embedded platform, so all the limitations of the embedded systems had to be taken into consideration. The proposed solution also enables customisation of the analysing criteria by using a threshold function in order to enable adaptation for various specific applications. In the carried out study only signals with limited information have been processed. The invented method is based on basic mathematical operations only. Neither filtering nor sophisticated signal processing methods were used. DOI: http://dx.doi.org/10.5755/j01.eee.21.3.9918


I. INTRODUCTION
Research interest on the BCI technology have rapidly grown over the past two decades (Fig. 1) [1], [2].Multiple studies have proved that not only people, but also animals, are able to use signals generated by the brain in order to communicate with a computer (or any other external environment) [2].BCI is a powerful control tool in the usersystem interaction, especially for physically impaired, who are not able to perform simple tasks such as using keyboard Manuscript received November 14, 2014; accepted February 14, 2015.or mouse [1].Implementation potential of BCI systems is incredibly huge -from medical applications for user in various physical conditions to recreational use such as gaming [1]- [4].It is important to mention that the analysis of various biomedical signals (in particular these generated by the brain) is a very challenging task due to the high complexity of the human body and their non-stationary character [5], [6].Also low signal-to-noise ratio decreases the ability to decode every human mental state or intention [3].Increasing interest in improving control methods for users in various physical conditions is of the great concern of many research groups.Although there is a great amount of highly effective BCI systems, they are usually too complex to be implemented in an embedded system.The method presented in this paper shows an innovative approach, where no traditional, statistical, complex signal processing methods were applied, and also no filtering was done.It is also important to mention that as well the potential implementation of the proposed method and as the applied equipment is neither expensive nor difficult, as it uses simple, easily available on the open market, inexpensive hardware -Emotiv EPOC headset [7].The proposed method uses only basic mathematical operations (such as addition, subtraction, multiplication and division) -it gives the possibility to implement the proposed solution in almost every environment without taking its computing power limitations into account.It also enables easy translation of the proposed method into almost any programming language, which greatly expands its usability.The applied algorithm is based on the implementation of the two main analysis components -analysis in the time-and in the frequency-domain.Experiments involved participation of adult, healthy subjects and the signals were recorded during imagery left-and right-hand movements.

II. MOTIVATION
The BCI-based communication can be an excellent solution, which is able to significantly improve quality of life of users with various levels of disability [4], [8].In some cases the improvement relies on making possible to perform trivial tasks such as controlling a mouse or simple staying in touch with friends via various social network applications.BCIs also enable efficient and quick control of a wheelchair or a robot [8].The main motivation for the research presented in this paper is a result of the rapidly growing amount of disability caused by stroke -ranging ca.16 million cases each year [4].The most effective solutions are unfortunately based on invasive BCI systems, in which electrodes are surgically implanted into the motor cortex [9].The current non-invasive solutions tend to be still to slow and unreliable, what makes them hard for a day-to-day use [10].The impact, various injuries have on patients, arose the demand on new diagnostics and solution, which could improve their both physiological and psychological condition.
BCI systems also enable interaction with no dependence on traditional motor output pathways of the human nervous system, therefore the brain intention can be effectively used for the control purpose due to the relatively short delays (several hundred ms only) [11].For severely impaired users this may be the only possible communication way [12].The reason for the study presented in this paper was a strong need for quality of life improvement of users with various disabilities and to create an inexpensive, easily available and efficient Brain-Computer Interface.The carried out research and its results improve independence of a disabled person.The proposed method was realised using the Emotiv EPOC gaming headset, which -in opposite to many other systemsis quite affordable and easily accessible [7].

III. BACKGROUND RESEARCH
Nowadays numerous research centres are working towards new BCI technologies using various techniques, signal processing methods and equipment [1], [13], [14], although the first approaches on the BCI studies were noted back in 1977, so nearly 40 years ago [10].In 1988 a first (visual) paradigm based on P300-evoked potentials was reported by Farwell and Donchin [15].Early 1990s brought a lot of new BCI paradigms such as Visual Evoked Potential (VEP), developed by Sutter in 1992 [16].For the BCI system development various equipment is being applied, such as: electrocorticography (ECoG), intra-cortical electrodes (ICE), functional near-infrared spectroscopy (fNIRS), functional magnetic resonance imaging (fMRI), magnetoencephalography (MEG), and (the most popular) electroencephalography (EEG) [1], [17], where ECoG and ICE apply invasive recording techniques, which require surgical sensors implantation.It is also important to mention BCI systems based on fNIRS and fMRI, which measure brain activity indirectly according to cerebral blood flow, however these are very inconvenient and expensive for implementation [1], [18].
Most of the non-invasive BCI systems presented in the literature are based on medical EEG equipment, whereas this study was based on a gaming headset -Emotiv EPOC [7].The application of the Emotiv EPOC has recently become very popular, mostly because of its price.In a study [19] similar to the one carried out by this paper's authors also the Emotiv EPOC was applied, however in that case channels O1, O2, P7 and P8, instead of F3 and F4 only, were used.In that project also the α-frequency was investigated.For the signal processing purpose the Fast Fourier Transform (FFT) was applied.The results were satisfactory [19].
Most of the BCI systems apply statistical methods, such as Bayesian frameworks, where the appropriate frequency bands are probabilistically selected [3], [20].Controls accuracy is one of the key indicators of a BCI system's efficiency.It is also possible to divide non-invasive BCIs into the four main categories: SSVEP-based (Steady State Visually Evoked Potentials), imagery-based, ERP-based (Event-Related Potential) and P300-based.The BCI system conception proposed by [21] and based on motor imagery movement, enabled to achieve the average control accuracy of 76 %, whereas the SSVEP-based BCI had a much better average accuracy of 92 %.This could give a clue that for the BCI purpose the SSVEP paradigm could be much more appropriate.It is also important that in that project -less training was given to SSVEP subjects than to motor imagery research participants.Also a P300-BCI was analysed, with the average result (surprisingly low) of 72 %.System proposed by [22] was tested on three healthy participants and four stroke victims, where overall BCI classification error rate was very high -89.4%.What is important -there was no difference between the healthy and the impaired patients [23].Despite numerous experiments carried out in the BCI area, some cases of so-called 'BCI-illiteracy' were observed, where ca. 10 %-25 % users were unable to use BCI systems at all.The technology applied for BCIwhether it was SSVEP, P300 or SMR1 -did not matter, although very little research was carried out regarding the aspect of the 'BCI-illiteracy' [12], [14].
In the BCI system presented in this paper no filtering at all was applied, which is quite unusual as almost all other similar solutions use it in order to obtain the desired frequency band.Some of the systems apply spatial filtering, which becomes more and more popular [3], [24].The BCI designed and developed by the authors of that paper is based on µ-waves, which frequency is similar to the one of the α (approx.8 Hz-12 Hz).The literature contains example of various interfaces based on other brain waves, such as γ-or β-frequency bands.The study goal of the γ-based BCI was to differentiate between left-and right-wrist movements.In that project spatial filtering was also applied, where the electroencephalographic signal was transferred into a spatial pattern and then it was applied to the RBF-classifier (Radial Basis Function).The efficiency of the proposed method, where the type of movement imagery was recognised, was very high -89 %.Unfortunately the study was carried on only five subjects, so the results are not fully reliable [24].
SSEVP-based BCIs are told to provide the fastest and most reliable service among non-invasive solutions, where the average accuracy is extremely high -95.3% [12], [25]- [27].
Despite many successful implementations of the BCI systems, the potential applications are still very limited [10].The results were not fully sufficient as the most current BCI systems are still not able to adapt to the changes in users' conditions [9], [10].
As the most popular BCIs are imagery-and SSVEP-based systems, numerous studies were carried out in order to improve their accuracy.In both cases the systems required some initial training to enable the control.In [26] the accuracy of both feet imagery movement recognition was nearly 100 %.In that case β burst in the frequency band of 15 Hz-10 Hz was induced by imagery foot movement.This method is very quick and efficient, but requires long training period and is almost impossible to apply for naive subjects.
Another very popular BCI system is the solution based on SSVEP (mentioned in the previous part of this section) [12], [25], [26].The SSVEP-BCI, in opposite to the one based on imagery movement, does not require much initial training.However it needs some external stimuli, like for example a blinking light.It also entails a very high rate of false positive (FP) detections, especially during breaks or in long-lasting resting periods [26].
The existence of the µ-rhythm was widely discussed and quite often, because of the similar frequency values, taken as a specific type of the α-rhythms.Interest on µ-frequency oscillations appeared for the first time in the 1950s.These rhythms can be observed in response to the execution of actions, also during imagery movements [29].

IV. METHODOLOGY
The BCI technology was primarily designed for rehabilitative purposes for users with disabilities [30].This is because the major goal of any BCI system is record and later use this recorded brain activity for the control purposes [31].The popularity of the BCI systems, which is constantly growing, is giving more and more implementation opportunities and started to overtake the entertainment, especially gaming market.The most popular devices -Emotiv and NeuroSky -were designed typically for the entertainment purpose, also because they are handy, portable and inexpensive [32].In Fig. 2 simplified general structure of a BCI system was presented and the Fig. 3 illustrates the simplified block scheme of the proposed BCI system.

A. BCI Hardware -Emotiv EPOC
There are various EEG-based BCI systems available on the market, where the clinical research systems contain large amount of electrodes (up to 256), what enables a very high density [30].However the complexity does not always go in hand with the proposed system's efficiency, especially in case the system is to be implemented on an embedded platform.For this study purpose the choice of the Emotiv EPOC (EEG) headset seems to be the optimal solution, as the device is inexpensive, portable, efficient and easily available.It consists of 14 saline and 2 reference electrodes.
The data is transferred via Bluetooth to the computer [7], [31].The 14 saline electrodes are placed on scalp.The sampling rate of the device is rather poor -128 Hz, what cannot be compared with the clinical equipment.The bandwidth is between 0.2 Hz and 45 Hz, which is enough for study purpose.

B. Conducted Experiments
The system presented in this paper is based on analysis and processing of µ-rhythms, which oscillate between 8 Hz and 13 Hz.The µ-rhythms reflect the response to the execution of actions.It is also possible to find them during imagery motor movements of both hands [28], [29].The µrhythms can be measured over the visual cortex with spectral peak energies.Various physiological manipulations such as motor activity -real and imagined can cause the appearance of the µ-rhythms [33].The motor imagery tasks involve imagination of movement of the appropriate part of the body, which results in activation of the sensorimotor cortex [4], [21].The research was carried out in real-life conditions in order to measure its real efficiency.During the experiment simple visual stimulating application was used and the signals were recorded from the electrodes placed on scalp in F3 and F4 position (see Fig. 4).The participants had to follow the instructions, which involved imagery left and right hand movement.Twenty healthy, adult subjects were tested.

C. Customised Method for Pattern-Recognition Purpose
Arguably, the data representing brain activity gathered by the headset might be used in many various ways the purpose of recognition as to what this activity is all about.Also, for the control purposes one can use signal from a particular electrode or a selection of electrodes.The electrodes F3 and F4 that were used while carrying out the described experiments were selected deliberately with full awareness that they provide information about the planning stage of an activity.
In entertainment-sector BCI libraries /applications, the brain waves are processed in a specific manner.The output (control) commands /scripts rely on run-time comparison the current brain activity with a set of pre-registered signal patterns stored in some sort of database.Depending on the comparison results, the best match is being identified, and a specific activity (to which the matching signal is mapped) can be then executed.However, in this approach the accuracy of the signal recognition strongly depends on many objective factors, such as signal and pattern quality (that may be dependent on the conditions in which they were acquired), as well as on selecting one of many existing pattern recognition methods [3], [20], [24], [25], [27] that would suit best the application domain, hardware (headset) quality, etc.
If the system is supposed to be portable and/or implementable on an embedded platform, among many available signal recognition methods only these methods that require possibly the least resources and processing power should be considered.This excludes or at least significantly reduces possibility of using a very popular artificial intelligence based methods (e.g.in: [3], [20], [35], [36]) as well as equally popular methods that are based on evolutionary algorithms [37], [38] or even these originating from games theory domain [12], [39], [40].In some cases none of the existing methods meets the system and/or application-specific criteria thus in such a case the only solution is to develop a custom method of signal recognition.The most resource-constrained embedded systems typically allow the application developer to access the system resources using a low-level programming language (such as C/C++ or even assembly).These programming languages, especially assembly, allow quite an advance code optimisation.Making the signal recognition method /algorithm structure easily implementable via set of elementary (machine) assembly instructions (such as addition, subtraction, multiplication or division) may greatly improve the code optimisation and result in a very efficient and lightweight executional code.Taking all the requirements and limitations into account we proposed a method of signal recognition based on calculation of a normalised value of signal similarity level that comprises of only elementary machine instructions.On the other side, due to the fact of using the normalised values of the signal samples, the method always returns the similarity level where a = [0, 1]; b = 1 -a.Closer look at (1) reveals that the proposed signal recognition method has averaging property, which assures lesser sensitivity to disturbances affecting the compared signals.By the normalised (related to maximum) values of signal and pattern values in time and in frequency domain were denoted.The two coefficients a and b are used as weighting coefficients which can be used ultimately to decide as to in what proportion the time and frequency components of signal and pattern should be included while calculating the signals similarity level.Setting the a value to a = 0.5, both (time and frequency) components will be considered equally important, whilst setting a = 1.0 will lead to excluding the frequency component from calculations thus limiting the signal similarity level to similarity in the time domain only.
Using the normalised values of signal and pattern is very convenient because it guarantees that the signals similarity level takes values within a strictly defined range: ε = [0, 1) , where ε = 0 means that both, signal and pattern, are identical whilst ε → 1 indicates that the difference between signal and pattern is increasing.The normalised value of the signals similarity level can be used as a tuning (/configuration) parameter.As it is not very likely that the signal and pattern will ever be identical (for the considered signal in a form of brain waves), thus at the application level any signal can be qualified as equal to the pattern signal as long as the similarity value will remain below a threshold value.Via increasing the threshold value a wider range of signals will be qualified as equal to the pattern signal (thus potentially increasing the number of false positive errors) whilst decreasing the threshold value may lead to disqualifying a signal that is very similar to the pattern signal (and thus potentially increasing the number of false negative errors).Wise selection of the threshold value may allow to tune up the whole algorithm and will leave some space for (userspecific) customisation of the sensitivity level.

V. RESULTS
The accuracy in a typical BCI system is significantly important.The efficiency of the pattern-recognition method presented in this paper was quite high -84.7 %.In

VI. SUMMARY AND FUTURE WORK
The proposed method of signal /pattern recognition may prove its usability particularly in the embedded systems domain where an embedded system is some sort of core control-ling device.Although these systems are currently much more powerful than it was in the past, they are still seen as resource-constrained in comparison to even a midrange PC computer.The accuracy of the proposed pattern recognition method, tested on left-and right-hand imagery movements recorded from the electrodes placed on F4 and F3 positions, was relatively high -84.7 % .
This work has raised some challenges and questions about the efficiency while using cheap EEG amplifiers such as the Emotiv EPOC headset.The use of basic mathematical operations for the signal processing purposes is (according to the literature study) is a novel approach in the BCI area, where very complex, sophisticated signal processing methods are usually applied.The whole study consisted of three stages.The very first stage -relied on building a customised EEG equipment.The device consisted of two channels C3 and C4.Tests conducted on the device proved that the quality of the design was not satisfactory and the recording accuracy was very low.The gained signals were of very poor quality.Using professional, medical equipment (Stage 2) supposed to enable recording of good quality EEG signals.Unfortunately -the medical equipment was too sensitive and the obtained signals were very noisy.The final stage of the study provided some satisfactory results, as the analysed EEG signals did not contain the full information and the applied filtering did not improve the results.Also for analysis of two different signals -the better results were achieved in a noisy environment.Adopted tools for signal processing could be more sophisticated, although it might lead to prohibitive computational burdens, in particular in the embedded systems.Also using Emotiv EPOC headset had some disadvantages -as its accuracy was not very high and it also pre-processed the data.
The proposed signal processing method should be improved and applied to other bio-signals, such as EMG (Electromyography) or EOG (Electrooculography) in order to make it more versatile for potential users [21], [22].Using electromyography signals or eye tracking could significantly improve the overall HCI system efficiency, as it would be used as back-up control data [21].A very interesting way to improve the proposed, motor imagery BCI system is to combine various techniques in order to increase its effectiveness.It is also important to mention that only very few publications have described tests conducted on a hybrid, versatile BCI.A hybrid BCI applies simultaneously P300 and SSVEP activities.
There is still a long way to go before the BCI will be fully reliable and effective.It is also still uneasily available and too expensive [16].And this should be changed.

Figure 5
Figure 5 presents sample ERD (event-related desynchronisation) recorded during motor imagery of both left and right hand.The raw EEG signals were recorded from one subject only and were filtered with band-pass filters.The signals were obtained from the C3 and C4 channels [33].In Fig. 6 scalp maps of left-and right-hand imagery motor actions were presented.
Fig. 7 left-(top) and right-hand (bottom) imagery movement signals are presented.Left-hand signals were recorded from the electrode placed on F4 position, where the right-hand from the F3-electrode.The signals falsely matched.False positive and false negative results are a big issue in pattern recognition process of almost all biomedical signals.

Figure 8
Figure 8 illustrates an example of correctly recognised signals, where both right-hand imagery tasks were correctly identified and the ε value was 0.8704.The correct signals' identification can also be noticed in Fig. 9, where two different signals where compared.One of the biggest concern in analysis of biomedical signals, in particular EEG signals, is that the signals have a very low amplitude and there is not much differentiation between the sides of the body.Theoretically the 'hand areas' on the brain are largely