Sei sulla pagina 1di 66

Brain Computer Interface

Mohamed
Sami Mohamed
Omar

Mai
Mohamed Project Team

Nada
Mohamed
Ahmed
Mamdoh

http://bci2.k-space.org
Brain Computer Interface
BCI

Supervisors
Prof.Dr Abu Bakr M. Youssef
http://bci2.k-space.org
Assistant Prof.Dr Yasser M.Kadah
Motivation for BCI Research
There are , more than 200,000
patients live with the motor sequelae
of serious injury.

Locked-in Syndrome
Neurological diseases may lead to
paralysis of the entire motor system .
Unable to use their muscles and
therefore cannot communicate their
needs, wishes, and emotions.

http://bci2.k-space.org
Reason of BCI
• Allow a user to communicate with a
computer through his Brain

• The user can think and the computer


recognizes what he thought about.

• This is what we call a Brain-Computer


Interface (BCI) [or Brain-Machine Interface
(BMI)].

http://bci2.k-space.org
The Dream

•People always think about controlling environments


from their mind

•Anyone wish if he could read the people thoughts and


know what they are thinking of him

•Some people want to store their dreams and record it


while they sleeping

http://bci2.k-space.org
Dream vs. Reality
• Dream BCI
– Think to whatever you want
– Without recognition errors
– Whenever you want
• Physiological problems
– No thought sensor
– Partial brain knowledge
– Noisy signals
• Solutions in the BCI community
(reality)
– Limited thought
– Limited recognition accuracy
http://bci2.k-space.org
BCI community
About 60 research groups
About 300 researchers
Increasing published papers
140
127
120
100
80
60 SCI paper
48
40
20
2 4
0
1985-1990 1991-1995 1996-2000 2001-2004
http://bci2.k-space.org
Our Goals

1.
1. Recording
Recording Brain
Brain Signal
Signal Using
Using EEG
EEG electrodes.
electrodes.

2.
2. Isolation
Isolation between
between subject
subject and
and electronic
electronic circuit
circuit

3.
3. Designing
Designing Data
Data Acquisition
Acquisition System
System

4.
4. Signal
Signal Selection
Selection

5.
5. Interfacing
Interfacing with
with Computer
Computer by
by Soundcard
Soundcard

6.
6. Implementing
Implementing real
real time
time analysis
analysis Classification
Classification data
data
BCI Categories

• Invasive and Non-Invasive BCIs

• Online and Offline BCIs

• Imaginary and Mental Tasks

http://bci2.k-space.org
General scheme
3. Online Feedback

High level
commands
Feedback
Control
Application
interface

Mental
state
Electrical activity
Bio- Pre- Feature Classification
sensor processing extraction

The brain
On the computer
1. Data Acquisition 2. BCI System

http://bci2.k-space.org
Medical Introduction
Nervous System

Motor Brain

CNS
CNS

Spinal
Cord
Nervous
Nervous System
System

Cranial
Nerves
PNS
PNS

Sensory
Spinal
Nerves

http://bci2.k-space.org
Human Brain

http://bci2.k-space.org
EEG
Electroencephalography or EEG is the
measurement of neural activity within the
brain.

EEG has been used to detect low oxygen


and high carbon dioxide levels.

A clinical use of EEG is in the diagnosis of


epilepsy.

http://bci2.k-space.org
EEG Signal

http://bci2.k-space.org
EEG Wave Band

Alpha Beta Delta Theta

Frequency 8-13 Hz 13-30 Hz 0.5-4 Hz 4-8 Hz

parietal and
Occupation occipital frontal lobes. ______

Condition awake person _____ Sleeping _____

infants children and


Age ______ ______ sleeping
&adults adults
EEG Lead System

http://bci2.k-space.org
Data Acquisition

http://bci2.k-space.org
Overview

Electrode Pre Amplifier


Isolation

Electrode
Isolation Pre Amplifier

Electrode
Isolation Pre Amplifier
Gain Matlab
MUX Amplifier LPF Sound Card Workspace
Electrode
Isolation Pre Amplifier

Latch
Electrode Pre Amplifier
Isolation

Parallel Port
Electrode
Isolation Pre Amplifier

http://bci2.k-space.org
Biopotential Sensors

 Electrodes are Biopotential sensor.

 There are different types of electrodes:

1. Gold electrode.
2. Silver electrode.

http://bci2.k-space.org
Isolation
 Medical procedures usually expose the patient to more
hazard than at home or workplace.

 Our main goal is to break ground loop .

 We decide to do that by low cast and effective way by using:


1.Isolation transformer as power isolation.
2.Opto-Couplers as signal isolation.

http://bci2.k-space.org
Continue

Isolation
 In our design we used the PC817 due to:
 Its low turn-on and off time and high.
 Isolation voltage between input.

http://bci2.k-space.org
Instrumentation Amplifier
 Amplifying differential input

 There are two stage of signal amplification:


1.Pre-Amplification
2.Gain-Amplification

 We used AD620 according to many better features on it:

• Lower cost
• High accuracy
• Low noise
• High Gain Ability

http://bci2.k-space.org
AD620 Schematic

http://bci2.k-space.org
Signal Selection
Multiplexer:

Select data from two or more data sources into a single channel.

There are two types of multiplexers:


•Analog Multiplexer.
•Digital Multiplexer.

we used Analog Multiplexer and we choose M54HC4051 IC

 Some features of M54HC4051:


• Low power dissipation
• Fast switching
• High noise immunity
• Wide analog input voltage range

http://bci2.k-space.org
M54HC4051 Schematic

http://bci2.k-space.org
Latch
Change output state only in response to
data input

Transfer data from parallel port to MUX


and holding it using LE (latch enable).

In our design SN74LS373 As latch IC.

http://bci2.k-space.org
SN74LS373 Schematic

http://bci2.k-space.org
Signal Filtering
A low-pass filter is a Filter that passes low frequensy
Component well, reduces frequencies higher than the
cutoff frequency.

 It is sometimes called a high-cut filter, or treble cut


filter.

We use active 2nd order low pass filter we used UA741 IC.
LPF Schematic

http://bci2.k-space.org
Parallel Port
The Parallel Port is the most commonly used port for interfacing home made projects

•Hardware Properties

8 output pins accessed via the DATA Port


5 input pins (one inverted) accessed via the STATUS Port
4 output pins (three inverted) accessed via the CONTROL Port
The remaining 8 pins are grounded

•Why Parallel Port ?

Easy Implementation and Installation


Allow Full Software Control without-
need any Counters &
Clock to Switch between Channels
Ability of Communication with
Matlab

http://bci2.k-space.org
Sound Card
A sound card is a Computer PCI Card that can input and output Sound under control
of computer programs

General characteristics
1-Sound Chip
2- multi-channel Dacs & A/D 3-ROM or Flash memory

Color Function
Lime Analog line level output for the main stereo
green signal (front speakers or headphones).
Pink Analog Microphone input.
Light
Analog Line level input.
blue
http://bci2.k-space.org
Continue

Sound Card
Internal
Block
Why we choose Sound Card
• Fixed and Low Cost Acquisition Card
• Easy in Implementation and installation
• Ability to Convert from Analog to Digital with very high
accuracy and vise versa
• Easy Communication with Matlab
• Ability to detect low Frequencies
• Sampling Data in wide rang (8000 to 44100)
• Better than designing new Interfacing System and this
System in Situation to not work because of hardware
troubleshooting

http://bci2.k-space.org
Acquiring Data with a Sound Card

http://bci2.k-space.org
Data Acquisition Programs

1st 2nd 3rd 4th


Release Release Release Release

Online Each
Drawing
Signal Channel Online
With
with Online Classifier
Selection
Filtering Plotting

http://bci2.k-space.org
1st Release

http://bci2.k-space.org
2nd Release

http://bci2.k-space.org
3rd Release

http://bci2.k-space.org
4th Release

imagination of right hand


movement

imagination of left hand


movement

http://bci2.k-space.org
Analytic methods

The process of EEG signal analysis and classification


consists of the Following three steps:

Signal
Signal Feature
Feature Statistical
Statistical
preprocessing
preprocessing extraction
extraction classification
classification

http://bci2.k-space.org
Signal Preprocessing
Noisy signal • Power line 50/60
? • Eye movements Hz
• Other movements • Electrode contact
Background
Experiment brain activity Physiologic Environmental
protocol noise noise

Mental Measured
task signal

Eye blink Power line

Subject Heart rate Electrode contact


Start

Offline Online
Type of work

Work on exist dataset Record our dataset Record EEG signal

Read dataset Feature extraction feature extraction

Feature extraction Make hypothesis test classification

hypothesis test Classification Decision

F
Feature available Visual O/P
Test next feature
T
Classification
Red Green

Test classifier

http://bci2.k-space.org
Offline Dataset
BCI
BCI Competition
Competition 2003
2003 Data
Data Set
Set Ia:
Ia: ‹self-regulation
‹self-regulation of
of SCPs›
SCPs› provided
provided by
by University
University of
of
Tuebingen,Germany,
Tuebingen,Germany, Dept.
Dept. of
of Computer
Computer Engineering
Engineering (Prof.
(Prof. Rosenstiel)
Rosenstiel)
Datasets were taken from a healthy subject he was asked to move a
cursor up and down on a computer screen.

Data
6 EEG electrodes are used referenced to the vertex electrode Cz
•Channel 1: A1-Cz (A1 = left mastoid)
•Channel 2: A2-Cz (right mastoid)
•Channel 3: 2 cm frontal of C3
•Channel 4: 2 cm parietal of C3
•Channel 5: 2 cm frontal of C4
•Channel 6: 2 cm parietal of C4
Sampling rate of 256 Hz.

Trial structure overview


consisted of three phases
1-s rest phase,1.5-s cue presentation phase and 3.5-s feedback phase.

http://bci2.k-space.org
Continue

Offline Dataset
During every trial, the task was visually presented by a highlighted
goal at the top or bottom of the screen to indicate negativity or
positively from second 0.5 until the end of the trial. The visual
feedback was presented from second 2 to second 5.5. Only this 3.5
second interval of every trial is provided for training and testing.

Trails separated into


training set (268 trials) which is 2-D Matrices 135x5377 and
133x5377
testing set The test set (293 trials).

Every line of a matrix contains the data of one trial. The first column codes the
class of the trial (0/1).

•Note
For our implementation we constructed the test set from the train
set. That was done by selecting 100 trails from class 0 and 100 trails
from class 1.

http://bci2.k-space.org
Offline Dataset
Continue

Approach
We used MATLAB (release 13) for analysis.
We separated the channels of each class to be 135x896
matrix for channels in class 0 and 133x896 matrix for class 1
channels.
For each EEG channel, we plotted the time-domain and
frequency-domain averages across trials for each class.

Note
In our online BCI approach, we constructed our own
dataset which consist of training set & testing set.
The training set was used to tune the parameters of the
classification algorithm.
We also applied all the pre-processing techniques as in the
offline work.

http://bci2.k-space.org
Feature Extraction

Steps of feature extraction


Choosing feature
Features Vector Form

http://bci2.k-space.org
Choosing Features
Time Domain Features

mean

Variance

http://bci2.k-space.org
Continue

Frequency domain features


Short-Time Fourier Transform
–First we transform all signals to frequency domain by
(FFT).
–Then we get mean & variance in frequency domain .
–calculate the amplitudes at 20 Hz.

Welch method
Estimate the power spectral density (PSD) of a signal using
Welch is done using Pwelch Matlab function
Form features vector
Channel 1 feature vector

Signal 1 Std1
Std2
Signal2
Std3
Signal3 Class 0 Std4
Class 0
Signal4 :
: :
: :
: :
: :
: :
Class 1 Class 1 :
:
:
: :

http://bci2.k-space.org
Continue

Form Features Vector


Ch1 Feature Vector

mean1 Var1

Class 0
mean2 Var2

mean3 Var3

mean4 Var4

. .
Class 1
. .

http://bci2.k-space.org
Multi dimension feature vector

Channel 1

Channel 6

Channel 2

Channel 5

http://bci2.k-space.org
Hypothesis Test
Perform Hypothesis testing for the
difference in means of two samples.

[H, P, Ci]=ttest2(X,Y)
H=0 no significance
H=1 significance

http://bci2.k-space.org
Signal Classification Techniques

Classifier

Minimum
Bayes K-NN
Distance

http://bci2.k-space.org
Classifier input

Train feature vector Test feature vector

Class 0 Class 0

Class 1 Class 1
Minimum Distance Classifier
Algorithm
1. Group the design set into (n) class
2. Estimate the sample mean for each class.
3. A test sample is classified by assigning it to the class
which has the nearest mean vector.
4. Error rate is estimated by the percentage of misclassified
samples

http://bci2.k-space.org
Bayes Classifier
Algorithm
 Compute Gaussian distribution of each class (p.d.f)
 Compute probabilities of sample (a)
F( a Є f0) & F( a Є f1)
K-Nearest Neighbor (KNN)
Algorithm
1. Obtain distances between
test sample and all
samples in the design set
2. Sort obtained distance
values in ascending
ordered array.
3. Assigns the test sample to
the majority class in the
subset.
4. Error rate is estimated by
the percentage of
misclassified samples
Results

Dataset Ia results

Our dataset results

http://bci2.k-space.org
Dataset Ia Best results
FFT feature (amplitude of 20 HZ)

KNN k=3 Accuracy Error


channel 3 80% 20%

Pwelch feature

KNN k=5 Accuracy Error


channel 4 78% 22%

http://bci2.k-space.org
Our Dataset Best Results
FFT feature (amplitude of 20 HZ)

KNN k=3 Accuracy Error


channel 3 54% 46%

Pwelch feature

KNN k=5 Accuracy Error


channel 4 58% 42%

http://bci2.k-space.org
BCI challenge

Information transfer rate.


High error rate.
Autonomy.
Cognitive load.

http://bci2.k-space.org
Conclusion & Future
• In our project we built a simple BCI ,which
separated between left and right hand movement
• System worked on online & offline data set
• Online data pass through different stages:
Filtration
Amplification
Interfacing with computer using soundcard
Analysis and classify

http://bci2.k-space.org
Conclusion & Future
Completely paralyzed patients can use a BCI to realize a
spelling system (virtual keyboard) to install a new non
muscular communication channel.

•In the future:


It will be used by total normal people to perform
simple activities
 Spread commercially in the field of video games
In military

http://bci2.k-space.org
Online Demo
Thank You

Potrebbero piacerti anche