Open Source EEG Platform with Reconfigurable Features for Multiple-scenarios

ABSTRACT


INTRODUCTION
Flexible electroencephalogram (EEG) acquisition systems are required in a wide variety of research fields including brain computer interfaces (BCI) [1], [2], evoked potentials (EPs) [3], [4] stress response [5], [6], epilepsy [7]- [9], depth of anesthesia [10]- [12], among others. EEG systems' extended use is due to its noninvasive nature, high temporal resolution and lower cost compared with other modalities of brain activity monitoring such as functional magnetic resonance imaging (fMRI) or magnetoencephalography (MEG). Also, EEG devices do not require the restriction of the locomotion of the subject under test.
Commercial EEG research systems do not always offer flexibility to configure their settings, such as sampling frequency, location and configuration of the electrodes and individual gain of the channels, among others; and their prices can be high [13], [14]. The accessibility to these main features is critical in the experimentation design. Depending on the study, it could be more convenient to have less active channels and a higher sampling rate [15], [16]. Also, the selection of the reference electrode could significantly affect the quality of the acquired data [17]- [19], but changing and testing different locations is time consuming; thus, the possibility of selecting the reference electrode by software, among the electrodes already positioned in the scalp of the subject, would facilitate the assessment of the reference electrode location. The introduction of bias circuits in the EEG systems also improve the acquired signals by reducing the interference of the common-mode and motion artifacts [20]. The function of a bias circuit is equivalent to the right leg drive (RLD) circuits used in ECG systems. The possibility of selecting the source of the bias signal could result in a better EEG signal. The reconfigurable systems presented in this work provide a suitable experimentation tool at a lower cost than commercially available devices, for a broad range of electrophysiological studies. They offer the possibility of changing critical features including sampling rate, number of active channels, individual channel gain and channel input configuration to address the situations mentioned above. Figure 1 presents a block diagram of the family called "the brain family". Three systems were implemented: RF-Brain, Bluetooth-Brain and USB-Brain. RF-Brain and Bluetooth-Brain are portable, battery-powered devices allowing experimentation where the movement of the subjects is not restricted; for this reason, the size of these systems was kept as small as possible. On the other hand, USB-Brain is powered by the USB port of the host computer where the signals are displayed and/or stored. All devices have a common core composed by the AFE and the control and configuration modules. A. Modules of the Bluetooth-Brain Transmitter can connect to an Android mobile device or to a PC with Bluetooth connectivity. B. Modules composing the USB-Brain, which must be connected directly to a USB port of the host PC. C. Modules for the RF-Brain Transmitter and RF-Brain Receiver. The RF-Brain Receiver connects to a PC through a USB port Figure 1. Block diagram of the Brain family of EEG acquisition systems All the systems have three main components: hardware for acquisition, firmware that controls the behavior of the systems and a computer or mobile device software for configuration, display and storage of data, through a graphical user interface (GUI). These components were designed in a modular fashion in order to provide the required flexibility in their settings. Devices are open-hardware and open-software. Through a communications to the authors, researchers can retrieve all the necessary information to replicate the systems.

Core of The Family
All designed systems share a common core (see figure 1) composed by two modules: analog frontend (AFE) and configuration and control.

AFE
Depending on the system, the AFE module may use one of the following integrated circuits (ICs) from Texas Instruments®: ADS1298 or ADS1299. Both ICs have eight channels with an instrumentation programmable gain amplifier (PGA) each one and 24 bit sigma-delta analog-to-digital converter (ADC). PGAs offer a set of possible gains from 1 to 24. The resolution in bits of the ADC, along with these set of gains provide an approximately resolution of 12 pV. For 16 bit systems, the required gain to achieve the same resolution would have to be in the order of 103. AFEs maximum input bias current is 200 pA and 300 pA for the ADS1298 and the ADS1299 respectively. These ICs have an input multiplexer per channel for device noise measurement, test signal generation and acquisition, temperature measurement and supply voltage measurement. Main features of the two ICs are listed in Table 1. The ADS1298 was used in the RF-Brain and Bluetooth-Brain as it offers a lower power consumption and a bigger supply voltage range as shown in Table 1, reducing the complexity of the energy module and therefore the space required in the printed circuit board (PCB). These features are desired for portable devices in order to offer more autonomy and less space and weight. Since the USB-Brain takes the energy from the USB port, the restriction in power consumption is not relevant, for that reason the ADS1299 was used, offering a better input-referred noise and a bigger gain (up to 24) as shown in Table 1. In all systems, the individual channel gain and the behavior of the input multiplexer can be selected from the user interface or modified by firmware. These settings are sent to the configuration and control module and are established at the beginning of the acquisition process.
In the Bluetooth-Brain system, all channels are single-ended, referred to a fixed electrode called reference electrode which also serves as bias electrode. The RF-Brain also has single-ended channels, but it offers the option of selecting the reference electrode between an independent electrode and one of the channel electrodes; these settings are selected through the GUI and an analog switch located on the board of the system, as shown in Figure 2. With the analog switch, the user can select to connect all negative inputs to the reference electrode or to the pin called SRB2, which can be selected among any electrode connected to the positive input of the AFE. The bias signal can also be configured with the help of a switch and the user interface. Figure 3 shows the internal and external diagram of this implementation. Bias signal may be formed from a set of electrodes selected by the user from the GUI and can be connected to the subject with the bias electrode. Its purpose is to reduce the common-mode interference by creating a negative feedback loop to the subject, equivalent to the RLD signal in ECG systems. If this is not required, the user can select the bias signal to be the mid-supply voltage. The external electronics explained above were designed based on the ADS1299EEG-FE performance demonstration kit, the information of which is available online in www.ti.com.
A. Internal diagram of the ADS 1299 or ADS1298. SRB2 can be connected to any individual positive channel input and SRB1 can be connected to all negative channel inputs. B. When using singleended inputs, through a switch the user can select if the reference is the reference electrode or one of the channel electrodes connected to SRB2. When operating in differential mode, SRB1 and SRB2 are not connected to any channel input. In the case of the USB-Brain system, the user can configure the channels to be differential or singleended. In the single-ended configuration, the reference and the bias signal can be set in the same way as for the RF-Brain (figures 2 and 3). No analog high-pass filters were implemented, allowing capture of signals from DC and avoiding possible distortions due to the nonlinearities of the analog filters. Systems were designed to be used with floating type, cup electrodes with 1.5 mm touch proof connector (DIN 42 802) [21].

Configuration and Control
The configuration and control module consists of a high performance, low power, 8-bit microcontroller from Atmel® (ATxmega128A4U). It receives the orders from the user and sets the configuration of the other modules. It also works as a buffer for the data, between the AFE and the communication modules. The microcontroller works at 32 MHz, and can perform simple processing of the data. The communication with the other modules is done through serial peripheral interfaces (SPI), whose baud rate can be modified in the firmware between 1 M bits per second (bps) to 10 Mbps. A. Internal diagram of the ADS1299 or ADS1298. Channels can be selected for the bias derivation in the GUI or firmware. In this figure, channels 2 and 3 generate the bias signal, which is then routed to the negative input of channel 1. B. User can choose the bias signal origin between the generated from the internal circuitry of the IC or the one at output of the operational amplifier which is the mid-supply voltage.
The general processes made by this module are shown in the flow diagram of Figure 4. For RF-Brain and USB-Brain systems the microcontroller is in sleep mode at the beginning and all the other modules are off to save energy. After an "on-signal" is sent from the user, microcontroller wakes up and turns on all the other modules. The configuration parameters (like sampling frequency, gain and input multiplexer) are sent from the host PC. In the case of the Bluetooth-Brain system, the microcontroller is on and the Bluetooth transceiver is in discovery mode or connected to the receiver at the beginning. Settings must be configured in the microcontroller firmware by using a programmer device for the microcontroller and a software to load the code (for example the Atmel® Studio). Firmware of all systems was written in C and can be updated using the program and debug interface (PDI) port available in all the devices.

RF-brain
The first system of the family is formed by two boards: the first, a small and light transmitter is suitable for biofeedback and BCI applications, and is in charge of the acquisition, digitalization and transmission of data; the second, a USB receiver, is connected to a host computer for display, storage and processing of the signals. This device is an updated version of the Wireless Neuro Boards presented in [22], improving 60 Hz/50 Hz noise isolation and providing more flexibility for the electrode configuration. Improvements were done by modifying all the connectors of the transmitter board and adding some components for the selection of reference and bias electrode, as explained in the previous section.

Transmitter
The transmitter is a battery powered device formed by four modules: configuration and control, AFE, wireless RF communication and energy. For the communication, an RF transceiver from Nordic Semiconductor® was used (nRF24L01+). It operates at the industrial scientific and medical (ISM) band of 2.4 GHz and is capable of reaching an on-air data rate of 2 Mbps, limiting the sampling frequency of the AFE which can be configured up to 2 k samples per second (SPS), when all channels are active. If only one channel is active, the sampling frequency can be selected up to 4 kSPS.
The energy module generates a regulated 3.3 V required for all the other components in the board, from a standard 9 V battery. The maximum current consumption was estimated as 30.21mA at a sampling frequency of 250 SPS, when all channels are active at programmable gain of 12; providing a battery life of more than 18 hours when using an alkaline battery of 550 mAh.
The device is a board approximately 60 mm long, 38mm wide and 10 mm high. The weight of the transmitter is approximately 10 g without the 9 V alkaline battery whose weight is around 45 g. Its weight makes this device appropriate for humans and animals of 500 g or more.

Receiver
In this device, control and configuration and RF-Communication modules are formed by the same components used for the transmitter. The USB communication module has a FTDI® FT232H IC, which is a converter from serial/parallel to Hi-speed USB, allowing transfer of data at baud rates from 115.2 kbps to 1.38 Mbps. The receiver is powered from the USB port of the host computer, with an energy module to offer regulated 3.3V to all the other modules.

Bluetooth-brain
Based on the architecture of the RF-Brain system, this portable device was designed to easily connect with smartphones and tablets through a Bluetooth modem (BlueSMiRF Silver from SparkFun Electronics®). This modem is capable of transmitting data at a serial stream of 115200 bps, permitting the system to record EEG signals at 250 SPS. As shown in figure 1, the other modules are similar to those in the RF-Brain. When using a 9 V alkaline battery of 550 mAh, the system may work continuously for approximately 7 hours (8 channels active with programmable gain of 12). It is required for the receiver device to have Bluetooth connectivity (Bluetooth v2.0 or higher). Some embedded devices need a Bluetooth dongle to achieve this connectivity. For storage, visualization and processing of data, a GUI for Android devices was specially designed. MATLAB® GUI was also designed for the cases where the receiver is a Windows® laptop or PC. Basic functions are available: selection of channels of acquisition, visualization of signals and storage options.

USB-brain
This system was designed for experimentation where high sampling frequency is required and offers more options for electrode configuration and external hardware synchronization. Communication is made directly through the USB port of the host PC using a FTDI® serial/parallel to USB converter. Since the data do not need to be wirelessly transmitted, the sampling frequency can be set from 250 SPS to 4 kSPS.
The processing module uses the ATxmega128A4U microcontroller from Atmel® and a 32 KB SRAM chip was integrated for loading of files (for example, stimulation sequences when used to acquire evoked potentials) into the system. 8 general purpose input/output pins are available and can be used for different tasks such as synchronization with external hardware (for example, stimuli delivery) or interactions with the subject during the tests.
USB-Brain is powered through the USB port of the host computer. The power module delivers three voltage levels from the 5 V of a standard USB port: ± 2.5 V for the AFE and other analog modules, and 3.3 V for all the digital components. It also provides an isolation of 3 kVDC from a DC/DC converter (Texas Instruments® DCH010505D) to ensure the safety of the subject under test. Transfer of data is also isolated through a digital coupler (Texas Instruments® ISO150) to avoid any current flow from the PC or laptop to the subject.
Total current consumption of the system during normal operation is approximately 117 mA at a sampling frequency of 250 SPS and a channel programmable gain of 12, with all channels active in differential mode. The dimensions of the main board of the system are: 91 mm wide by 112 mm long by 10 mm height, and its weight is 100 g.

Configuration and Acquisition Interfaces
GUIs were implemented in MATLAB® for all the systems in the family when using a PC or laptop. From the GUIs, the user can select the channel configuration, sampling frequency and the options of storage and visualization of the data. The options vary depending on the system. Figure 5 shows the GUI for the USB-Brain system. For the RF-Brain and USB-Brain, in the current GUIs, the following options are available: a. Short Circuit: All inputs shorted. For the RF-Brain all inputs connected internally to the reference electrode. For the USB-Brain, the inputs are connected either positive input with negative input or positive input to reference electrode, depending on the electrode configuration. These settings provide a way to measure noise levels in the system. b. Test Signal: When activated, an auto-generated square signal from the AFE, with amplitude of 1 mV and a frequency of 1 Hz approximately, is generated and helps to verify the correct acquisition and communication link in the case of the RF-Brain. c. Normal: The normal operation of the channels for EEG acquisition.
For Bluetooth-Brain, these options can be modified from the firmware of the system. Table 2 shows the available options for all the devices. Additionally, for the Bluetooth-Brain, an Android GUI was designed where the user can select channels to visualize the data and store the signals into a file for further off-line processing. Figure 5. GUI for the USB-brain. user can choose the main features of the system to accomplish the requirements of the experiment

Power Consumption
Power consumption was measured in all systems at standby and regular operation. The standby condition implies, for the RF-Brain and the USB-Brain, that the microcontroller is in sleep mode and all the other modules are off. For this condition, maximum power consumption of the devices were 2.64 mA and 77.7 mA for the RF-Brain and the USB-Brain respectively. Power module and extra components in the USB-Brain system are responsible for its higher current consumption compared to the RF-Brain. In the case of the Bluetooth-Brain, the standby conditions means that the microcontroller is on and the Bluetooth transceiver is either in discovery mode or connected to the receiver device, but no data is transmitted. Its current consumption is 66.7 mA.
In the case of regular operation, all channels in the systems were active in normal configuration, with a gain of 12 and a sampling frequency of 250SPS. For the RF-Brain, the maximum power consumption was 30.21 mA; the Bluetooth-Brain has a maximum power consumption of 76.7 mA and the USB-Brain consumes at most 117.1 mA.

Communication Range and Reliability
To test the communication range and reliability, a periodic saw-tooth signal was synthetically generated in the microcontroller and sent to the host computer or receiver for a minimum period of 10 minutes. All systems were tested at the complete set of the sampling frequencies. USB-Brain system communication did not present any data corruption or loss for all the sampling frequencies. Tests were also performed for the two wireless systems, changing the distance between the receiver and the transmitter. No data loss or corruption was presented for a distance of 5 m or less from the receiver.

Noise Measurement
A noise test took place for a set of sampling frequencies. The test consisted of shorting the inputs of the amplifiers through the input multiplexer settings and acquiring the signals. Noise measurements were made for 1000 continuous readings. Average results of all channels are detailed in Table 3.

Test Signal
To assess the integrity of the PGAs, its adequate calibration and visualization capability of the graphic interface, a test signal was acquired through all the channels of the three systems, at different gain settings. The test signal is an internally generated (generated inside the AFE ICs), square wave of 1 mV of amplitude and 1 Hz of frequency. An example of the acquired test signal is shown in Figure 6. Test signal acquired with the bluetooth-brain. Test signal is internally generated by the IC in the AFE module and consists on a squared wave of 1mV of amplitude and 1Hz of frequency Figure 6. Test signal acquired with the bluetooth-brain

Pilot Tests
To evaluate the quality of the acquired physiological signals, a variety of tests were made for each system. All physiological signals were acquired from healthy human subjects who gave consent for the use of the data. Electrode location follows the standard ten-twenty electrode system [23], [24]. All procedures explained in this section were approved by the Research Ethical Committee of Universidad de los Andes-Bogotá-Colombia, or the Institutional Review Board of the University of Miami-Florida-United States, in fulfillment of the Code of Ethics of the World Medical Association. The following tests were done: RF-Brain: auditory evoked potentials (AEPs) were acquired with the RF-Brain system from one subject (S1, 27 years old) using a data rate of 500 SPS and a gain of 12 in the PGAs. The experimental setup consisted on an electrode located in Cz and referred to A1 for ipsilateral acquisition. Bias signal was selected at mid-supply voltage and located also at A1. The stimulus used was monaural rarefaction clicks at 60 dB nHL at a frequency of 6 stimuli per second. Etymotic Research ER3 insert earphones were used. We wanted to assess the performance of the RF-Brain by comparing the signals acquired against signals from a commercial system; for this purpose we used the Intelligent Hearing Systems (IHS) Universal Smart Box at a sampling frequency of 500 SPS and a gain of 100000 (high-pass filter at 1Hz and low-pass filter at 1500 Hz). A total of 720 sweeps were recorded and averaged to extract the evoked potential. Figure 7 shows the results for the RF-Brain and the commercial system. The typical shape of an AEP (middle latency response) can be observed: two positive waves (marked as Pa and Pb), and two negative waves (Na and Nb) [25]. A difference in the amplitude of the signals is observed and may be due to the use of filters in the IHS system. Latencies and morphology of the signals are similar, taking into account the number of sweeps used for the computation of the potentials (see [3]).
Additionally, EEG signals were registered from another subject (S2, male 27 years old), with one electrode located at Oz and referred to Fpz. Sampling rates of 500 SPS and 1 kSPS were used at a gain of 12. Alpha waves were observed for the periods of time where the subject had his eyes closed [21].
Bluetooth-Brain and USB-Brain: Following a similar procedure than for the RF-Brain, EEG signals were acquired with the Bluetooth-Brain and the USB-Brain, from two human subjects (S3, male, 22 years old and S4, male, 29 years old) using an electrode in Oz referred to Fpz, for a sampling rate of 250 SPS and a gain of 12 in the case of the Bluetooth-Brain. For the USB-Brain, sampling frequencies of 2 kSPS and 4 kSPS were used for a gain of 24 in the PGAs. An example of these acquired signals is shown in Figure 8, where a time-frequency representation is also depicted to view main frequency components. Alpha waves can be observed when the subject closes his eyes at approximately 10 Hz. Figure 7 shows auditory evoked potentials acquired with RF-brain system and the IHS universal smart box. 720 sweeps were averaged to obtain the evoked potentials. main waves of a typical AEP are observed and marked as "Na", "Pa", "Nb" and "Pb". A small difference in the amplitude can be observed, but latencies and morphology of the signals are similar. Figure 8 shows EEG signal acquired with the bluetooth-brain for subject S3 along with its time-frequency spectrogram to show its main frequency components. Electrodes were located in Oz with reference and bias in Fpz. alpha waves (at 10 Hz approximately) can be observed after the subject closes his eyes Figure 7. Auditory evoked potentials acquired with RF-brain system and the IHS universal smart box Figure 8. EEG signal acquired with the bluetooth-brain for subject S3 along with its time-frequency spectrogram to show its main frequency components

DISCUSSION
Three modular, flexible, affordable and high-performance systems were described in detail in this paper. All members of the family of systems have a common core composed by an AFE and a control and configuration module. Two wireless systems were designed for BCI and biofeedback applications where movement of the subjects is not restricted: RF-Brain and Bluetooth-Brain. Since these two systems are battery powered instead of being connected to the line power, the safety of the subject under test is assured. Bluetooth-Brain offers the possibility of connecting the system to a mobile device like a tablet or smartphone. The third, a wired system, offers options for experimentation where high sampling rates, synchronization and general purpose ports are needed. Flexibility is the result of the modular and open nature of the devices, which allows the selection of main features through GUIs and firmware upgrades for the control and configuration module.Access to all systems information, including schematics and C code of the microcontroller can be provided after contacting the authors.
A variety of tests were made to assess the performance of the family, including power consumption, range and integrity of communication link, synthetic signals and a pilot test with electrophysiological signals. Results have been positive, showing a performance similar or better to other systems like the ones presented in [26]- [29]. A comparison between the Brain family and other systems is shown in Table 4.
Although some commercial systems, like Cognionics 32-channel headset, have a greater number of channels [27], brain family has a higher sampling frequency and the same bit resolution. In fact, compared with any other system listed in table 4, brain family devices may be set at a higher sampling frequency. Another aspect to mention is their autonomy: while other systems are capable of working continuously for up to 5 hours, brain family systems can work for more than 18 hours with a standard 9V alkaline battery.
Costs of manufacturing the systems are lower than the price of devices like the Emotiv Epoc (https://emotiv.com/epoc.php) or the ABM B-Alert X10 (http://www.advancedbrainmonitoring.com/), accomplishing one of the main goals of the implementation of the brain family, which was to offer high performance devices at a lower price.
One factor to be accounted for the brain family systems is the electrode positioning, which must be done manually with wet electrodes. This may require more time at the beginning of experimentation than