A Stress Sensor Based on Galvanic Skin Response (GSR) Controlled by ZigBee

Sometimes, one needs to control different emotional situations which can lead the person suffering them to dangerous situations, in both the medium and short term. There are studies which indicate that stress increases the risk of cardiac problems. In this study we have designed and built a stress sensor based on Galvanic Skin Response (GSR), and controlled by ZigBee. In order to check the device's performance, we have used 16 adults (eight women and eight men) who completed different tests requiring a certain degree of effort, such as mathematical operations or breathing deeply. On completion, we appreciated that GSR is able to detect the different states of each user with a success rate of 76.56%. In the future, we plan to create an algorithm which is able to differentiate between each state.


Introduction
Stress, better explained in [1], is a response to particular events. It is the way our body prepares itself to face a difficult situation with focus, strength and heightened alertness. When we perceive a threat, our nervous system responds by releasing a flood of stress hormones, including adrenaline and cortisol. These hormones rouse the body for emergency action. In some cases it is necessary to collect OPEN ACCESS feedback in order to control this symptom because it can become dangerous in certain situations. Therefore, it is necessary to build a device to detect stress.
For this objective, we have designed a Galvanic Skin Response (GSR) device in order to detect the different conductance of the skin when a person is under stress or when not [2]. It uses just two electrodes which are placed on the fingers and act as if they were the two terminals of one resistance [3,4].
This device sends different data to a coordinator via ZigBee and, at the same time, this coordinator will send the information to a computer. The final objective is to implement this GSR into an application which controls different medical devices, [5,6]. The Figure 1 shows the communication of the final application.
The user can use the stress sensor anywhere in his home provided he is at a distance of less than 10 meters [7]. By using a wireless communication system, the user is provided with a certain degree of freedom when using the device. The final user could manage the different devices from his television and the control center could take different action so as to change a person's stress levels. Therefore, the coordination center could use different systems to help the person relax, such as turning down the lights or changing the kind of music the user is listening to. There are two main reasons why we decided to work with ZigBee: • It's low power consumption.
• It is possible to connect as many as 255 nodes.
This means of communication has been used before in healthcare applications, as can be seen in [8] and [9]. In order to verify the stress sensor, we carried out different trials with 16 adult subjects. The idea was to establish one threshold for each person because there are people who are more nervous than others, so there could be cases where the results are not reliable. Despite this, there exist studies which have obtained good results establishing the same limit for all the subjects [10].
Therefore, there are two parts: the hardware design of the GSR and the algorithm which detects the emotional state of the user. This first study focuses on the hardware part, so the trials were done in order to verify that the device detects different changes in the person's condition, more specifically whether it detects an effort being made. The output voltage of the designed circuit is connected to the ADC of a ZigBee board. There are two ZigBee boards: one for acquiring the data, and a second one to send it to the computer. This second board (the coordinator) also receives information about other devices and functions of the domotic application.
This paper is divided into the following sections: first, the paper describes the state of the art. Secondly, a complete methodology with all the technologies involved in this system is described, and then the system design is explained, as well as the results obtained during the tests carried out on the system. This document ends with the conclusions and the discussions arising from the topic.

State of the Art
There exist different studies which try to detect people's emotional states, including attempts to find out whether someone is suffering from stress or is not. Studies [11] and [12] use EEG to classify the different data acquired by brain activity. They extract different frequency features of the signals for their posterior classification with good results.
Heart Rate Variability is another parameter used to measure stress levels [13]. To induce stress the authors in [14] propose using hyperventilation and talk preparation. Then, they present a method based on fuzzy logic to analyze the different data from HR and GSR. An ambulatory device is developed in [4] in order to evaluate stress in blind people. This device also includes the measurement of skin temperature, which is another parameter used to analyze stress [15].
As regards Galvanic Skin Response (GSR), there are several studies which propose different methods of detecting stress levels by measuring skin conductance [16]. The study described in [17] has the objective of detecting sweat levels for the diagnosis of sudomotor dysfunction, something that can help in the diagnosis of diabetes. There are other medical applications based on skin conductance, such as epilepsy control: sweaty hands may be a warning signal of an epileptic attack [18]; or [19], as support of the diagnosis and treatment of bipolar disorder patients.
By combining the sweat of the hands with the temperature of the skin, it is possible to develop a truth meter [20]; as when the person is lying, his hands are colder and skin resistance is lower. In this case it is not necessary to include an ADC because the variation of skin resistance happens at odd times so, with different resistances and transistors, it is possible to build a lie detector.
In [10], different videos are shown to the participants in order to induce different emotions. The data acquired by GSR are classified by Immune Particle Swarm Optimization, obtaining a high average when classifying different emotions from the conductance of the skin. The study presented in [21] shows a method based on Support Vector Regression for recognizing emotions by combining different devices.
Continuing with the differentiation of the emotional state, literature includes other studies like [22], where different devices are combined so that, by means of Cross-Correlation and Fisher, it is possible to distinguish six different kinds of emotions.
In [23], applying a method based on Principal Component Analysis (PCA) to reduce the dimension of the GSR data is proposed, saving as much information as possible. The devices described above are also used in the analysis of different bio signals [24].

Methods
In order to develop GSR, it is necessary to use a mechanism to send the data via ZigBee as well as the corresponding algorithm to determine the stress level in accordance with the different tests. The different methods used in this first study can be seen below:

Hardware
We use Jennic JN-5148 boards ( Figure 2) for data acquisition and its subsequent submission to the computer. These were chosen because of their ease of implementing a communication protocol between the coordinator board and the sensor board and because they are part of the ZigBee Alliance. Other devices like those used in [5] were not appropriate for developing a global domotic system. The resolution of the Analogic to Digital Converser is appropriate for the needs of the device.

Figure 2. Jennic board
The output signal of the (Vo) device is connected to pin 34 of the sensor board, while the reference signal is connected to number 40. Through the ZigBee communication protocol, the sensor board sends the data to the coordinator board, which, by means of a USB with a JWT terminal, sends the data to a computer. The weight and the size of these boards are quite small, so they can easily be implemented in the same kit as the device.

Signal
After doing some tests, it was seen that the Analogic Digital Converser saturates at 2.35 V. It is an ADC of 12 bits, so the resolution is: The galvanic skin response oscillates between 10 kΩ and 10 MΩ [25,26], as it can be seen in existing studies about the skin conductance obtained from different applied voltages [27,28]. After initial contact with the subjects, we established an input tension of 1.8 V. We took measurements from our circuit, using different resistances that are within the range of skin resistance (Table 1). These values were chosen in order to know the theoretical behavior of the output voltage, depending on skin conductance. The different values of Rs (Table 1) are determined by the combination of different real resistances. As the board's ADC has a resolution of 0.573 mV and the minimum tension is 136 mV, an operational amplifier does not have to be included. We can also observe that the differences between some resistance values and others are higher than the ADC resolution. There are GSR devices which use an amplifier before the ADC [6].

Trials
Different tests were conducted in order to verify the behavior of the GSR device: • In a calm state, trying to feel relaxed. • Trying to be nervous: at the second stage, we asked the subjects to think about something which makes him nervous or produces anxiety.
• Taking in air and expelling it forcefully: the subject is relaxed and, after one minute, he is asked to take in air and expel it, trying to push himself as hard as possible. As the result of this, the nervous system indicates to the sweat glands that an effort has been made.
• Mathematical operations: the subject is relaxed and, after one minute, the computer shows him different mathematical operations. The subject is asked to feed the different results into the computer.
• Reading: after 90 seconds, the screen shows some words that the user has to read as fast as possible ( Figure 3).
• Another test where the computer shows different images to the subject was also used. Some of these pictures are "emotional" (they should affect the subject's emotional state) and the others are "neutral" (they have no influence on the subject). It was supposed that the emotional ones would provide a response, but, after trying with some subjects, we have not included this because the results were insignificant.  Table 2 shows the places where the different studies took place. The studies have been made at the subject's home and office because GSR is intended to work in daily situations.

Matlab
In order to analyze and manipulate the different data, we use Matlab.

WEKA
To verify the different tests, we used the WEKA learning machine for testing the following methods: Bayesian Network, J48 and Sequential Minimal Optimization (SMO). They were chosen because there are studies that have obtained good results with them [29]. A Cross-Validation method was used to evaluate the different results.

System Design
We now present different diagrams showing the application's system design.

High Level Design
The main application performs the operations on the Figure 4. The data acquisition and subsequent sending of information to the computer is done by two different boards, which are connected to each other via ZigBee (see Figure 5).  The GSR electrodes collect the skin resistance and, after this, the device can determine the person's stress level.

Processing Stage
At this stage (Figure 7) it is necessary to develop an algorithm which must be able to differentiate between the stress levels. We separate the data according to stress situations and relax situations.

Low Level Design
Hardware A person's skin acts as a resistance to the passage of electrical current. By placing two electrodes on the fingers, we can calculate the Galvanic Skin Response (GSR). To find out this value, we use one resistance, as it can be seen in Figure 8, in series with the skin resistance, to form a voltage divider.
where R s is the resistance of the skin. It can be observed that the Vo output tension is inversely proportional to the value of the skin resistance. The more stressed the person is, the more his hands will sweat, so his resistance will decrease. Therefore, we can conclude that the more stress the person is under, the higher output voltage will be.
It also includes a low-pass filter made by a capacitor and a resistance to filter the high frequencies.
We will use a 1.5 V battery of as supply. The device, Figure 10, will have the following form:

Results
We have conducted several tests in order to change the emotional state of the subjects. Knowing the moments when the person should be stressed and the ones where he should not, we can analyze each kind of data separately. We have used 16 subjects aged between 23 and 56 (eight women and eight men). The sample rate is 4 Hz. Once the data have been obtained, we have smoothed them with an average size-5 window.
All the users have done the following tests: • Staying relaxed • Mathematical operations • Breathing deeply • Reading as fast as possible Table 3 shows the output voltage averages for the different tests in those cases where the differences are better appreciated.          It has been appreciated that when the participants were asked to relax, there was a decrease in the output voltage for that period of time. Figures 19-22 show the decreasing of the signal when the user is relaxed.    The Table 4 shows whether changes have been appreciated in these four tests for each user. With this data, we obtained an average success rate of 76.56%. The users who had done some trials beforehand (Users 1, 2, 3 and 12), were more successful than the rest. Additionally, there are users who were asked to think of something that makes them nervous for a later comparison (Table 5): Table 5. Differences between trying to be relaxed and trying to be nervous.   User 4 was a special case: after doing the stage where she had to think about something that makes her nervous, she had said that she could not do so. We then told her that the next stage was mathematical operations, something which made her nervous ( Figure 25). Therefore, we decided repeat the acquisitions:  While User 4 was relaxed, she became nervous, which is why an increment in output voltage can be appreciated. Figure 28 represents the following three situations:

Relaxed(V) Nervous(V)
• Upon arrival at the department, done fairly quickly (blue).
• After a while, much more calmly (green).
• In the afternoon, thinking about something she had to do, and that made her nervous (red). In order to verify the different tests, we introduced the different data to WEKA machine learning, using BayesNet, J48 and SMO. There separated those measurements which are supposed to represent an effort from those where the user was relaxed. The data have been processed individually for each participant due to the fact that each one has got different thresholds. Cross-Validation was used to test the different classifiers. Below, in Table 6, we present the different results:    We did more trials for Users 2, 3, 4, 5 and 13 in order to determine whether they are stressed or not. In these trials they were asked to feel both relaxed and nervous. After talking to them, they concluded that most of them were not able to make themselves nervous (Figures 36-40). Because of this, the measurements were not treated as they were supposed to be, but as according to how the participant felt. The results are reflected in Tables 9-13.      Table 14 shows the classification average.      We have established the following limit to differentiate being relaxed from being nervous for an initial study: 0.6 0.4 2 (3) We have separated the data in windows of 10 seconds, overlapping 5 seconds. If the average is higher than the limit, the result is 1, if is lower, the result is −1 (Figures 41-46). These are the results:

Discussion
The main part of this study involved the design of a device which is able to detect skin resistance in different situations. It also includes an initial threshold between being stressed and being relaxed, but it is not the algorithm that is going to be implemented in the final application.
With the different graphs, it can be observed that signals increase or decrease depending on the effort or the mental situation of the user. User 4, User 2, and User 3 had done some previous tests before these results. This may be the explanation for why they present more clarity in their graphs.
The main problem is that, for the moment, we cannot differentiate being stressed from making an effort. This is clearly seen in User 13's last graph, where a laugh presents a similar response to feeling stressed. Apart from the reflected trials, we also collected data while the user was playing different games, such as Tetris or PacMan. However, significant results were not obtained, so they are not included in this study. There are other studies [30] which have used different games in longer tests, and they have obtained good results.

Conclusions
The GSR device detects whether there has been an effort or a different situation from being relaxed with a success rate of 90.97%. It has been observed that participants who had done some trials before obtained the highest difference; so the average could be higher if the user is familiarized with the device. The next stage is to design an algorithm in order to establish the threshold between different emotional situations because this first algorithm does not distinguish between being stressed or making an effort. Two tasks lying ahead of us are: • Improving the algorithm to establish more reliable thresholds; • Using different tests for the calibration state: conducting tests that last longer [17,30].