Data Collection System of EEG Based on USB Interface

This article introduces a EEG synchronous sampling system and its hardware composing principle and software design method which is based on USB interface IC FT245BM, simultaneous and high speed 16 bit ADC IC ADS8320 with 16 channels, and 8 bit SCM AT89C51. This system can fully enhance the veracity of data measuring, and show its superiority in the precise measurement of the EEG parameters. This system has come into operation and produced good effect.


Introduction
Electroencephalograph (EEG) is a sort of technology which magnifies and records the bioelectricity in human brain tissues and reflects the electronic activities of the brain.Because EEG reflects the "live" functional situations of the brain tissues, so since 1930s it appeared, it has been exerting important effects to diagnose nervous system illnesses.This technology mainly utilizes electroencephalograph to check and diagnose nervous system illnesses such as falling sickness, brain trauma and brain knub.
The traditional EEG machine had big volume, was not easy to move and can not be applied in ambulance, field and other situations.With the development of electronic technology and computer technology, the synchronal collection and automatic analysis functions of several brain electronic conduction signals have gradually become the main development directions for the EEG machine with functions of checking, diagnosing and monitoring.At the same time, the medical instruments is transforming to the orientation for the community and family.Because of the popularization of family and hospital PC especial the notebook PC, adding the abroad usage of convenient USB interface, it is very necessary to establish computer EEG collection system based on USB interface.It can not only convenient for checking nervous system illnesses, but suit for family usage.When the patient feels headache, it can timely record the brain waves to find out relative illness and help to diagnose for the doctor.

Characters of brain wave signal
Based on different frequency ranges, the brain wave signals can be divided into four sorts of wave.The first sort is the wave α which is in 8Hz~12Hz, 10μV~100μV, and indicates that people is in ease situation.The second sort is the wave β which is in 16Hz~30Hz, 10μV~50μV, and indicates that people is in working situation.The third sort is the wave δ which is in 0.5Hz~3Hz, 10μV~200μV, and indicates that people is in deep sleeping situation.The fourth sort is the wave θ which is in 4Hz~7Hz, 20μV~150μV, and indicates that people is in dreaming situation.In a word, at this time, the brain wave signal is very weak, and the pressure range is in 10μV~200μV, the frequency range is in 0.5Hz~30Hz (Zhang, 1998, p.1-11).Except that, the brain wave signal has the following characters.First, the characters of randomicity and equability are very strong.Second, the brain wave signal has character of nonlinearity.Third, the background of collected brave wave signal is very complex, including the interference of 50Hz AC signal, and contact noise of electrode and skin, common mode of electrode and terra and so on.Those characters are several places what we should especially notice when designing the brave EEG collection system.

Overall design
The system structure is seen in Figure 1.The whole system is composed of six components including brain wave signal sampling, difference magnification, multiplexing selection, smoothing circuit, AD sampling controlled by SCM, and data transmission.The complete flow of this system is presented as follows.
(1) Inspect brain wave signals through electrode sensor and input it into the protective circuit to limit the pressure.
(2) Implement difference magnification to the brain wave signals.
(3) Because the high speed photoelectricity isolation circuitry (IL715) is very expensive, so we would try to reduce the channels amounts of photoelectricity isolation when designing.According to the character that the practical brain wave signal sampling has 16 channels, so we adopt two pieces of CD4051 which chooses 1 in 8 to implement multiplexing selection and decide the sequence of these 16 channels signals, so AT89C51 only needs four data lines to control the input of 16 channels input of brain wave signals.
(4) Before SCM AT89C51 select one channel of brain wave signals to input through multiplexing selector, these signals must pass smoothing circuit includes high pass filter and low pass filter.
(5) The brain wave signals through smoothing enter into ADS8320 to transform, and then the transformed data enter into the P1 portal of SCM through photoelectricity isolation circuitry IL715.
(6) Under the control of SCM AT89C51, data are transmitted to PC or notebook PC through USB interface FT245BM passing P3 portal.

Design of difference bioelectricity amplifier
The design of difference bioelectricity amplifier is the key part for exact sampling brain wave signals.We adopt the medical amplifier general instrument amplifier chip INA128 of INA series made by American BB Company which has the advantages of low power, low temperature excursions, high precision and high restraining ratio of common mode, and the concrete parameters include that (1) when the plus is bigger than 100, CMRR = 120 dB, (2) the maximal input maladjustment pressure is 125μV and the maximal input maladjustment pressure excursion is 1μV/°C.Therefore, INA128 is a perfect bioelectricity amplifier.

Smoothing circuit
The smoothing circuit is composed of low pass filter circuit and high pass filter circuit.For the low pass filter circuit, we consider that the transition band of the first order filter is too wide and that will influence the effect of smoothing.To make the transition band become narrow, we can implement cascade through same filters, and cascades are more, the changes from band pass to band resistance are more rapid (that is the transition band is narrower).Because Butterworth filter is flat response filter and its phase characters are better than Chebyshev filter, Anti-Chebyshev filter and ellipse function filter of same order, so we take Butterworth filter as the low pass filter in the preprocessing circuit.At the same time, because the frequency of the collected brain wave signals is low frequency which frequency is in about tens Hz, so we set up the cut-off frequency at about 40Hz, accordingly the fourth order Butterworth filter completely accords with the requirement of the design.For the high pass filter, we adopt passive filter which initiation frequency is 0.5 Hz, R1 = 330 KΩ and C1 = 1μF.

Structure design of hardware
Generally speaking, when we choose A/D converter, we always require the data collection system not only possesses the characters of high speed and precision, but also has the characters of low pressure, small volume and low power.ADS8320 is the gradual approach parallel 16 bit low power CMOS high speed A/D converter made by Burr-Brown Company which linearity degree is ±0.05%, its work power supply is in the range of 2.7V~5.25V,and its sampling frequency can maximally achieve 100kHz, and when the power supply is in 2.7V and the sampling speed is 100kHz, its power waste is only 1.8mW, and when the sampling speed is 10kHz, its sampling power waste is only 0.3mW, and under non-transformation situation, it can be in close mode, at this time its power waste can reduce to 100μW.ADS8320 has synchronic parallel SPI/SSI interface, so the ports occupying the microprocessor are less.Its differential input signal range is 500mV~Vcc (work power supply).Its encapsulation adopts 8 MSOP small volume type.Simultaneously the above characters also make ADS8320 very suit for portable battery power supply system, which can establish bases for the future portable medical equipments.
For USB interface chip, we choose FT245BM made by Britain Future Technology Device Intl.Ltd.FT245BM brings FIFO output cushion with 384 bytes and FIFO input cushion with 128 bytes and possesses the data transportation ability of 1M byte/s.Its USB agreement has been solidified in the chip convenient for using.When SCM checks TXT# is in low voltage, data can be read in the module, and when TXT# is in high voltage, FIFO with 384 bytes is full and data can not be read in the module.When SCM checks RXF is in low voltage, the module has data already, and SCM can read out data from the module, and when RXF is in high voltage, the module has no data.The main hardware structure of the system is seen in Figure 2.

Software design of slave machine
The program of SCM includes the following modules such as main program, system initialization, data sending and data incepting.The main program module is a very pivotal part in the whole software design, and except that it completes the application functions such as SCM system initialization and designing system, the more important is that it will organically combine various subprograms and manage and control these subprograms and offer the corresponding program portals for those subprograms, accordingly actualizes the function of the whole system.The parallel initialization program module mainly completes the basic settings including the baud rate, parity bit, setting communication agreement, opening parallel port and stopping for the parallel communication.The sending and receipting subprograms complete the sending and receipt of the data.The system running begins form the main program which exerts the original flow, and actualizes the users' engaged functions.Only when the parallel stopping request is produced, the system turns to process the parallel communication subprogram, accordingly complete once the receipt and sending of the data, and the parallel communication ends and the program returns.

Software design of master machine
When USB facility inserts the PC, the operation system will request installing device.FIDI Company offers two sorts of drivers including VCP and (DLL) for the USB interface facility based on FT245BM.Different drivers require different PC software design methods.We choose the former sort here.When choosing installing VCP driver, the operation system will simulate the USB interface facility based on FT245BM into parallel communication ports, and the operation to this dummy parallel ports is same to the operation to the USB interface facility, so in the application program we can utilize the parallel communication control to predigest the design of the PC port software.At present, the mature parallel communication controls include MSCOMM, SPCOMM, and PCCOMM.This article adopts Labview 8.20 (Yang, 1999, p.34-35) and MSCOMM to complete the software design of the PC port based on VCP.It is easy to utilize MSCOMM to compile the programs aiming at the parallel port operation, because MSCOMM has plentiful attributes and affairs closely relative to parallel communication, and offers various operations to the parallel ports.According to the attributes, methods and affairs offered by MSCOMM, it can complete the read-write to the dummy parallel ports FT245BM, and avoids the operations to the USB interface.
Therefore, we define the main communication agreements of the master machine and the slave machine.First, starting collection order is to output decimal number 20 or hex number &14H to the parallel port.Second, stopping collection order is to output decimal number 0 or hex number &00H to the parallel port.The convenient agreement and powerful figure function of Labview 8.20 can help us to actualize the data collection and storage of the brain wave signals, and the dynamic display, scanning, replaying of the brain waves and other main function, and according to the present data base of brain wave signals, to implement data comparison and make pre-diagnosing to assist the doctor's diagnosing.At present this system has been used and obtains good effects in the clinic.

Conclusions
This article introduces a sort of high speed and low power waste brain wave signal collection system which convenient for the doctor's diagnosis and prevention of the illness.In addition, because this system possesses the characters of small volume, low power waste and stable performance, it not only suits for the portable usage through battery power supply, but also suits for timely records of brain wave signals at home, which embodies more human cares to the patients.