Lab 8 EEG Berkely

Download as pdf or txt
Download as pdf or txt
You are on page 1of 20

Final Project: EEG EE100/EE43 Spring 2013

YOUR NAME: YOUR SID:

YOUR PARTNERS NAME: YOUR PARTNERS SID:

LAB SECTION :

Score: Simulation/Design ___/100


Final Circuit ___/100

Electroencephalograph (EEG)
Final Project Part 1: Design and Simulation

ELECTRICAL ENGINEERING 43/100

INTRODUCTION TO MICROELECTRONIC CIRCUITS

University Of California, Berkeley

Department of Electrical Engineering and Computer Sciences

Professor Michel Maharbiz, Professor Vivek Subramanian

Lab Contents:

I. Final Project Overview and Objectives


II. Project Parameters
a. Design Specifications
b. Part Specifications
c. Performance Specifications
d. Due Dates for this Project
III. Design Phase
a. The Electrode
b. Instrumentation Amplifier Stage
c. DC Block
d. The Non-Inverting Active Low Pass Filter
e. The Notch Filter
f. Powering Your Circuit
g. Output Signal and Testing
h. What you need to do
i. Tips on Simulation and Testing
IV. Building Phase
a. Testing Tips
b. The Final Circuit

1

Final Project: EEG EE100/EE43 Spring 2013

Final Project Overview and Objectives

For your final project, we will be building an electroencephalogram (EEG) on the breadboard. We will be working
st nd
on designing (1 week) and building (2 ) EEG circuit for the rest of the semester.

In this project we will design, simulate, and build EEG circuits. Since this is your final project, obviously we will be
using a significant portion of what you learned in previous labs about various circuit components and analysis
techniques. Therefore, if youre a little rusty on some of the things we did in previous labs; it would be a good idea
to brush up on what you do not feel comfortable with because you essentially built most of the modules already in
previous labs.

As with all other labs, we will start with design considerations and parameters, and simulate our circuit in
Multisim. After the design process, we will construct our design in on the breadboard! In the real world, engineers
usually transfer their designs to Printed Circuit Board (PCB), like the one you soldered at the first lab, after testing
and deliver the products. However, we will not be designing a PCB for this project.

This may seem a little overwhelming at first, but relax; we will try to make this as painless as possible.

Project Parameters

Lets consider our project specifications. Below are the project specifications that your design for your EEG must
meet along with any metrics of evaluation. Each module of the project is covered in detail in the next section.

Design Specifications

- You must use an instrumentation amplifier built from discrete components with appropriate gain
- The instrumentation amplifier must have adjustable gain
- Any other amplifier stage must also have adjustable gain
- You must use a +/- 5 V regulators to obtain +/- 5 V from the 9 V batteries.
- You must have coupling and decoupling capacitors in appropriate parts of your circuit
- You must have voltage followers where necessary

Part Specifications

The following parts are available for your design. You will be provided a kit with these parts at the beginning of the
prototyping phase provided that you have a schematic ready to build. You will not receive the kit if you do not
complete the schematic beforehand. Kits will be distributed one per group. Since, we have already given you
breadboard in the previous lab, the kit will not contain breadboard. It is your responsibility to figure out how these
components work and look at the datasheets.

- 4 x TLC277CP Dual Operational Amplifier


- 1 x LM7805 +5V Regulator, 1x LM7905 -5 V regulator
- 1 x 10 potentiometer (for instrumentation amplifier gain control)
- 4 x 50k 1% tolerance resistors (for instrumentation amplifier input stage and gain stage)
- 2 x 500k 1% tolerance resistors (for instrumentation amplifier input stage and gain stage)
- 1 x 1M resistor (for filtering)
- 1 x 100k resistor (for filtering)

2

Final Project: EEG EE100/EE43 Spring 2013

- 1 x 5 potentiometer (for gain control in active low pass filter)


- 2 x 10 ohm resistors (for notch filter)
- 2 x 20 resistor (for notch filter)
- 2 x 247 resistor (for notch filter)
- 1 x 1 uF capacitor (for filtering)
- 1 x 0.01 uF capacitor (for filtering)
- 2 x 0.22 uF capacitors (for filtering)
- 2 x 10 uF capacitors (for filtering)
- Header pins for test pad connections
- 4 x 8 pin DIP sockets for each of your 8 pin chips
- Any other components you would like to add

Performance Specifications

- All excess high frequency noise must be adequately attenuated


- You should have a spike at 10 on the frequency spectrum and a strong DC component
- You will NOT under any circumstances test this device on yourself (were not going to supply you
electrodes anyway)
- The circuit should perform completely off two 9 batteries

Due Dates for this Project

- The deadlines for this project are as follows:


o Schematic Design and Simulation: Beginning of lab, the week of April 15th. (You must check
your design with a GSI)
o Final Breadboard, Demonstration, and Lab Write Up: Due Week of May 6.
- You should start on this project early, otherwise you may not finish the project on time.

Design Phase

Before we begin building EEG circuit, we want to design the circuit and do a design analysis. Our EEG will either
take a brainwave signal or a test signal. Because the signal is so weak ( 10 ), were going to have to amplify the
6

signal by several orders of magnitude in order to apply appropriate signal processing. Therefore, we will first send
our signal through an instrumentation amplifier. However, we might not be able to get adequate gain with just one
amplification stage. In addition, having several adjustable amplification stages will allow us to have higher

resolution in amplification.

At this point, our EEG should have amplified our signal enough to apply filters and various signal processing
techniques. As mentioned before, the main signal components of the brainwave signal that we want to capture is
around 10Hz. In addition, we also have to eliminate any signal noise that we may have picked up. Since noise is
usually a high frequency component, and we are looking for a low frequency component, we will apply a low pass
filter to extract the brainwave signal. We should then be able to take the output signal and display it on an
oscilloscope.

3

Final Project: EEG EE100/EE43 Spring 2013

The Electrode

We will be providing you the electrodes to test with after you finish the board. Every group will NOT receive an
electrode; we will have a set that we will use for testing and you will return these after testing. ABSOLUTELY at any
time, do not test the EEG on yourself.

Electrodes

To ensure that our unfortunate test subjects are protected from electrical shock, our electrodes will be equipped
with protection circuitry so that testing will be safe. For those of you who are interested, the schematic of the
protection circuit is given below. Basically what it will do is ensure that when we test your circuit on us, we dont
get zapped.

Luckily we have already built these electrodes for you and eliminated most of the issues associated with these
problems. Again, we will not be providing electrodes for you to take home since they are expensive and we dont
1
feel like dealing with the paperwork to make it legal.


1
An appropriate lawyer joke would go here

4

Final Project: EEG EE100/EE43 Spring 2013

The Instrumentation Amplifier Stage

6
Since the signal strength we are processing is on the order of 10 V, we have to apply an incredibly high gain in
order to bring it into a range that we can process the signal. Recall in lab 4, we used an instrumentation amplifier
which can be configured to have high gain.

is lab 4 is shown below:


The instrumentation amplifier that you encountered

In the space provided below, prove that the gain of the instrumentation amplifier is given by:

5

Final Project: EEG EE100/EE43 Spring 2013

" R %" R + R2 + R3 %
v 0 = $ 4 '$ 1 '(v 2 v1 )
# R5 &# R2 &

" R %" R + R2 + R3 % " R4 %" R1 + R2 + R3 %


v 0 = $ 4 '$ 1 '(v 2 v1 ) v v 0 = $ '$ '(v 2 v1 )
# R5 &# R2 & # R5 &# R2 &

In addition, choose reasonable values such that the instrumentation amplifier has a gain of ~1000 using a
10 potentiometer. (Since specific parts are given for this project, you should check the part list to see what

components you can use). Provide all relevant calculations that prove your values satisfy the specifications. Show
the Multisim simulations and measure the gain in the simulation. (Set V1 to ground, and V2 a ~10 Hz AC signal with
the voltage amplitude in the order of 10
6
~ 10 5 . The supply voltages of the op-amps are 5.)


Pre-Lab Score:__/15


DC Block

Following the first stage, we will need to put in a DC block to block DC signals. Remember, the signal that we are
processing is being amplified from a microvolt signal strength and the brain wave signal component that we want
to read is around 10. Thus, to clean things up a little bit, we can apply a high pass filter with a very low cutoff
frequency which can easily be done by a resistor and capacitor shown below.

6

Final Project: EEG EE100/EE43 Spring 2013

High Pass Filter DC Block

For our circuit we will be using the DC block with a cut off frequency of ~.16. For this we will be using a 1
1
capacitor and 1 resistor. Recall, the cutoff frequency in rad/s for this filter is c = .
RC

The Non-Inverting Active Low Pass Filter


So at this point, weve done quite a bit of amplification and signal fluffing, but havent really amplified the signal
enough nor filtered out all of its undesired components. As discussed earlier, the frequency that we want to see
from our EEG lies around the ~10 range so we have to extract that from our amplified signal. So lets stop
piddling around and do that.

First, were going to throw a low pass filter at our signal. For our application, were going to use a non-inverting
active low pass filter which is shown below:

Were going to draw a bode plot for the active low pass filter (it may be helpful when we analyze the next filter).In
the space provided below, show that the gain of the non-inverting active low pass filter and cutoff frequency is
given by the following:

7

Final Project: EEG EE100/EE43 Spring 2013

1
c =
R5C4

Z 2 is the impedance of C4 and R5 in parallel. Before you begin a mathematical derivation of the gain, think
infinity)? This should give you an idea of why the circuit is a low-pass filter. Plugging in values for different

angular frequencies and computing the change in gain will also help you understand the circuit more. Remember
that the cutoff frequency above is in rad/sec, not Hertz!

In addition, draw the Bode plot and label any relevant points in terms of the given variables. Finally, choose values
is 1000 rad/sec and the DC gain is 100. Show the MultiSim simulation to confirm your results. The supply voltage
of the op-amp is 5.


Pre-Lab Score:__/15

The Notch Filter

So the low pass filtering was nice, but it doesnt really give us exactly what we want. Remember that EEG signals
are on the order of ~ 10 which means that the amount of noise we have to deal with is fairly annoying. Our
6

active low pass filter did attenuate many of the higher frequencies but it is limited to a 20/ dropoff.

In order to fine tune our signal, we are going to apply a cascade of notch filters to eliminate some 60 noise.

The 60Hz noise is due to the electrical power lines. Once again, since our circuit is dealing with such low voltage
signal, we need to consider this electrical interference.

8

Final Project: EEG EE100/EE43 Spring 2013

For those of you who dont know what a notch filter is, dont panic. Basically a notch filter passes all frequencies
except for a narrow range and is called a notch filter because its frequency response looks like it has a notch in it.
The plot below is the theoretical plot of the magnitude response of our notch filter from Mathematica.

As you can see from the magnitude plot above, a notch filter is ideal for killing any particular undesired frequency
such as the 60 component we wish to eliminate. The same notch filter magnitude plot is shown below in
MultiSim.

Notice in MultiSim we have two magnitude plots. The reason is that one of the magnitude plots belongs to the
notch filter realization shown below.

Note we are using the impractical value of 26.5 H for our inductor! So, how did we get a practical circuit close to
our theoretical performance? The answer is the gyrator, a circuit that inverts impedances. Consider the circuit
shown below (from Wikipedia).

9

Final Project: EEG EE100/EE43 Spring 2013

i1

i2

First, prove below that the op-amp gyrator circuit above has

RL + jRL RC
Z in = RL + jRL RC
1+ jRL C

Here, since RL is small, we can ignore the term of jRL C in the denominator. Hint: you should recognize
negative feedback configuration for amplifier and apply test voltage source ( Vtest ) at the input and then find the
Vtest
total current drawing out from test source. Total impedance Z in can be found by .
i1 + i2
Pre-Lab Score:__/15



10

Final Project: EEG EE100/EE43 Spring 2013

In our usage of the gyrator for our notch filter, we will use the following variation:

Derive the transfer function of the circuit above. Use RL1 = 10 ohms, Cg1 = 10 uF and remember that the inductor
you are simulating is 26.5 H (~RL1RCg1). Choose R2 = 20k and f c =60Hz (notch frequency), this should help you
solve for C2 and thus you should be able to draw a magnitude Bode plot (no phase required). Show YOUR OWN
MultiSim simulation results to confirm your Bode. Make sure they agree with our previous STANDARD simulation
results from MultiSim. The supply voltage of op-amp is 5.

Pre-Lab Score:__/20

11

Final Project: EEG EE100/EE43 Spring 2013

Note that in our application, we are going to cascade two notch filters (were going to kill the 60 frequency
twice for good measure). The implementation for this portion of the circuit is shown below.

The Bode plot for the cascaded notch filter is shown in the following.

12

Final Project: EEG EE100/EE43 Spring 2013

Powering Your Circuit

To power your circuit, we will be using two 9V batteries to provide 5 power supplies to your circuit. In order to
do this, we will be using 5 regulators. The regulators in question are the LM7805 and LM7905 regulators. In the
space below, look at the datasheet for these components and draw the circuit diagrams showing how to connect
them. Clearly indicate where the 9V battery goes and where the 5 output is.

Pre-Lab Score:__/5

Output Signal and Testing

Once we have finally finished processing the signal in the lab, we are going to send it to an oscilloscope so that we
can actually see the EEG signal. To test your signal, you can either sweep frequency on DC analysis or put a bode
plotter in the Multisim. On the real circuit, you should use the function generator to generate different frequency
signal and look at the output on the oscilloscope to see if the gain matches with simulation value. Everyones signal
will look different but generally you will end up with a strong DC component and weaker spike around 10.

What you need to do

Your task is to complete the rest of the EEG design, put everything together, and simulate it in Multisim. We
recommend that you draw a rough draft on a spare sheet of paper so that you have a good idea of where you are
going when you start to place components in Multisim.

13

Final Project: EEG EE100/EE43 Spring 2013

Make sure to attach a copy of your working schematic and simulation results to the lab report. Show that your
simulation results meet the design specifications described above. It would be great if you simulate your circuit
by modules and show (submit) to the GSIs. This part of the lab is due the first lab session for the final project.



Your GSI Signs Here (30 points)

In addition, you will need to get your schematic checked off by your GSI in order to get your parts kit.

You will not have to consider the following when completing the design of your circuit since we have already
accounted for them in the modules presented above:

- Bypass Capacitors to prevent voltage sags and mediate the effect of abrupt current draw fluctuations
- Buffers to match input and output impedance between different modules
- Output Resistors to match output impedance

We also recommend that you build and test your circuit in modules. This will increase the chances that you will be
able to catch errors and debug your design.

Also use clean wiring in your schematic because it makes it easier for us and for you to trace your circuit. We will
refuse to help groups that do not wire their circuits cleanly. This is a fairly large circuit and if you dont wire things
neatly, you will be hopelessly confused and proceed to throwing fragile objects.

Tips on Simulation and Testing

- To test your circuit in the simulator you will have to generate an oscillating signal using an AC voltage
source or something equivalent. Make sure that this source is set to a microvolt level signal ranging from
around a few 100 . Unfortunately since our lab instruments wont be able to generate such low
voltage signal we will have to use something else when we actually build and test our circuit (well worry
about this later though).
- When you do put your circuit in the simulator, make sure that you build it modularly and that each part of
the circuit is clearly identified. This is to help you and to help us quickly debug your schematic should
there be any obvious problems. You may want to label each module on the circuit with a short
description.
- When you are simulating your entire EEG circuit, you may need to set the DC Convergence Limit to 2000
and Transient Convergence Limit to 1000 if you end up getting convergence errors.
- Make liberal use of the virtual multimeters, probes, scopes, and Bode Plot analyzers that Multisim
provides you. These are the primary ways you will be able to tell whether your simulation is actually
working or not. Make sure to probe key points in your circuit like between critical modules and check to
see if the outputs you are reading match with what you expect.

Since there are a lot of pieces to the prelab, included below is a list of everything you should include with your
prelab:

14

Final Project: EEG EE100/EE43 Spring 2013

1. Analysis and Multisim of Instrumentation Amplifier


2. Multisim simulation of DC Block (optional, but recommended)
3. Analysis and Multisim of Non-inverting Low Pass Filter (LPF)
4. Analaysis and Multisim simulation of Notch Filter
a. Magnitude bode plot of single gyrator
b. Magnitude bode plot of cascaded gyrators
5. Multisim simulation of power regulators (optional, but recommended)
6. Multisim simulation of entire circuit with designed building blocks
a. Include instrumentation amplifier, DC block, non-inverting LPF, cascaded notch filters, power
regulators

Note: Although the lab report doesnt require individual plots for the DC block and power regulators, its always a
good idea to test individual blocks before simulation them in the complete circuit.

15

Final Project: EEG EE100/EE43 Spring 2013

Building EEG

Now that you have your schematic ready to go, it is now time for you to actually build your circuit.

Some of you may be tempted to throw everything on the breadboard at once and test functionality at the end.
This is not a methodical approach to a project of this scale. If your circuit doesnt work, the error could be
anywhere in your circuit. Furthermore, you may have made multiple errors which could be anywhere in your
circuit. Hopefully, you have learned quite a lot of debugging skills from previous labs as GSIs will not be always
available to you.

Therefore, we recommend that you build your circuit in modules. This will enable you to test the functionality of
each module and minimize the time you spend looking for bugs before moving on.

The order in which you build the circuit is entirely up to you. The key part of the process is testing functionality and
debugging, since one mistake usually cripples the entire circuit.

In the following sections, we will provide you with some basic ways to test if your circuit module is working
properly.

Before you start building up your circuit, wed like to offer some basic tips:

- Set current limits on your power supplies. = means if you make a mistake and run too much current
through your operational amplifier, timer, hand, etc. you will destroy it. The current limit is a failsafe
mechanism that will limit the maximum current and eliminates the risk of breaking your components. ASK
YOUR GSI IF YOU DONT KNOW HOW TO SET IT.

- When you get stuck, dont disassemble your circuit until youve verified its a design problem. We know
sometimes its tempting to take apart your circuit and try again without taking a closer look at what might
be wrong. It might be something simple such as a loose wire or bad power supply. Make sure to check
these before deciding to take apart your circuit.

- Use clean wiring. This enables other people such as your GSI to help you debug your circuit. If your wiring
is a mess, its harder to trace your circuit and takes more time for us to help you out. Your wires should
also not be more than an inch or two above the board. We will refuse to help groups that do not use
clean wiring.

- The multimeter and oscilloscope are your friends. If your circuit is not working, the first thing you should
do is measure, measure, and measure, to find out where and what the problem is. Trace the entire signal
path starting from the source and try to identify where the error is starting.

Testing Tips

As mentioned before, you should be building you circuit in modules and effectively testing each module before you
continue your prototyping. Testing each module for functionality is critical as it will help you isolate bugs to a
smaller portion of your circuit and fix them. Below are a few tips on how to test each of your circuit modules in
isolation.

16

Final Project: EEG EE100/EE43 Spring 2013

Note, however, that when you finally go to test the entire circuit, you will want to use 9V batteries since bench
supplies have a strong 60 noise component. We recommend that once you get to that pont in the testing, that
you use the voltage regulators and batteries to produce the supplies.

The Instrumentation Amplifier Stage

- Recall from lab 4, we used the instrumentation amplifier to detect extremely small fluctuations in voltage
difference. Similarly, to test that your instrumentation amplifier has adequate gain, you will probably
want to supply it with some known input voltage from your power supply and probe the output to see if
you are in fact getting the desired gain. Be careful of saturation when making this measurement.

- The resistors supplied for the instrumentation amplifier have very small tolerances (1%). However, for
best results, try to find resistors that should be the same in this stage, try to get the resistances as close
together as possible. For example, if there are two 10k resistors in your stage, use the multimeter to
try and find two resistors as close to each other and 10k as possible.

- When you fire up your instrumentation amplifier, if things are getting hot, make sure that you connected

power supplies to your operational amplifiers correctly. If your resistors are getting hot, you probably
want to use a higher value resistor.

- Make sure to supply your circuit with 5 volts since that is what well be using in the actual circuit.

- If youre not getting a signal at all, you probably want to double check that everything is connected
correctly. If youre wiring is bad, fix it before pulling over a TA.

- Test your circuit and fill in the table below. (10 points) The gain ideally shouldnt change with frequency.

Frequency Peak-to-peak Peak-to-peak Gain/Attenuation Gain/Attenuation


value of input value of output Factor in dB

DC
1 Hz
3 Hz
10 Hz
30 Hz
100 Hz
300 Hz
1000 Hz

17

Final Project: EEG EE100/EE43 Spring 2013

The Active Low Pass Filter Stage

- We recommend using a function generator as your input to this module and testing the output with an
oscilloscope. This way you can sweep a range of frequencies on the function generator and see if your
filter kills and passes the correct ranges of frequencies.

- Use the peak-to-peak measurement option on the oscilloscope to make sure you are obtaining the correct
amplification or attenuation at the correct frequencies.

- Make sure you send in the test signal at the correct node in the circuit and appropriate nodes are
grounded.

- Again we recommend using a function generator and running a sweep of the frequencies to ensure the
frequency response is correct and using the peak-to-peak measurement option on the scope to check
amplification and gain.

- You can also test this module for gain using a constant voltage signal and measuring the output with a
DMM since a DC voltage corresponds to = 0. Since this is a low pass filter stage, make sure you are
getting maximum amplification at = 0.

- Test your circuit and fill in the table below. (10 points)

Measured cut-off frequency fc =

Frequency Peak-to-peak value Peak-to-peak Gain/Attenuation Gain/Attenuation


of input value of output Factor in dB

DC
1 Hz
3 Hz
10 Hz
30 Hz
100 Hz
300 Hz
1000 Hz
fc

18

Final Project: EEG EE100/EE43 Spring 2013

Notch Filter Stage

- Again we recommend using a function generator and running a sweep of the frequencies to ensure the
frequency response is correct and using the peak-to-peak measurement option on the scope to check
amplification and gain.

- You can also test this module for gain using a constant voltage signal and measuring the output with a
DMM since a DC voltage corresponds to = 0.

- For the notch filter, we really only expect frequencies in a very narrow region to be killed, so make sure
that you dont miss that frequency band in your sweep.

- Test your circuit and fill in the table below. (10 points)

Frequency Peak-to-peak Peak-to-peak Gain/Attenuation Gain/Attenuation


value of input value of output Factor in dB
DC
1 Hz
3 Hz
10 Hz
30 Hz
50 Hz
60 Hz
70 Hz
100 Hz
300 Hz
1000 Hz

The Final Test Circuit

Once you have assembled all of the modules, and tested them, you are ready to put the whole thing together and
finish the final test. Unfortunately we cant just use the function generator to shove the microvolt level signals we
need to simulate. So how can we test our circuit? (Hint: Voltage divider)

Final Testing

19

Final Project: EEG EE100/EE43 Spring 2013

Once you have confirmed your EEG circuit is working properly, you should gather some data. Make sure to have
your oscillator circuit hooked up to your EEG and the scope displaying the output.

6
Set the frequency of the input AC signal to be 10Hz, and amplitude in the order of 10 ~ 10 5 V. Adjust your
potentiometers to get desire gain.

Based on your measurement, fill in the following table for the whole EEG circuit. (10 points)

Frequency Peak-to-peak Peak-to-peak Gain/Attenuation Gain/Attenuation
value of input value of output Factor in dB
DC
1 Hz
3 Hz
10 Hz
30 Hz
50 Hz
60 Hz
70 Hz
100 Hz
300 Hz
1000 Hz

Your GSI Signs Here (40 points)



Can you detect brain signal? (20 points)

20

You might also like