SlideShare uma empresa Scribd logo
1 de 6
Baixar para ler offline
Charles Moyes (cwm55) and Mengxiang Jiang (mj294)


        Cornell University ECE 4760 Final Project:
       Brain-Computer Interface using Multi-Channel
                 Electroencephalography
Project Overview
The goal of the project is to build a multi-channel electroencephalography (EEG) Brain-Computer Inter-
face (BCI). At a high level, the project will record and collect EEG data from the user using electrodes
attached to the patient’s scalp. The data will then be processed by a machine learning algorithm such as
a feed-forward artificial neural network (ANN) which will attempt to classify the data. We plan on either
trying to discover which color the user is thinking of or allowing the user to control a mouse pointer using
their thoughts. Because of the nature of the machine learning algorithms we will be using, an initial training
period will be required where the user is prompted to “think of” or “imagine” colors and mouse movement
directions. The EEG data corresponding to the user’s thoughts will then be used to train the neural network
via the back-propagation method. From there, the user will be able to control the system using their mind:




    Because we feel that this project is fairly ambitious, there will be several “checkpoints” or stopping
points, in case we run out of time or encounter difficulties. The first goal will be to collect EEG data from
the user using the microcontroller’s analog-to-digital (ADC) converter. The analog circuitry involved will
consist of a three-stage amplification circuit with an instrumentation amplifier, an operation amplifier, and
a filter. The filter will consist of a high-pass filter with a cut-off frequency very close to zero to remove DC
offsets from the signal, along with a low-pass filter with a cut-off frequency of around 60 Hz for anti-aliasing
and possibly a 60 Hz notch filter to remove AC power noise induced in the user’s body. We ordered low-cost
EEG electrodes from a Chinese medical supply company on eBay for around $20, but we may resort to
home-made electrodes constructed from metal guitar picks borrowed from a friend who is a musician and an
old baseball cap if the budget does not permit us to use the medical-grade electrodes. Another note is that
a so-called “right-leg driver” connected to the user’s right leg will be necessary to cancel out common-mode
noise from the user’s body. This driver will be connected to the instrumentation amplifier to take advantage
of its common-mode rejection functionality. The main challenge will be amplifying a signal from the user’s
scalp on the order of microvolts, while filtering out the vast sources of noise.

    This data could then be presented on a graphical pixel LCD attached to the microcontroller, or it could
be transmitted to a computer over USB serial UART. However, for now we will be content with merely
collecting the EEG data from the user and sending it to MATLAB over UART. This will require some C
code to be written for the microcontroller that will read the ADC input, format the data in Modular EEG
packet format, and send it to the PC over the serial port. Once we have a working EEG (this is one “check-
point”), we would like to add as many channels (up to 16, ideally) as our budget permits. We have found


                                                      1
an instrumentation amplifier and Besselworth filter IC from Maxim IC and cheap op amps that we will use
for this project. A possible time-permitting feature is the addition of a Bluetooth system-on-chip wireless
transceiver (TI has one that we could sample). This would allow the user to control their smartphone or
Bluetooth-enabled laptop using the BCI, but it would also impact our budget significantly.

    The next checkpoint would be processing the collected data. We have had significant coursework in
artificial intelligence (AI) and have been studying papers on diagnosing sleep apnea and processing EEG
data in the context of brain-computer interfaces throughout the semester. We cannot guarantee good results
with the latter since we have not done anything like it before, so if we are unable to obtain good results,
then we will merely determine the patient’s level of emotional arousal based on the EEG waveforms using
their frequency spectra. An example follows:




   However, we would definitely like to take time to experiment, namely with ANN’s so that we can attempt
to classify the user’s thoughts based on their brainwaves. Another simpler possibility would be detecting
EEG arousals in users that have sleep apnea. This is fairly simple to do given that one has a real-time EEG
data source, and the details have been outlined in several IEEE papers. The goal would be to have a user
think of a color (e.g. red, blue, or green) and then have the ANN classify which color the user is thinking of
from the received EEG data. Yet another possibility is having them thinking of cardinal movement directions
and then using the EEG data to move the mouse pointer. We feel that this is significantly more advanced,
however, than the color-detection process. At this point, we would be very satisfied with our project and we
would be more than happy to call it complete.


Relevant Standards
We will follow the Modular EEG serial packet standard for transmitting EEG data over UART. Moreover,
serial communications will follow the RS232/USB standards. Another consideration is the IEC601 standard.
IEC601 is a medical safety standard for medical devices that ensures that they are safe for patient use.
Unfortunately, testing for IEC601 compliance is very much out-of-budget. Nevertheless, we discuss the
many safety considerations that we will absolutely adhere by in the Societal Impact of Project section
of this write-up. If we opt to use Bluetooth as a wireless communication interface for this project, we will
use the Texas Instruments CC2560 single-chip Bluetooth IC, which complies with FCC standards.


                                                      2
Tentative Parts List
A tentative parts list follows:

For Each Analog EEG Channel:
                                   Part                                   Cost
                   MAX4194 - instrumentation amplifier IC                SAMPLE
                    MAX7401 - 8th order Bessel filter IC                 SAMPLE
                           AD8605 - op amp IC                           SAMPLE
                          TL062CP - op amp IC                   2*$0.26/channel (Digikey)
                      Filter capacitors and resistors                 LAB/CHEAP
                             2K Potentiometer                         LAB/CHEAP
                      4x NPN and PNP transistors                      LAB/CHEAP

EEG electrodes:
                                      Part                                         Cost
            CONTEC ten pcs silver plated electrodes (budget-permitting)          $20 (eBay)
                                       OR                                           OR
                      Metal Guitar Picks and Headband                          ALREADY OWN

RS232 isolation:
                              Part                                     Cost
                6N137 optoisolator (or equivalent)    2*$1.55 (1 if only using TX) (Digikey)
                      2x NPN transistors                           LAB/CHEAP

Unavoidable Lab Costs Incurred:
                                 Part                                         Cost
              White Board OR Solder Board (Time-Permitting)                $6 OR $2.50
                             4x AA Batteries                            ALREADY OWN
                           4 AA Battery Holder                           $1.33 (Digikey)
                         Mega644 Microcontroller                                $8
                     SIP Header Sockets/DIP sockets                  To Be Determined (TBD)
                        AT Mega 644 Target Board                               LAB

Extra features:
                                   Part                              Cost
                     Graphical LCD (budget-permitting)          $15 (SparkFun)
                     CC2560 - TI Single-Chip Bluetooth      SAMPLE (time-permitting)


Societal Impact of Project/Safety Features
Because this is a device attached to a patient’s brain, safety is our utmost priority. The microcontroller
will only be powered by four 1.5V AA batteries, rather than through an AC power supply connected to
mains. Moreover, serial communication to a PC over USB will be isolated from the USB using optocouplers,
which we will test extensively to ensure that both ground loops are separated. Only laptops running off of
battery power supplies (no AC adapters connected) will ever be connected to the microcontroller over USB.
As a corollary, the microcontroller will never be connected to a user’s head while the programmer cable is
connected to a PC. Lastly, the EEG circuitry itself will have transistors connected directly to the electrodes
(in between the electrodes and the analog circuitry) to act as a user current/ESD protection mechanism.
We promise that 120 VAC power will never be connected to this project directly or indirectly. As a result,


                                                      3
users will never be allowed to touch any other electrical devices while wearing the EEG helmet. We will take
safety very seriously throughout the development of the project.

   This project will have great societal impact because it is designed for users with special needs. Using
brain-computer interfaces, users with special needs will be able to interact in computers in ways that were
not previously possible. Patients with sleep apnea will be able to collect and analyze their own EEG data
while asleep without having to participate in expensive overnight sleep studies at hospitals. They will be
able to see their data; rather than being shielded from it by a medical doctor. Because our budget is less
than $75, they will be able to do this at a very low cost. We are strongly considering releasing our schematics
and source code on the Internet free-of-charge under the Creative Commons license in order to give back to
society.


Project Block Diagram
An overall block diagram of the project follows:
            EEG                                                      High-Pass                           High-Pass
         Electrodes                                                    Filter                              Filter                                  ADC
                      ESD Discharge
                                                   Instrumentation                    Operational                            Besselworth                 AT Mega 644
                        Protection
                                                       Amplifier                       Amplifier                                Filter                   Microcontroller
                          Circuit
User’s
Head
                                                                                                                                                                  UART


                                         EEG
                                      Electrodes      Right-Leg
                                                        Driver


                                                                                                                     ELECTRICALLY ISOLATED LINE:




                                                                                     Real-Time FFT
                                                    On-Screen                               with
                                                                                                                           Battery-Powered                  FTDI
                                                   Classification                    Artificial Neural
                                                                                                                             Laptop PC                    USB RS232
                                                   Output to User                        Network
                                                                                      in MATLAB




Tentative Schematics
NOTE: These tentative schematics are highly subject to change throughout the development of our project!

Analog Amplification Circuit




                                                                                 4
Opto-isolated UART Serial
     As mandated by our safety procedures, we will electrically isolate the UART from the USB. The isolated
     UART will use high-bandwidth 6N137 opto-couplers from Fairchild Semiconductor as follows:




        It will interface with the UART Pin D.0 and Pin D.1 from the microcontroller. Note that we may have
     to add NPN transistors to invert the output as specified in the 6N137 datasheet if we cannot figure out a
     way to invert the UART output in software. The TX and RX lines will then connect to the FT232RL FTDI
     chip, which will be connected to USB GND and USB 5V for power. Unlike Open EEG’s Modular EEG project,
     we opted to use 6N137 optoisolators with USB rather than 6N139’s with RS232 using a MAX232 IC.


     Code Overview
     Sample code for reading the ADC values and transmitting them to MATLAB over the UART follows. This
     code will be extended to support multiple ADC channels and output to a graphical LCD. Note that the
     following code listing has not been tested yet and so we cannot guarantee code correctness:

 1   # include   < avr / io .h >
     # include   < avr / interrupt .h >
 3   # include   < avr / pgmspace .h >
     # include   < avr / eeprom .h >
 5   # include   < stdio .h >
     # include   < stdlib .h >
 7   # include   < string .h >
     # include   " lcd_lib . h "
 9   # include   < util / delay .h >

11   // UART file descriptor
     // putchar and getchar are in uart . c
13   FILE uart_str = F D E V _ S E T U P _ S T R E A M ( uart_putchar , uart_getchar , _FDE V_SETUP_ RW ) ;

15   // ADC variables
     volatile int Ain , AinLow ;
17   # define ADC_BITS 10

19   // ADC ISR
     ISR ( ADC_vect )



                                                                5
21   {
         AinLow = ( int ) ADCL ;
23       Ain = ( int ) ADCH *256;
         Ain = Ain + AinLow ;
25
         fprintf ( stdout , " % d  n  r " , Ain ) ;
27
         ADCSRA |= (1 < < ADSC ) ; // start another ADC conversion
29   }

31   void main ()
     {
33       // init the A to D converter
         // channel zero / left adj / EXTERNAL Aref
35       // !!! DO NOT CONNECT Aref jumper !!!!
         // Need capacitor at AREF pin and AVCC set to VCC
37       ADMUX = (1 << REFS0 ) ;

39         // enable ADC and set prescaler to 1/128*16 MHz =125 ,000
           // and clear interupt enable
41         // and start a conversion
           ADCSRA = (1 < < ADEN ) | (1 < < ADIE ) + 7;
43
         // sleep register
45       SMCR = (1 << SM0 ) ; // ADC sleep

47       // init the UART -- uart_init () is in uart . c
         uart_init () ;
49       stdout = stdin = stderr = & uart_str ;
         fprintf ( stdout , " Starting ADC demo ... n  r " ) ;
51
           sei () ; // start interrupts
53
         // main loop
55       while (1)
         {
57         sleep_cpu () ;
         }
59   }

                                                   Listing 1: C Source Code Listing


     References
     [1] Openeeg project. http://http://openeeg.sourceforge.net/, 2009.
     [2] Homebrew do-it-yourself eeg, ekg, and emg. http://sites.google.com/site/chipstein/home-page, 2011.
     [3] F Lotte. A review of classication algorithms for eeg-based braincomputer interfaces. Journal of Neural
         Engineering, 2007.
     [4] G. Matsuoka, T. Sugi, F. Kawana, and M. Nakamura. Automatic detection of apnea and eeg arousals
         for sleep apnea syndrome. In ICCAS-SICE, 2009, pages 4651 –4654, aug. 2009.
     [5] Hazrati MKh and Efranian A. An online eeg-based brain-computer interface for controlling hand grasp
         using an adaptive probabilistic neural network. PubMed, 2010.
     [6] Jorge Baztarrica Ochoa. EEG Signal Classification for Brain Computer Interface Applications. PhD
         thesis, Ecole Polytechnique Federale de Lausanne, 2002.
     [7] Olson. Eeg page. http://www.pkfamily.com/users/solson/eeg/eeg.html, 2007.
     [8] Kouhyar Tavakolian, Faratash Vasefi, Kaveh Naziripour, and Siamak Rezaei. Mental task classifica-
         tion for brain computer interface applications. In First Canadian Student Conference on Biomedical
         Programming.


                                                                  6

Mais conteúdo relacionado

Mais procurados

Analysing EEG data using MATLAB
Analysing EEG data using MATLABAnalysing EEG data using MATLAB
Analysing EEG data using MATLABEva van Poppel
 
SPICE MODEL of 2SC2240 in SPICE PARK
SPICE MODEL of 2SC2240 in SPICE PARKSPICE MODEL of 2SC2240 in SPICE PARK
SPICE MODEL of 2SC2240 in SPICE PARKTsuyoshi Horigome
 
PhD Oral Defense of Md Kafiul Islam on "ARTIFACT CHARACTERIZATION, DETECTION ...
PhD Oral Defense of Md Kafiul Islam on "ARTIFACT CHARACTERIZATION, DETECTION ...PhD Oral Defense of Md Kafiul Islam on "ARTIFACT CHARACTERIZATION, DETECTION ...
PhD Oral Defense of Md Kafiul Islam on "ARTIFACT CHARACTERIZATION, DETECTION ...Md Kafiul Islam
 
Arduino Workshop Day 2 - Advance Arduino & DIY
Arduino Workshop Day 2 - Advance Arduino & DIYArduino Workshop Day 2 - Advance Arduino & DIY
Arduino Workshop Day 2 - Advance Arduino & DIYVishnu
 
Arduino Workshop
Arduino WorkshopArduino Workshop
Arduino Workshopatuline
 
Avionics-Project-Report
Avionics-Project-ReportAvionics-Project-Report
Avionics-Project-ReportWen Theng Tan
 
1396740 634706422070340000
1396740 6347064220703400001396740 634706422070340000
1396740 634706422070340000bnsprasad
 
light emmitting diode
light emmitting diodelight emmitting diode
light emmitting diodesalman01
 
Automatic IN/OUT Indicator with Doorbell Manual
Automatic IN/OUT Indicator with Doorbell ManualAutomatic IN/OUT Indicator with Doorbell Manual
Automatic IN/OUT Indicator with Doorbell ManualTezpur University
 
Tech led ppt(pptplanet.com)
Tech led ppt(pptplanet.com)Tech led ppt(pptplanet.com)
Tech led ppt(pptplanet.com)Rocky Sharma
 
SPICE MODEL of 2SC3329 in SPICE PARK
SPICE MODEL of 2SC3329 in SPICE PARKSPICE MODEL of 2SC3329 in SPICE PARK
SPICE MODEL of 2SC3329 in SPICE PARKTsuyoshi Horigome
 
IOTC08 The Arduino Platform
IOTC08 The Arduino PlatformIOTC08 The Arduino Platform
IOTC08 The Arduino PlatformEoin Brazil
 
Power Over Fiber_PCBProject
Power Over Fiber_PCBProjectPower Over Fiber_PCBProject
Power Over Fiber_PCBProjectInbar Kinarty
 
Getting Started With Arduino_Tutorial
Getting Started With Arduino_TutorialGetting Started With Arduino_Tutorial
Getting Started With Arduino_TutorialNYCCTfab
 
Arduino spooky projects_class3
Arduino spooky projects_class3Arduino spooky projects_class3
Arduino spooky projects_class3Anil Yadav
 
Voice control home appliance
Voice control home applianceVoice control home appliance
Voice control home applianceNishant Singh
 
Signal processing and filters for reg review ms ni
Signal processing and filters for reg review ms niSignal processing and filters for reg review ms ni
Signal processing and filters for reg review ms niangleel
 

Mais procurados (20)

Analysing EEG data using MATLAB
Analysing EEG data using MATLABAnalysing EEG data using MATLAB
Analysing EEG data using MATLAB
 
SPICE MODEL of 2SC2240 in SPICE PARK
SPICE MODEL of 2SC2240 in SPICE PARKSPICE MODEL of 2SC2240 in SPICE PARK
SPICE MODEL of 2SC2240 in SPICE PARK
 
PhD Oral Defense of Md Kafiul Islam on "ARTIFACT CHARACTERIZATION, DETECTION ...
PhD Oral Defense of Md Kafiul Islam on "ARTIFACT CHARACTERIZATION, DETECTION ...PhD Oral Defense of Md Kafiul Islam on "ARTIFACT CHARACTERIZATION, DETECTION ...
PhD Oral Defense of Md Kafiul Islam on "ARTIFACT CHARACTERIZATION, DETECTION ...
 
Arduino Workshop Day 2 - Advance Arduino & DIY
Arduino Workshop Day 2 - Advance Arduino & DIYArduino Workshop Day 2 - Advance Arduino & DIY
Arduino Workshop Day 2 - Advance Arduino & DIY
 
Arduino Workshop
Arduino WorkshopArduino Workshop
Arduino Workshop
 
Avionics-Project-Report
Avionics-Project-ReportAvionics-Project-Report
Avionics-Project-Report
 
1396740 634706422070340000
1396740 6347064220703400001396740 634706422070340000
1396740 634706422070340000
 
light emmitting diode
light emmitting diodelight emmitting diode
light emmitting diode
 
Automatic IN/OUT Indicator with Doorbell Manual
Automatic IN/OUT Indicator with Doorbell ManualAutomatic IN/OUT Indicator with Doorbell Manual
Automatic IN/OUT Indicator with Doorbell Manual
 
Arduino guide
Arduino guideArduino guide
Arduino guide
 
Tech led ppt(pptplanet.com)
Tech led ppt(pptplanet.com)Tech led ppt(pptplanet.com)
Tech led ppt(pptplanet.com)
 
SPICE MODEL of 2SC3329 in SPICE PARK
SPICE MODEL of 2SC3329 in SPICE PARKSPICE MODEL of 2SC3329 in SPICE PARK
SPICE MODEL of 2SC3329 in SPICE PARK
 
IOTC08 The Arduino Platform
IOTC08 The Arduino PlatformIOTC08 The Arduino Platform
IOTC08 The Arduino Platform
 
EEG artefacts
EEG artefactsEEG artefacts
EEG artefacts
 
Power Over Fiber_PCBProject
Power Over Fiber_PCBProjectPower Over Fiber_PCBProject
Power Over Fiber_PCBProject
 
Getting Started With Arduino_Tutorial
Getting Started With Arduino_TutorialGetting Started With Arduino_Tutorial
Getting Started With Arduino_Tutorial
 
Fun with arduino
Fun with arduinoFun with arduino
Fun with arduino
 
Arduino spooky projects_class3
Arduino spooky projects_class3Arduino spooky projects_class3
Arduino spooky projects_class3
 
Voice control home appliance
Voice control home applianceVoice control home appliance
Voice control home appliance
 
Signal processing and filters for reg review ms ni
Signal processing and filters for reg review ms niSignal processing and filters for reg review ms ni
Signal processing and filters for reg review ms ni
 

Semelhante a Ece4760 hw5

Non-Invasive point of care ECG signal detection and analytics for cardiac dis...
Non-Invasive point of care ECG signal detection and analytics for cardiac dis...Non-Invasive point of care ECG signal detection and analytics for cardiac dis...
Non-Invasive point of care ECG signal detection and analytics for cardiac dis...gptshubham
 
Design of single channel portable eeg
Design of single channel portable eegDesign of single channel portable eeg
Design of single channel portable eegijbesjournal
 
Brain computer interface
Brain computer interfaceBrain computer interface
Brain computer interfacemrudu5
 
Senior Project Students' Presentation on ECG Monitoring
Senior Project Students' Presentation on ECG MonitoringSenior Project Students' Presentation on ECG Monitoring
Senior Project Students' Presentation on ECG MonitoringMd Kafiul Islam
 
189626882 ep227-digital-electronics
189626882 ep227-digital-electronics189626882 ep227-digital-electronics
189626882 ep227-digital-electronicsDimple Bansal
 
ELECTRONIC CIRCUIT BREAKER
ELECTRONIC CIRCUIT BREAKERELECTRONIC CIRCUIT BREAKER
ELECTRONIC CIRCUIT BREAKERganeshbehera6
 
The research of_portable_ecg_monitoring_system_with_usb_host_interface
The research of_portable_ecg_monitoring_system_with_usb_host_interfaceThe research of_portable_ecg_monitoring_system_with_usb_host_interface
The research of_portable_ecg_monitoring_system_with_usb_host_interfaceArhamSheikh1
 
An ECG-on-Chip for Wearable Cardiac Monitoring Devices
An ECG-on-Chip for Wearable Cardiac Monitoring Devices An ECG-on-Chip for Wearable Cardiac Monitoring Devices
An ECG-on-Chip for Wearable Cardiac Monitoring Devices ecgpapers
 
101 200 transistorcircuits
101 200 transistorcircuits101 200 transistorcircuits
101 200 transistorcircuitsAlejandro Perez
 
62 ijtet14003 pdf-libre
62 ijtet14003 pdf-libre62 ijtet14003 pdf-libre
62 ijtet14003 pdf-libreIJTET Journal
 
under grund fault ppt (1).pptx
under grund fault ppt (1).pptxunder grund fault ppt (1).pptx
under grund fault ppt (1).pptxPoojaG86
 
Brain Computer Interface
Brain Computer InterfaceBrain Computer Interface
Brain Computer InterfaceSubham Kundu
 
Scaling Down Instrumentation Deploying Analog Mixed Signal Technology
Scaling Down Instrumentation Deploying Analog Mixed Signal TechnologyScaling Down Instrumentation Deploying Analog Mixed Signal Technology
Scaling Down Instrumentation Deploying Analog Mixed Signal TechnologyShivaprasad Tilekar
 
Aryaa_Jaipur.pptx
Aryaa_Jaipur.pptxAryaa_Jaipur.pptx
Aryaa_Jaipur.pptxcoebgpi
 
Digilent analog discovery trm rev b_1
Digilent analog discovery trm rev b_1Digilent analog discovery trm rev b_1
Digilent analog discovery trm rev b_1Diego Torres
 

Semelhante a Ece4760 hw5 (20)

Non-Invasive point of care ECG signal detection and analytics for cardiac dis...
Non-Invasive point of care ECG signal detection and analytics for cardiac dis...Non-Invasive point of care ECG signal detection and analytics for cardiac dis...
Non-Invasive point of care ECG signal detection and analytics for cardiac dis...
 
Design of single channel portable eeg
Design of single channel portable eegDesign of single channel portable eeg
Design of single channel portable eeg
 
Brain computer interface
Brain computer interfaceBrain computer interface
Brain computer interface
 
Senior Project Students' Presentation on ECG Monitoring
Senior Project Students' Presentation on ECG MonitoringSenior Project Students' Presentation on ECG Monitoring
Senior Project Students' Presentation on ECG Monitoring
 
FYP-2
FYP-2FYP-2
FYP-2
 
189626882 ep227-digital-electronics
189626882 ep227-digital-electronics189626882 ep227-digital-electronics
189626882 ep227-digital-electronics
 
ELECTRONIC CIRCUIT BREAKER
ELECTRONIC CIRCUIT BREAKERELECTRONIC CIRCUIT BREAKER
ELECTRONIC CIRCUIT BREAKER
 
LAB MANUAL
LAB MANUALLAB MANUAL
LAB MANUAL
 
Sanath
SanathSanath
Sanath
 
The research of_portable_ecg_monitoring_system_with_usb_host_interface
The research of_portable_ecg_monitoring_system_with_usb_host_interfaceThe research of_portable_ecg_monitoring_system_with_usb_host_interface
The research of_portable_ecg_monitoring_system_with_usb_host_interface
 
An ECG-on-Chip for Wearable Cardiac Monitoring Devices
An ECG-on-Chip for Wearable Cardiac Monitoring Devices An ECG-on-Chip for Wearable Cardiac Monitoring Devices
An ECG-on-Chip for Wearable Cardiac Monitoring Devices
 
101 200 transistorcircuits
101 200 transistorcircuits101 200 transistorcircuits
101 200 transistorcircuits
 
62 ijtet14003 pdf-libre
62 ijtet14003 pdf-libre62 ijtet14003 pdf-libre
62 ijtet14003 pdf-libre
 
under grund fault ppt (1).pptx
under grund fault ppt (1).pptxunder grund fault ppt (1).pptx
under grund fault ppt (1).pptx
 
Brain Computer Interface
Brain Computer InterfaceBrain Computer Interface
Brain Computer Interface
 
Scaling Down Instrumentation Deploying Analog Mixed Signal Technology
Scaling Down Instrumentation Deploying Analog Mixed Signal TechnologyScaling Down Instrumentation Deploying Analog Mixed Signal Technology
Scaling Down Instrumentation Deploying Analog Mixed Signal Technology
 
Project on orientation programme
Project on orientation programmeProject on orientation programme
Project on orientation programme
 
Elektor 0304-2020
Elektor 0304-2020Elektor 0304-2020
Elektor 0304-2020
 
Aryaa_Jaipur.pptx
Aryaa_Jaipur.pptxAryaa_Jaipur.pptx
Aryaa_Jaipur.pptx
 
Digilent analog discovery trm rev b_1
Digilent analog discovery trm rev b_1Digilent analog discovery trm rev b_1
Digilent analog discovery trm rev b_1
 

Mais de Chuck Moyes

Gameplay specificationfinal
Gameplay specificationfinalGameplay specificationfinal
Gameplay specificationfinalChuck Moyes
 
Final presentation
Final presentationFinal presentation
Final presentationChuck Moyes
 
Concept documentfinal
Concept documentfinalConcept documentfinal
Concept documentfinalChuck Moyes
 
Beta releasereport
Beta releasereportBeta releasereport
Beta releasereportChuck Moyes
 
Beta presentation
Beta presentationBeta presentation
Beta presentationChuck Moyes
 
Alpha releasepresentation
Alpha releasepresentationAlpha releasepresentation
Alpha releasepresentationChuck Moyes
 
Manual small (1)
Manual small (1)Manual small (1)
Manual small (1)Chuck Moyes
 
CS 2110 Programming Competition Entry Readme
CS 2110 Programming Competition Entry ReadmeCS 2110 Programming Competition Entry Readme
CS 2110 Programming Competition Entry ReadmeChuck Moyes
 
Ece3140 lab5 writeup
Ece3140 lab5 writeupEce3140 lab5 writeup
Ece3140 lab5 writeupChuck Moyes
 
Ece lab5 proposal
Ece lab5 proposalEce lab5 proposal
Ece lab5 proposalChuck Moyes
 
Cs 4621 presentation slides
Cs 4621 presentation slidesCs 4621 presentation slides
Cs 4621 presentation slidesChuck Moyes
 
Presentation slides
Presentation slidesPresentation slides
Presentation slidesChuck Moyes
 
Car sim rendering
Car sim renderingCar sim rendering
Car sim renderingChuck Moyes
 

Mais de Chuck Moyes (18)

Gameplay specificationfinal
Gameplay specificationfinalGameplay specificationfinal
Gameplay specificationfinal
 
Final presentation
Final presentationFinal presentation
Final presentation
 
Concept documentfinal
Concept documentfinalConcept documentfinal
Concept documentfinal
 
Beta releasereport
Beta releasereportBeta releasereport
Beta releasereport
 
Beta presentation
Beta presentationBeta presentation
Beta presentation
 
Alpha releasepresentation
Alpha releasepresentationAlpha releasepresentation
Alpha releasepresentation
 
Manual small (1)
Manual small (1)Manual small (1)
Manual small (1)
 
CS 2110 Programming Competition Entry Readme
CS 2110 Programming Competition Entry ReadmeCS 2110 Programming Competition Entry Readme
CS 2110 Programming Competition Entry Readme
 
Ece4760 hw4
Ece4760 hw4Ece4760 hw4
Ece4760 hw4
 
Ece3140 lab5 writeup
Ece3140 lab5 writeupEce3140 lab5 writeup
Ece3140 lab5 writeup
 
Ece lab5 proposal
Ece lab5 proposalEce lab5 proposal
Ece lab5 proposal
 
Fb graph
Fb graphFb graph
Fb graph
 
Cs 4621 presentation slides
Cs 4621 presentation slidesCs 4621 presentation slides
Cs 4621 presentation slides
 
Ai plan
Ai planAi plan
Ai plan
 
Final report
Final reportFinal report
Final report
 
Presentation slides
Presentation slidesPresentation slides
Presentation slides
 
Car sim rendering
Car sim renderingCar sim rendering
Car sim rendering
 
Cs665 writeup
Cs665 writeupCs665 writeup
Cs665 writeup
 

Ece4760 hw5

  • 1. Charles Moyes (cwm55) and Mengxiang Jiang (mj294) Cornell University ECE 4760 Final Project: Brain-Computer Interface using Multi-Channel Electroencephalography Project Overview The goal of the project is to build a multi-channel electroencephalography (EEG) Brain-Computer Inter- face (BCI). At a high level, the project will record and collect EEG data from the user using electrodes attached to the patient’s scalp. The data will then be processed by a machine learning algorithm such as a feed-forward artificial neural network (ANN) which will attempt to classify the data. We plan on either trying to discover which color the user is thinking of or allowing the user to control a mouse pointer using their thoughts. Because of the nature of the machine learning algorithms we will be using, an initial training period will be required where the user is prompted to “think of” or “imagine” colors and mouse movement directions. The EEG data corresponding to the user’s thoughts will then be used to train the neural network via the back-propagation method. From there, the user will be able to control the system using their mind: Because we feel that this project is fairly ambitious, there will be several “checkpoints” or stopping points, in case we run out of time or encounter difficulties. The first goal will be to collect EEG data from the user using the microcontroller’s analog-to-digital (ADC) converter. The analog circuitry involved will consist of a three-stage amplification circuit with an instrumentation amplifier, an operation amplifier, and a filter. The filter will consist of a high-pass filter with a cut-off frequency very close to zero to remove DC offsets from the signal, along with a low-pass filter with a cut-off frequency of around 60 Hz for anti-aliasing and possibly a 60 Hz notch filter to remove AC power noise induced in the user’s body. We ordered low-cost EEG electrodes from a Chinese medical supply company on eBay for around $20, but we may resort to home-made electrodes constructed from metal guitar picks borrowed from a friend who is a musician and an old baseball cap if the budget does not permit us to use the medical-grade electrodes. Another note is that a so-called “right-leg driver” connected to the user’s right leg will be necessary to cancel out common-mode noise from the user’s body. This driver will be connected to the instrumentation amplifier to take advantage of its common-mode rejection functionality. The main challenge will be amplifying a signal from the user’s scalp on the order of microvolts, while filtering out the vast sources of noise. This data could then be presented on a graphical pixel LCD attached to the microcontroller, or it could be transmitted to a computer over USB serial UART. However, for now we will be content with merely collecting the EEG data from the user and sending it to MATLAB over UART. This will require some C code to be written for the microcontroller that will read the ADC input, format the data in Modular EEG packet format, and send it to the PC over the serial port. Once we have a working EEG (this is one “check- point”), we would like to add as many channels (up to 16, ideally) as our budget permits. We have found 1
  • 2. an instrumentation amplifier and Besselworth filter IC from Maxim IC and cheap op amps that we will use for this project. A possible time-permitting feature is the addition of a Bluetooth system-on-chip wireless transceiver (TI has one that we could sample). This would allow the user to control their smartphone or Bluetooth-enabled laptop using the BCI, but it would also impact our budget significantly. The next checkpoint would be processing the collected data. We have had significant coursework in artificial intelligence (AI) and have been studying papers on diagnosing sleep apnea and processing EEG data in the context of brain-computer interfaces throughout the semester. We cannot guarantee good results with the latter since we have not done anything like it before, so if we are unable to obtain good results, then we will merely determine the patient’s level of emotional arousal based on the EEG waveforms using their frequency spectra. An example follows: However, we would definitely like to take time to experiment, namely with ANN’s so that we can attempt to classify the user’s thoughts based on their brainwaves. Another simpler possibility would be detecting EEG arousals in users that have sleep apnea. This is fairly simple to do given that one has a real-time EEG data source, and the details have been outlined in several IEEE papers. The goal would be to have a user think of a color (e.g. red, blue, or green) and then have the ANN classify which color the user is thinking of from the received EEG data. Yet another possibility is having them thinking of cardinal movement directions and then using the EEG data to move the mouse pointer. We feel that this is significantly more advanced, however, than the color-detection process. At this point, we would be very satisfied with our project and we would be more than happy to call it complete. Relevant Standards We will follow the Modular EEG serial packet standard for transmitting EEG data over UART. Moreover, serial communications will follow the RS232/USB standards. Another consideration is the IEC601 standard. IEC601 is a medical safety standard for medical devices that ensures that they are safe for patient use. Unfortunately, testing for IEC601 compliance is very much out-of-budget. Nevertheless, we discuss the many safety considerations that we will absolutely adhere by in the Societal Impact of Project section of this write-up. If we opt to use Bluetooth as a wireless communication interface for this project, we will use the Texas Instruments CC2560 single-chip Bluetooth IC, which complies with FCC standards. 2
  • 3. Tentative Parts List A tentative parts list follows: For Each Analog EEG Channel: Part Cost MAX4194 - instrumentation amplifier IC SAMPLE MAX7401 - 8th order Bessel filter IC SAMPLE AD8605 - op amp IC SAMPLE TL062CP - op amp IC 2*$0.26/channel (Digikey) Filter capacitors and resistors LAB/CHEAP 2K Potentiometer LAB/CHEAP 4x NPN and PNP transistors LAB/CHEAP EEG electrodes: Part Cost CONTEC ten pcs silver plated electrodes (budget-permitting) $20 (eBay) OR OR Metal Guitar Picks and Headband ALREADY OWN RS232 isolation: Part Cost 6N137 optoisolator (or equivalent) 2*$1.55 (1 if only using TX) (Digikey) 2x NPN transistors LAB/CHEAP Unavoidable Lab Costs Incurred: Part Cost White Board OR Solder Board (Time-Permitting) $6 OR $2.50 4x AA Batteries ALREADY OWN 4 AA Battery Holder $1.33 (Digikey) Mega644 Microcontroller $8 SIP Header Sockets/DIP sockets To Be Determined (TBD) AT Mega 644 Target Board LAB Extra features: Part Cost Graphical LCD (budget-permitting) $15 (SparkFun) CC2560 - TI Single-Chip Bluetooth SAMPLE (time-permitting) Societal Impact of Project/Safety Features Because this is a device attached to a patient’s brain, safety is our utmost priority. The microcontroller will only be powered by four 1.5V AA batteries, rather than through an AC power supply connected to mains. Moreover, serial communication to a PC over USB will be isolated from the USB using optocouplers, which we will test extensively to ensure that both ground loops are separated. Only laptops running off of battery power supplies (no AC adapters connected) will ever be connected to the microcontroller over USB. As a corollary, the microcontroller will never be connected to a user’s head while the programmer cable is connected to a PC. Lastly, the EEG circuitry itself will have transistors connected directly to the electrodes (in between the electrodes and the analog circuitry) to act as a user current/ESD protection mechanism. We promise that 120 VAC power will never be connected to this project directly or indirectly. As a result, 3
  • 4. users will never be allowed to touch any other electrical devices while wearing the EEG helmet. We will take safety very seriously throughout the development of the project. This project will have great societal impact because it is designed for users with special needs. Using brain-computer interfaces, users with special needs will be able to interact in computers in ways that were not previously possible. Patients with sleep apnea will be able to collect and analyze their own EEG data while asleep without having to participate in expensive overnight sleep studies at hospitals. They will be able to see their data; rather than being shielded from it by a medical doctor. Because our budget is less than $75, they will be able to do this at a very low cost. We are strongly considering releasing our schematics and source code on the Internet free-of-charge under the Creative Commons license in order to give back to society. Project Block Diagram An overall block diagram of the project follows: EEG High-Pass High-Pass Electrodes Filter Filter ADC ESD Discharge Instrumentation Operational Besselworth AT Mega 644 Protection Amplifier Amplifier Filter Microcontroller Circuit User’s Head UART EEG Electrodes Right-Leg Driver ELECTRICALLY ISOLATED LINE: Real-Time FFT On-Screen with Battery-Powered FTDI Classification Artificial Neural Laptop PC USB RS232 Output to User Network in MATLAB Tentative Schematics NOTE: These tentative schematics are highly subject to change throughout the development of our project! Analog Amplification Circuit 4
  • 5. Opto-isolated UART Serial As mandated by our safety procedures, we will electrically isolate the UART from the USB. The isolated UART will use high-bandwidth 6N137 opto-couplers from Fairchild Semiconductor as follows: It will interface with the UART Pin D.0 and Pin D.1 from the microcontroller. Note that we may have to add NPN transistors to invert the output as specified in the 6N137 datasheet if we cannot figure out a way to invert the UART output in software. The TX and RX lines will then connect to the FT232RL FTDI chip, which will be connected to USB GND and USB 5V for power. Unlike Open EEG’s Modular EEG project, we opted to use 6N137 optoisolators with USB rather than 6N139’s with RS232 using a MAX232 IC. Code Overview Sample code for reading the ADC values and transmitting them to MATLAB over the UART follows. This code will be extended to support multiple ADC channels and output to a graphical LCD. Note that the following code listing has not been tested yet and so we cannot guarantee code correctness: 1 # include < avr / io .h > # include < avr / interrupt .h > 3 # include < avr / pgmspace .h > # include < avr / eeprom .h > 5 # include < stdio .h > # include < stdlib .h > 7 # include < string .h > # include " lcd_lib . h " 9 # include < util / delay .h > 11 // UART file descriptor // putchar and getchar are in uart . c 13 FILE uart_str = F D E V _ S E T U P _ S T R E A M ( uart_putchar , uart_getchar , _FDE V_SETUP_ RW ) ; 15 // ADC variables volatile int Ain , AinLow ; 17 # define ADC_BITS 10 19 // ADC ISR ISR ( ADC_vect ) 5
  • 6. 21 { AinLow = ( int ) ADCL ; 23 Ain = ( int ) ADCH *256; Ain = Ain + AinLow ; 25 fprintf ( stdout , " % d n r " , Ain ) ; 27 ADCSRA |= (1 < < ADSC ) ; // start another ADC conversion 29 } 31 void main () { 33 // init the A to D converter // channel zero / left adj / EXTERNAL Aref 35 // !!! DO NOT CONNECT Aref jumper !!!! // Need capacitor at AREF pin and AVCC set to VCC 37 ADMUX = (1 << REFS0 ) ; 39 // enable ADC and set prescaler to 1/128*16 MHz =125 ,000 // and clear interupt enable 41 // and start a conversion ADCSRA = (1 < < ADEN ) | (1 < < ADIE ) + 7; 43 // sleep register 45 SMCR = (1 << SM0 ) ; // ADC sleep 47 // init the UART -- uart_init () is in uart . c uart_init () ; 49 stdout = stdin = stderr = & uart_str ; fprintf ( stdout , " Starting ADC demo ... n r " ) ; 51 sei () ; // start interrupts 53 // main loop 55 while (1) { 57 sleep_cpu () ; } 59 } Listing 1: C Source Code Listing References [1] Openeeg project. http://http://openeeg.sourceforge.net/, 2009. [2] Homebrew do-it-yourself eeg, ekg, and emg. http://sites.google.com/site/chipstein/home-page, 2011. [3] F Lotte. A review of classication algorithms for eeg-based braincomputer interfaces. Journal of Neural Engineering, 2007. [4] G. Matsuoka, T. Sugi, F. Kawana, and M. Nakamura. Automatic detection of apnea and eeg arousals for sleep apnea syndrome. In ICCAS-SICE, 2009, pages 4651 –4654, aug. 2009. [5] Hazrati MKh and Efranian A. An online eeg-based brain-computer interface for controlling hand grasp using an adaptive probabilistic neural network. PubMed, 2010. [6] Jorge Baztarrica Ochoa. EEG Signal Classification for Brain Computer Interface Applications. PhD thesis, Ecole Polytechnique Federale de Lausanne, 2002. [7] Olson. Eeg page. http://www.pkfamily.com/users/solson/eeg/eeg.html, 2007. [8] Kouhyar Tavakolian, Faratash Vasefi, Kaveh Naziripour, and Siamak Rezaei. Mental task classifica- tion for brain computer interface applications. In First Canadian Student Conference on Biomedical Programming. 6