Biomedical Research

Journal Banner

Real time stress detection system based on EEG signals

Vanitha V1*, Krishnan P2

1Research Scholar, National Centre for Sustainable Coastal Management, Anna University, CEG Campus, Chennai, Tamilnadu, India

2Scientist-E, National Centre for Sustainable Coastal Management, Anna University, CEG Campus, Chennai, Tamilnadu, India

*Corresponding Author:
Vanitha V
National Centre for Sustainable Coastal Management
Anna University

Accepted date: August 31, 2016

Visit for more related articles at Biomedical Research


Stress has become a common emotion that students experience in day to day life. Several factors contribute to their stress and proven to have a detrimental effect on their performance. Hence, stress becomes ubiquitous in academic environment due to higher expectations in academic achievement, poor time management, and financial concerns. It has an adverse effect on the quality of their life affecting both physical and mental health. It is a guarantor for depression and suicidal risks if left unnoticed over a longer period. The traditional stress detection system is based on physiological signals and facial expression techniques. The major drawback is the uncertainty that arises due to numerous external factors like sweating, room temperature, anxiety. Some methods like hormone analysis have a drawback of invasive procedure. There is a need for a method that is non-invasive, precise, accurate and reliable. Electroencephalography (EEG) is a perfect tool as it is a non-invasive procedure. Also, it receives feedback from stress hormones; it can serve as reliable tool to measure stress. This research work aims to detect stress for students based on EEG as EEG displays a good correlation with stress. The EEG signal is pre-processed to remove artefacts and relevant time-frequency features are extracted using Hilbert-Huang Transform (HHT). The extracted features are manipulated to detect stress levels using hierarchical Support Vector Machine (SVM) classifier. The results revealed the efficiency of the system to detect stress in real time using their brain wave.


Stress detection, Electroencephalography, Hilbert-Huang transform, Support vector machine, Machine learning.


Students undergo stress in their everyday life. It is a necessary evil that is triggered by demanding physiological activity. It is not a negative process at all times. However under certain circumstances, it becomes a threat to mental health. Stress may arise due to physical or emotional demands. The physical demands may be due lifting heavy weights or intense training for sports. The body faces physical stressors, invokes sympathetic nervous system to maintain the balance [1]. The stress hormones are released and regulate energy stores leading to rise in blood pressure, increase in heart rate. The physical stressors are temporary and can be controlled. Emotional stress arises due to work pressure, meeting up deadline, exams etc. These occupational stressors are difficult to adapt and deal with. If they persist, chronic stress sets in, which is a major concern for serious disease like heart attack.

Stress can have a positive or negative effect on students. Positive stress called eustress provides opportunity for growth like improvement in academic performance. If students continue to have stress, it reaches an optimal point and becomes distress. It will have a negative impact on the body and mind causing insomnia, suppressed immunity, frequent infections, and migraine [2].

Studies [3-5] have shown the high prevalence of stress in academic circle. It affects students irrespective of their background, culture, ethnic origin [6]. They experience stress due to the demands and expectations placed on them. It becomes worse when they perceive the situation is overwhelming and find it difficult to cope up. It even makes them to drop out from college [7].

There are several contributors to academic stress among students [8-12]. Firstly, College life is different from school life and place more responsibilities on their shoulder. They may have to move away from family and hence, they have to make significant changes and adjustments in their personal life. Secondly, they face academic workloads like exam, assignment, meeting up deadline, compete with other students. Thirdly, they may have financial concerns and may feel burdened to pay tuition fees. Stress mainly arises due to three factors, namely academic, interpersonal and intrapersonal skills. Table 1 shows the category of stress and their stimuli.

Category Stimuli
Interpersonal Quarrel with friends and parents
Split up with partner
Crisis in family
Conflict with room mate
Intrapersonal Public speech
Financial constraints
Personal health issues
Academic Workload, meeting deadlines
Poor performance, inadequate resources
Fear of failure, poor time management
Unclear contents, competition with peers

Table 1: Stress category and stimuli.

Several approaches with different methods have been recorded in the literature for detecting stress. Stress is detected based on the way an individual uses key strokes in keyboard [13]. Face expressions are analysed to detect stress [14].

Some approaches use the temperature of the finger [15], human gestures [16] and eye blink [17] as a modality to detect stress. Recent techniques employ thermal imaging [18], physiological signals [19,20] for stress detection.

The problem of stress in students has become a concern for people across several disciplines. As the stress can cause various serious illnesses, an early assessment could significantly reduce the individual risk. In this view, we propose a new Student Health System (SHS), which could detect stress at early stages. Furthermore, it can improve the assessment of distress to provide therapies and counselling to tackle their negative feelings. This research work advances towards this objective and detects stress in students. We have identified two primary stress factors among students, namely academic performance and time pressure. So we have designed stress stimuli that include these two factors and elucidate three levels of stress. Arithmetic questions with a time limit are designed to induce stress as naturally as possible [21]. As the brain is central for all emotions, we chose EEG as a window to detect stress. Also, due its high temporal resolution, it serves as an excellent tool to serve the purpose.

Materials and Methods

Experimental setup

We conducted experiments on 6 healthy subjects who have no history of psychiatric problems or neuro disorders. The purpose was clearly explained to them and consent was obtained from them. A wireless EEG device, Emotiv Epoch head set was placed according to international 10-20 system. The electrodes were attached to the scalp at position AF3, F7, F3, FC5, T7, P7, O1, O2, P8, T8, FC6, F4, F8 and AF4 as shown in Figure 1.


Figure 1: Electrode placement on the scalp.

Limited mathematical questions with varying difficulty were given and they were requested to solve within a specific time limit. The EEG was recorded while attempting to solve them. They self-report stress level according to National Aeronautics and Space Administration Task Load Index (NASA-TLX) rating scale. The entire process took 20 minutes and repeated 5 times to make a session as shown in Figure 2. The acquired EEG signals were processed at 512 Hz and impedance was kept as low as 7 kΩ.


Figure 2: Data acquisition protocol.

This work was implemented in MATLAB 8.4 and the proposed methodology is depicted in Figure 3.


Figure 3: Block diagram of proposed methodology.

EEG pre-processing

Raw EEG is contaminated with noise from different form and sources. As EEG has very small amplitude, filtering out unwanted noise is a critical step to extract useful information. We eliminated two primary noises (artifacts), namely power line noise and ocular artifacts that arise due to body movement.

Power line noise removal: A combination of 0.75 Hz high pass and 45 Hz Finite impulse Response (FIR) filter was used to filter out the noise.

Ocular artefact removal: The EEG rhythms lie in the frequency range of 0.3 Hz to 44 Hz. The ocular artefact occurs at 0.1-16 Hz. In order to preserve the natural properties of the signal, wavelet decomposition approach using bi-orthogonal wavelet bior 3.9 was employed.

Feature extraction

The purpose of this stage is to map EEG into the consequent stress state. An adaptive feature extraction technique Hilbert Huang Transform (HHT) was applied to extract relevant features in time-frequency domain. It is the relevant approach to unearth information hidden in the signal considering the non-stationary nature of the signal.

It is performed in two steps [22].

Decomposition: The pre-processed EEG signal is decomposed into Intrinsic Mode Functions (IMF).

Hilbert transform: Instantaneous frequency is obtained by applying Hilbert transform to each IMF obtained through decomposition process.

Instantaneous frequency is rate of change of phase and computed as given below

ω (t)=1/2π ∂ θj (t)/∂ t and θj (t)=arctan (H (cj (t))/cj (t))

Where H [.] is Hilbert transform.


The classification is user independent which means data acquired from all participants are used for training the classifier. The feature vector obtained through HTT is classified into neutral or three levels of stress (stress-low, stress-medium and stress-high). We chose Support Vector Machine (SVM) over other algorithms for classification for two reasons. Firstly, it is insensitive to over fitting problem. Secondly, its ability for high generalization and accuracy with smaller training sample. It is the most robust classification algorithm for real world scenarios and successfully applied in many problems like face recognition, handwritten character detection, intrusion detection etc. It is originally designed as binary classification algorithm, but later it is improvised to multiclass problems.

For stress detection, we implemented hierarchical SVM. It utilizes a decision tree structure with a SVM at each node to construct a hyper plane decision boundary. The tree is created such that the classes at each parent node are divided into two classes, representing child nodes. The process iterates until the leaf nodes contain only a single class. Following a path from the root node to a leaf node leads to a classification of a new pattern. The instantaneous frequency value obtained for all five rhythms of EEG is used as feature vector to train the classifier. Figure 4 illustrates the training process of algorithm for stress level classification.


Figure 4: Hierarchical SVM for stress classification.

Due to smaller training dataset D, a 10-fold cross validation was adopted. The dataset D is divided into 10 subsets D1, D2… D10. Out of which one set is randomly chosen as teat dataset and remaining subsets are used for training. The entire cross validation procedure is repeated 10 times to improve classification accuracy.


The performance of the stress detection system was evaluated through Classification Accuracy (CA). It is computed as


* 100

Overall performance is calculated as


The performance of SVM is higher than other three classifier algorithms. The accuracy rate of SVM is 89.07%, the accuracy rate of LDA is 70.166%, QDA is 76.833% and KNN is 72.667%. The accuracy rate for four classifiers is depicted in Figure 5.


Figure 5: Classification accuracy for different classifiers.

The performance for each subject across five rhythms of EEG is shown in Table 2.

EEG Rhythms accuracy (%)
Delta Theta Alpha   Beta Gamma Avg
Subject 1 80.89 91.89 90.02 92.86 89.24 88.98
Subject 2 81.57 90.93 91.34 91.24 88.05 88.63
Subject 3 85.24 91.36 94.32 90.3 90.36 90.32
Subject 4 83.29 92.76 86.88 89.42 90.57 88.58
Subject 5 87.05 89.29 91.49 90.88 91.88 90.12
Subject 6 83.7 85.6 90.92 91.24 87.49 87.79
Average           89.07

Table 2: Classification accuracy across five rhythms.

The highest accuracy is obtained in alpha band and the average classification accuracy is 89.07%.


This study proposed an EEG-based stress detection system for students. Determining stress level for students studying in higher academic institution is crucial to prevent from major health risks. In a study with 6 subjects, we have shown that EEG is a reliable tool to detect stress levels. We applied timefrequency analysis to extract useful information from EEG and implemented hierarchical SVM as classifier and obtained accuracy of 89.07%. The results reported the feasibility of using EEG for stress detection, which important for clinical intervention and prevention of physical and mental health problems.