Bio-amplifier for Brain Computer Interface

This article describes the hardware design of four-channel amplifier (BioAmp) for human neurophysiologic electrical activity measurement. Variable combination of leads is possible depending on the measurement type and characteristics thereof. Gain of individual leads is adjustable via digital potentiometers. It is possible to measure various types of biological signals such as ECG, EEG and EOG. The application of simple brain – computer interface (BCI) using BioAmp device is presented in the paper. The non-invasive Steady State Visual Evoked Potential (SSVEP) method is used for this purpose.


INTRODUCTION
In practice it is often necessary to measure different human electrical activity by a single device.There are many commercial multi-channel bio-amplifiers with excellent precision.However, commercial devices are very expensive for general purpose applications.
Non-commercial EEG amplifiers are mostly designed as a two or three stage amplifier with input buffers, passive or active filters and DRL -Driven Right Leg circuit.Although manufacturers of electronic components offer specialized integrated EEG/ECG frontends on single chip we did not find any non-commercial EEG amplifier based on these chips.
In the first amplifier stage of modern non-commercial EEG amplifiers, designers use instrumentation amplifiers that could be on single chip or composed of three or multiple operational amplifier chips.Advantages of modern single chip instrumentation amplifiers are CMMR (Common Mode Rejection Ratio) higher than 80 dB, low noise and low drifts.In mobile battery powered EEG amplifiers, designers prefer instrumentation amplifiers composed of multiple operational amplifier chips because of low power and non-symmetric low voltage requirements [1].In circuits with active DC offset suppression; gain is not limited with the necessity to keep amplified electrode DC offset at output of instrumentation amplifier lower than power supply voltage.This results in design of high gain (>1000) amplifier with high CMMR [2].In article [3] it is presented circuit design of instrumentation amplifier with active DC-DC offset suppression on single chip.
Second amplifier stage, alternatively third amplifier stage and active filters are practically identical standard circuits made of high quality operational amplifiers.
For the purpose of maximizing CMMR, designers use DRL -Driven Right Leg circuit which rejects 50 Hz noise from electricity.Rejection of noise with frequency higher than 100 Hz, for example noise from fluorescent lamp, the electronic stability can be achieved by DRL with transconductance operational amplifier [4].
In the next sections we describe the design of fourchanneled bio-amplifier for electrical activity measurements.The resulting device can be used for measurements of EEG in application of braincomputer interface.The non-invasive Steady State Visual Evoked Potential (SSVEP) method is used for this purpose.

BIO-AMPLIFIER
The device is primarily targeted for biological electrical signal measurements in the frequency range up to 160 Hz.The device is named BioAmp based on its main function.Because of different amplitude of various bio-signals, e.g.ECG has amplitude around 1 mV, EEG around 100 μV; it is appropriate to change signal gain depending on the type of measured signal.Change of gain helps to maintain stronger signal in defined output voltage range and weaker signals such as EEG are stretched to whole voltage range.Normally the device operating voltage is supplied from USB.Output analog signal is in the 0 -3.3V range.Alternatively, the device may be supplied from external DC power source connected via 2.1 mm power jack connector.When external power source is connected, supply from USB is automatically switched off and output analog signal is in range from 0 V to 5 V. Wider voltage range allows measurement of signals with higher gain without amplitude cut-off.
It is possible to connect a maximum of five electrodes to the device.One of electrodes has function of noise suppression -DRL electrode.The electrodes are connected to device via a pair of DB9 connectors which are commonly used for serial ports.Pinout of connectors is compatible with connectors of commercial Biopac electrode set.The Biopac systems are used across multiple disciplines including human physiology, pharmacology, exercise physiology and many other biological applications.
All four channels are bipolar which means they measure the difference between electrode pairs.The said pairs are interchangeable by switching position of jumper on the board.Each channel is sampled at a rate of 320 times per second.The resolution of AD converter is 12bits.Communication with PC is provided by USB virtual serial port.

Hardware design
The analog part of device is schematically displayed in the voltage followers.This isolates the output circuit so that the input is not affected in any way by the output.There are four input electrodes and one Driven Right Leg (DRL) electrode.DRL circuit is providing a high common mode rejection at power line frequency (50 Hz) [5], [6].Each channel measures the difference between electrode pair.One electrode is permanently connected to inverting input of instrumentation amplifier.One of other electrodes is not connected to inverting input but arbitrary connected to non-inverting input of amplifier (Fig. 2).This is realized by switching position of jumper on the board.
The difference between the chosen pair of electrodes is amplified by instrumentation amplifier INA333.Programmable gain is achieved by digital potentiometer DS1804-100 (Fig. 2).The DS1804-100 allows change of resistance in range from 0 to 100 k, by step of 1 k.The gain is adjustable via software running on the PC.The gain G 1 of amplifier can be set within the range from 2 to 101.
The last segment of analog part provides analog filtration of signal (Fig. 3).The passband filter consists of pair of operational amplifiers.First of them (IC7A in Fig. 3) acts as highpass filter with cut-off frequency at 0.5 Hz.Second amplifier (IC7B in Fig. 3) acts as a lowpass filter with cut-off frequency at about 160 Hz.This filter is also known as anti-aliasing filter.The minimal sampling frequency according to sampling theorem is then 320 Hz.Half of supply voltage is connected to the non-inverting pin of amplifiers in order to shift the zero line of the output signal.
The total gain G in (1) can vary within the range from 400 to 20 200.The output stage of analog part provides analog filtration in frequency range from 0.5 to 160 Hz.
The outputs of analog part are connected to AD converter inputs.Low-power converter ADS7844 by Texas Instruments is used in this process.The ADS7844 is an 8-channel, 12-bit sampling AD converter with synchronous serial interface.Only four single ended channels are used.The AD converter is controlled by 8-bit microcontroller ATmega88A by Atmel.ATmega88A is the "heart" of the bio-amplifier device.It is operating at 18 MHz (external crystal oscillator).It sets resistance of digital potentiometers, thus setting the gain of each channel and communicates with PC by using UART interface.Current PCs lack a standard serial port (RS232); therefore UART interface is converted to USB interface by using FT232RL integrated circuit.A shift register is necessary because many microcontroller pins are needed to control the AD converter, set the resistance of digital potentiometers and communicate with PC.In our case we used the 74HC595 shift register.The 74HC595 is 8-bit serial-in and parallel-out shift register.The shift register is used for controlling four digital potentiometers.

Construction of BioAmp device
The BioAmp device consists of two separate singlelayered PCBs connected together through connector (Fig. 4).The bottom PCB includes the analog part with digital potentiometers.The digital part and power supply circuits are placed on the top PCB.The electronics are encapsulated in the shielded box made of aluminum (Fig. 5).The shielded box effectively reduces noise from surroundings.Fig. 5 BioAmp device with EEG cup electrodes

Communication and data transfer
The device communicates with PC via virtual serial port.Baud rate is set to 38 400 with one stop bit and no parity bit.Each sample consists of two bytes (type uint16).Bytes are transmitted according to following timing diagram (Fig. 6).

Fig. 6 Serial timing diagram of data transfer
Data is transferred when RTS pin is set high.When RTS pin is set low, the data is transmitted until the last byte of the fourth channel is transmitted.The DSR pin indicates the busy state of the microcontroller.When DSR is high, the microcontroller is idle.When AD conversion or data transfer are in progress, the DSR pin is set to low.

BRAIN -COMPUTER INTERFACE
Normal human communication requires activity of peripheral nerves and muscles.Communication begins with a will to communicate which in turn starts a complex process, activating certain parts of the brain and the transmission of signals through the peripheral nervous system to specific muscles that are used for communication or control tasks.The BCI -Brain Computer Interface -is an artificial communication system that does not require the activity of the peripheral nerves or muscles.BCI is based on the measurement of intentional changes in the brain electrical activity.Electrical activity of the brain is measured by electroencephalograph (EEG).Signals obtained from brain activity are processed on a computer, hence the name BCI -Brain Computer Interface.BCI must have these characteristics:  BCI records brain signals directly, invasively or non-invasively,  real-time signal processing,  real-time user feedback,  system is controlled intentionally, and user chooses his/her activity.
BCI is not a passive EEG record or a neurobiofeedback training, does not use peripheral nerves or muscles, and definitely is not thought reading [7].The maximum peak corresponds to blinking frequency of light on which the user is most mentally focused.Frequency of repeatedly originated VEP is the same as the blinking frequency of light source.For example, if a human is looking at 5Hz blinking light, the PSD will contain a maximum at a frequency of 5 Hz (Fig. 7).Source of visual stimuli could be four LEDs blinking with four different frequencies representing four basic directionsleft, right, top and bottom.The peak with the highest amplitude at the specified blinking frequency corresponds to the arrow at which the user is mentally focused.SSVEP does not require a special training [8].functionality of this simple detection was successfully proven, the next objective was to detect one of four directions (left, right, top, bottom).

Visual stimuli
Visual stimuli were green rectangles programmed in PSYCHTOOLBOX.Rectangles are blinking with different frequencies on the opposite sides of the LCD display.We searched for maximal magnitude in the frequency domain (PSD) of an EEG signal.Useful frequencies and the minimal duration of stimulus were determined experimentally in a series of different blinking frequencies that were chosen according to technical characteristics of 60 Hz LCD display.LCD display can blink only on few discrete frequencies.On 60Hz display, one frame will be redrawn after 16,67ms after another one.For instance, if green frame is followed by black frame, period of this blinking is 33,34ms which approximately correspond to 30 Hz.The set of possible blinking frequencies consists of the following frequencies: 30Hz, 15Hz, 10Hz, 7.5Hz, 6Hz, 5Hz, 4.29 Hz, 3.75Hz, 3.33Hz, 3Hz, 3.73Hz, 2.5Hz and so on.We had to choose 4 different blinking frequencies which can be used for BCI.Blinking frequencies higher than 10Hz were useless because wakeful β sensorimotor rhythms have higher PSD than SSVEP.Frequencies below 1 Hz were distorted by the ECG signal.We chose four frequencies from the upper 1-10Hz interval -7.5Hz, 6Hz, 5Hz, 4.29 Hz, because higher frequency means more visual stimuli per second.Although frequencies 5Hz and 4.29 Hz are relatively close, we could not use 3.75Hz because the second harmonic of 3.75Hz is 7.5Hz and this frequency is already used.The minimal length of useful visual stimulus was 7.1s.This time was determined by experiments that are described in later chapters.

Measurement of EEG signal
EEG signal was measured from electrode positions Oz, O1, O2 (Fig. 8).We used standard 11 mm golden cup electrodes which were glued to the head with a conductive gel.
The reference electrode was connected to Cz position (head top) and later connected onto the right ear (not visible in Fig. 8).The DRL electrode was on the left ear.The DRL -Driven Right Leg circuit provides high common mode noise rejection.

Fig. 8 Electrodes placement
The measured signals were digitally filtered in MATLAB by using bandpass FIR filter 1Hz -10Hz; later 2Hz -10Hz.Order of filter was originally 810 but was later decreased to 405.The PSD was calculated after signal filtering.When maximum peak at identical frequencies was found in at least three of four channels, the resulting direction was marked with two red squares on the corresponding side of the LCD display (Fig. 9).

RESULTS
The visual stimulus on the left side of the screen was a green rectangle with 4.29 Hz blinking frequency, on the right side there was a green rectangle with 5 Hz blinking frequency.We conducted 10 series of measurements.Direction was evaluated six times in each series.In series 1 -6, the maximum of PSD was searched in frequency range 3.82Hz -4.77Hz for 4.29Hz blinking frequency and in frequency range from 4.53Hz to 5.47Hz for 5Hz blinking frequency.
In series 1-4 we had 100% success rate with 13.5s long visual stimuli.In the fifth series, we had a 50% success rate with 6.7s long visual stimuli.In the sixth series, we had 83% success rate with 8.5s long visual stimuli.
In series 7-10, the maximum of PSD was searched in the frequency range 3.98Hz -4.6Hz for 4.29Hz blinking frequency and in frequency range from 4.69Hz to 5.31Hz for 5Hz blinking frequency.
In series 7-9, with stimulus with length of 7 s, we achieved a 100% success rate in three series (total of 18 detections).In the tenth series, we had a 50% success rate with 6.8s long visual stimuli.
The next objective was to detect one of four directions (left, right, top, bottom).We extended our previous method so that the visual stimuli are represented by four blinking rectangles situated in LCD screen sides.The rectangles are situated on the left side, top side, right side and bottom side with blinking frequencies 4.29Hz, 5Hz, 6Hz and 7.5Hz, respectively.Situation is depicted in Fig. 9.We conducted four series of measurements.In each series we detected individual directions twelve times.In the first series we achieved a 75% success rate with 8.

CONCLUSION
This article describes the design of a 4-channel bioamplifier with programmable gain and switchable electrode pairs per channel.The device can be used for general diagnostic purposes because of its relatively small frequency range (up to 160 Hz).The function of device was demonstrated on simple braincomputer interface.We successfully created an SSVEP based BCI.But our BCI implementation has certain shortcomingslong visual stimulus duration (7.1s) and detection time (9s).Visual stimulus should not be longer than 2-3s long, so as to avoid user concentration loss.Detection and user feedback should be instantaneous.Detection time can be shortened if we use faster algorithms, for example Goertzel algorithm instead of FFT or multi thread detection program running on more powerful multi core processors.The success rate drops immediately when the user loses focus on the desired direction.After fixing these disadvantages, the BCI system will become a feasible and perspective computer control system for healthy and disabled people alike.

Fig. 1
Fig. 1 Block diagram of the analog part.

Fig. 2
Fig. 2 Programmable gain of INA333 provided by digital potentiometer DS1804.The selection of second electrode is performed by changing jumper position in on-board socket

Fig. 3
Fig. 3 Analog filtration and amplification of the signal The gain of output amplifiers is set to fixed value G 2 = 200.The total gain G of each channel is given by

3. 1 .
Noninvasive brain signals suitable for BCI If changes of brain electrical activity are influenced by an external event or stimulus, brain signals are called ERP -Event Related Potentials.The VEP method -Visual Evoked Potential is mostly studied.VEP consists of three subsequent components.The first component -V1 is negative potential with 75ms duration.The second component -P1 or N100 is positive potential with duration of 100ms.The third component -N1 is negative potential with 145ms duration.The SSVEP -Steady State Visual Evoked Potential is originated by repeating visual stimuli.SSVEP based BCI records EEG signal from the visual cortex, transforms it to frequency (spectral) domain, calculates the power spectral density (PSD) and determines maximum peak in PSD.

Fig. 7
Fig. 7 PSD of EEG with 5Hz peak used for detection of top direction4.DEVELOPMENT OF A SIMPLE BCIThe objective of this part was to as first design a simple BCI capable to detect one of two possible directions (left or right) on which the user is focused.The BioAmp device is used for this purpose.After the

Fig. 9
Fig. 9 Visual stimuli represented by green blinking rectangles positioned on left, top, right and bottom side blinking at frequencies 4.29Hz, 5Hz, 6Hz and 7.5Hz respectively.Detected direction marked by red color.
In the second series, we used larger display with 63 cm diagonal instead of 35 cm and achieved a 75% success rate with 7.1 s visual stimuli.In series 3-4 we had 75% success rate with 7.1s visual stimuli.Prolongation of the visual stimulus did not improve the success rate.With visual stimulus shorter than 7.1s we achieved a success rate of 50% which is practically useless.Recording signal to the PC, signal processing and detection took additional 9s.Maximum of PSD was searched in frequency range 3.98Hz -4.6Hz for 4.29Hz blinking frequency, in frequency range 4.69Hz -5.31Hz for 5Hz blinking frequency, in frequency range 5.73Hz -6.33Hz for 6Hz blinking frequency and in frequency range 7.19Hz -7.81Hz for 7.5Hz blinking frequency.