Design of EEG Signal Acquisition System Using Arduino MEGA1280 and EEGAnalyzer

. This study integrates the hardware circuit design and software development to achieve a 16 channels Electroencephalogram (EEG) system for Brain Computer Interface (BCI) applications. Signals obtained should be strong enough amplitude that is usually expressed in units of millivolts and reasonably clean of noise that appears when the data acquisition process. The process of data acquisition consists of two stages are the acquisition of the original EEG signal can be done by the active electrode with an instrumentation amplifier or a preamplifier and processing the signal to get better signals with improved signal quality by removing noise using filters with IC OPAMP. The design of a preamplifier with high common-mode rejection ratio and high signal-to-noise ratio is very important. Moreover, the friction between the electrode pads and the skin as well as the design of dual power supply. Designs used single-power AC-coupled circuit, which effectively reduces the DC bias and improves the error caused by the effects of part errors. At the same time, the digital way is applied to design the adjustable amplification and filter function, which can design for different EEG frequency bands. The next step, those EEG signals received by the microcontroller through a port Analog to Digital Converter (ADC) that integrated and converted into digital signals and stored in the RAM of microcontroller which simultaneously at 16 ports in accordance with the minimal number of points of data collection on the human scalp. Implementation results have shown the series of acquisitions to work properly so that it can be displayed EEG signals via software EEGAnalyzer.


Introduction
An electroencephalogram (EEG) evaluates electrical activity produced by the brain, which can signify or rule out certain conditions, most commonly seizure disorders. Electroen-cephalography is the neurophysiological measurement of electrical activity in the brain as recorded by electrodes placed on the scalp or, in special cases, subdurally or in the cerebral cortex. The resulting traces are known as an EEG and represent a summation of postsynaptic potentials from a large number of neurons. When the wave of ions reaches the electrodes on the scalp, they can push or pull electrons on the metal on the electrodes. Since metal conducts the push and pull of electrons easily, the difference in push or voltage between any two electrodes can be measured by a voltage. Recording these voltages over time gives us the EEG. This study mainly designs and fabricates portable electroencephalograph (EEG) machine 16 CH with single-power supply [1].
Avariety of new signal processing methods have been applied to EEG signal processing over the past fifteen years . These new methods require new tools to allow routine processing of EEG data, and also make possible the analysis of multimodal data collected using more complex experimental designs than previous analysis methods allowed [2], [3].

EEG signal processing
Amplitude of EEG is in the range of microvolt up to 100 μV when it is taken over the scalp and in the range of milivolt when measured directly from surface of brain (in open operation) and its frequency is approximately up to 100Hz. There are five common frequency bands in EEG signals which their characteristics are shown in Table 1.

ICMIE 2016
As is shown in Table 1 amplitude of any rhythm has certain range. Intensity or value of amplitude is depended to some factor such as state of patient as well as location of electrode on the scalp. Amplitude of this rhythm varies from 5μv to 200 μv [4] .  Fig. 1, after signal acquisition phase (eeg sensor), signals are to be preprocessed. Signal preprocessing is also called as Signal Enhancement. In general, the acquired brain signals are contaminated by noise and artefacts.
After obtaining the noise-free signals from the signal enhancement phase(notch filter,HPF 1 Hz, LPF 31 Hz), the noise-free signal will be sent by serial communication into microcontroller, and next essential features from the brain signals were extracted in feature extraction in PC. For feature extraction from EEG signals use methods Fast Fourier Transformations (FFT). It extracts the signal features by transforming the signals from time domain to frequency domain. It works well for stationary signals and, linear random processes. It cannot measure both the time and frequency. With prior assumptions some of Forier Transform (FT) techniques may exhibit better performance in other cases. In this frequency analysis the signals are divided into one-second windows overlapping a half second window. This half second overlaps results in large amount of data for the training of the classifier that forms classes. This frequency based analysis is named as Discrete Fourier Transformation (DFT) and also termed as Power Spectral Density (PSD) [5].
PSD is the one of the most important tool for digital signal processing (DSP). It helps us to know how the strength of a signal is distributed in the frequency domain and its unit is energy per frequency. PSD demonstrates the strength of the variations of energy of a signal as a function of frequency. Hence, it gives us an idea about at which frequencies variations of energy are strong and at which frequencies they are weak.

Microcontroller arduino MEGA1280
The Arduino Mega is a microcontroller board based on ATmega1280. It has 54 digital input/output pins (of which 14 can be used as PWM outputs), 16 analog inputs, 4 UARTs (hardware serials ports), a 16 MHz crystal oscillator, a USB connection, a power, an ICSP header, and a reset button [6].

GUI (Graphical User Interface) EEG analyzer
To use this application, the user must first understand the design of the system being designed. For the first step, select the "new design", choose one of the existing menu on the menu bar "insert element". Having chosen one, it will appear in the form of input-output blocks display in the windows application design and settings dialog box selected menu. If the settings of the selected menu accordingly, the user can add another block output input on the design window by selecting another menu.All procedures is shown in Fig. 2.

Active electrode with instrumentation amplifier
The instrumentation amplifier also has some useful features like low offset voltage, high CMRR (Common mode rejection ratio), high input resistance, high gain etc. The circuit diagram of a typical instrumentation amplifier using opamp is shown in Fig. 3.

Notch filter of 50 Hz
Digital approaches have been widely adopted to solve the power line interference problems including proper grounding and electrical shielding in analog recordings, however, the preprocessing is necessary because power line interference which overwhelms the desired signals is actually all around. This design modifies the classical twin-T notch filter to be Q-factor tunable as shown in Fig.  4.

Figure 4. Twin-T notch filter
As differensial mode signal input only, the midpoint voltage then the output of U2 is zero, as differential-mode signal and common-mode signal input simultaneously, the output of U2 only contains the common-mode part the input signals. It means that the common-mode signal could input to the instrumentation amplifier directly instead of being translated to differential-mode disturbance for the mismatch of the components to RC coupling circuit.

High pass filter (HPF) 1 Hz
In the Fig. 5, the beginning of this circuit contains a quick HPF of cutoff frequency 1 Hz(Fc=1/(2*pi*R3*C2), just for some extra attenuation of unwanted noise. On the other end, the resistor and capacitor in parallel provide some extra filtering of high frequencies (Fc = 1/(2*pi*10nF*100kΩ) = 160Hz on a low-pass filter).

Figure 5. Design of HPF 1 Hz
The main purpose of this section, however, lies below this, with the 220Ω resistor and potentiometer (pot for short). This op-amp is a non-inverting amplifier, and so has a gain of G = 1 + R3/(R2+R4), (ignoring the 10nF capacitor, as it's a small value and won't contribute much to the gain). The potentiometer is a variable resistorwhen the input is connected to the first pin and the output to the second, turning the wiper changes its resistance linearly between 0 and 1000 ohms. This means that when the pot is turned all the way to the left, the gain of this circuit is G = 1 + R3/(R2 + 0) = 1 + 100k/(220 + 0) = 455. When it is turned all the way to the right, the gain is G = 1 + R3/(R2 + 1000) = 1 + 100k/(220 + 1k) = 83.

Low pass filter (HPF) 31 Hz
Next up, we want to filter out data above the frequencies we are interested in. More specifically, as bheta wave information stops out at 30Hz, we want to get rid of anything above that, as combined it can contribute a good amount of noise to our data. The circuit design is very similar to the high pass filter from stage 3 -it has a gain of .71 at 31.23Hz, and decreases from there at a rate such that by 300Hz it has attenuated the data by about a factor of 100. Design of HPF-31 Hz circuit as shown in Fig. 6.

EEG Analyzer for EEG signal feature extraction
EEGAnalyzer has developed from BrainBay opensource application [7]. In this applications has been added DWT algorithm modul for signal processing.  The purpose of this dialog box is for EEG module configuration settings that will be used in the design of the block to be created, at the first is source (Generic Bio signal-Amplifier with OpenEEG and Modular P2-Packet format with modification for ATMEGA1280), next is Processing, in this menu will display such as Discrete Wavelet Transform and Fast Fourier Transform. The last is Target, this menu will display 4 kids menu that will be used as input output block to be added to the system design including Spectrum-Analyzer and Oscilloscope as shown in Fig. 8. There are unfiltter EEG Signal, Alpha Magnitude, Theta Magnitude, and average frequency.