Brain-Computer Interfaces for Internet of Things †

: A brain‐computer interface for controlling elements commonly used at home is presented in this paper. It includes the electroencephalography device needed to acquire signals associated to the brain activity, the algorithms for artefact reduction and event classification, and the communication protocol.


Introduction
Brain-Computer Interfaces (BCI) are defined as the communication systems that monitor cerebral activity and translate certain characteristics, corresponding to user intentions, to commands for device control.Current research is focused on the potential of Electroencephalography (EEG) [1] devices to capture the brain activity associated to the user intentionality.The acquired signals are then translated to external components [2].The integration of BCI and Internet of Things (IoT) for Smart Home (SH) is a promising and emerging technique to make home environments comfortable and accessible, automating and optimizing the use of appliances, like TV sets, air conditioners, light bulbs, etc. [3].
In this paper, we include two relevant parts of an EEG system for IoT.Firstly, we introduce some details of a self-designed EEG interface with single channel and two methods for the analysis and classification of the obtained data.Secondly, we explain the integration of this device with an IoT system based on the widely used protocol termed as Message Queue Telemetry Transport (MQTT) [4].

Developed System
For the integration of BCI and SH, we have developed the system shown in Figure 1.The first element of the proposed system is the device for EEG data acquisition.This captures the user's brain activity using a single channel, whose location on the scalp depends on the intentionality to be captured.EEG data measurements are obtained with a sampling frequency of 128 Hz in the frequency range from 4.7 to 22 Hz.The raw data captured by the EEG device are then analyzed by an ESP32 microcontroller module [5] to determine the user state.As an example of application of our system, we will consider classification in open/closed eyes.It is well known that EEG alpha activity (8-13 Hz) increases for normal individuals during a closed eyes situation and is suppressed with visual stimulation.According to these studies, the signal processing unit will be able to determine the user eye state considering the power of alpha (α) and beta (β).The closed eyes state is associated to a β/α ratio lower than a certain threshold level due to higher alpha power.Conversely, the open eyes state corresponds to a β/α ratio higher than that threshold level due to the smaller alpha power.Once the eyes state is determined by the system, it must be communicated to the different devices of the SH.For this purpose, the MQTT protocol is used.It is a widely used communication protocol in IoT applications which applies the publish/subscribe pattern.This protocol traduces the user intentionality to control commands.For instance, the state of closed eyes during a "a priori" fixed time interval could correspond to modify the environment (home or hospital room, for example) to a "sleeping" mode (turn off light and TV, etc.).

Experiments
EEG data of four different individuals have been recorded and analyzed.The EEG was performed using only one channel placed at the FP2 position according to the 10/20 system [6].Eighteen trials of 20 s for each eye state were obtained from the participants.We propose two methods for determining the eye state: method 1, which obtains the alpha and beta bands using bandpass filters and then computes the β/α ratio; method 2, which computes the Fast Fourier Transform (FFT) of the acquired signal for the frequencies corresponding to alpha and beta bands and then computes the β/α ratio.Figure 2 shows the values for closed and open eyes averaging all these trials from the training period and also the threshold levels obtained for everyone.As you can see in the subfigures corresponding to both methods, there are significant differences between participants.In the test period, we have used the thresholds previously calculated during the training working for classification of 24 trials per participant obtained from eight measurements per day along three days.Table 1 shows the accuracy obtained using both methods.As you can see in the table, the good performance of both methods is evident from percentages higher than 95% for all users.

Conclusions
The proposed system for the integration of BCI and IoT is formed by a single channel EEG device, a signal processing module to determine the user's eye state and the MQTT protocol for the distribution of the extracted knowledge among the connected devices.The results show that the proposed system achieves high accuracy.

Figure 1 .
Figure 1.Scheme of the system developed for the integration of BCI and IoT.

Figure 2 .
Figure 2. β/α ratio of each eye state for methods 1 and 2 and its corresponding threshold level.

Table 1 .
Accuracy of the proposed methods for test working.