You are on page 1of 97

EE122 Prof.

Greg Kovacs Reviewed by Ross Venook

PRELAB 1: PHYSICAL & VIRTUAL INSTRUMENTS FOR ELECTRONICS


The Future Begins Tomorrow!
Motto of YoyoDyne Engineering in the movie Buckaroo Banzai

OBJECTIVES
Review of basic instruments (physical and virtual). Review of electronic components. Introduction to the design process.

THE BASICS OF ELECTRONIC INSTRUMENTS


The whole purpose of this prelab is to prepare you for going into the lab and using various electronic instruments. There are two types of instruments that you should be familiar with: physical instruments and virtual instruments Physical instruments are the type you can pick up (admittedly, you need help lifting the big ones!). You are probably familiar with several physical instruments such as multimeters, battery testers, etc. Virtual instruments are those that are mainly (or entirely) software and are used with computers. The main virtual instrument that we will use in this course is a variation of the program SPICE which allows circuit designs to be simulated on a computer. This means that you can design and prototype an electronic circuit entirely in software. You dont even need a soldering iron!

INTRODUCTION TO PHYSICAL INSTRUMENTS


Please refer to the lecture materials regarding the instruments to be used in the laboratory. The Hewlett-Packard Model 34401A Digital Multimeter This is an auto-ranging digital meter capable of measuring several basic electrical parameters (hence the names multimeter, digital multimeter, or DMM, digital voltmeter, or DVM.... we'll refer to it as a DVM from here on). The basic principle of early meters was to magnetically deflect a mechanical needle in proportion to an electrical current. The electrical parameter to be measured was obtained by noting the position of the needle against a numerical scale behind it. By converting the desired electrical parameter into a current to deflect the needle, voltage, resistance, and of course, current could be measured. While so-called analog meters still turn up occasionally, digital meters have largely taken their place. Here, the electrical parameter being measured is digitized and displayed as numbers (no squinting at a needle required). Some newer digital multimeters even include a simulated needle to provide a graphical display of varying levels of voltage, for example. Briefly consider the measurement capabilities (specs) of the Hewlett-Packard 34401A. In the "old days" (a few years ago), we really worried about the basic accuracy of DVM's, since they typically only had a few digits (e.g.,, 3 1/2, where the "1/2" digit can read 1 or 0). Typical accuracies were 0.1%. Now, DVM's like the 34401A have many digits (6 1/2 in this case) and basic accuracies on the order of 0.002% or better for all functions! What input range you set the DVM to used to be a big issue, but now they are "intelligent" (microprocessor controlled) and automatically select the best range to give you the most accuracy. PRACTICAL POINT !!!!!!!
The continuity or "beep" function is extremely useful when debugging circuits you are working on... just turn off the power and verify that the connections you want are there and that there aren't any you don't want!!!

The HP 34401A can measure AC (RMS) or DC current and voltage, resistance, as can virtually any DVM. It can also measure frequency, test diodes and provides a "continuity" function that beeps when there is a good connection (or unwanted short-circuit) between the two input leads. Six and 1/2 digits of display are more than adequate for nearly any application in EE122 (and elsewhere, for that matter), so we won't spend much time on accuracy here (if you want to, refer to the manual in the lab). DC or AC voltages can be measured up to 1000 V with a maximum resolution (on the 100 mV full-scale range) of 100 nV!!! Resistances can be measured up to 100 M, with a maximum resolution of 100 (on the 100 full-scale range). DC or AC current can be measured up to 3A (a fuse will blow above that, so be

careful!) with a maximum resolution of 10 nA (!) (on the 10 mA full-scale range). AC voltages are read as true RMS (root mean square). The RMS function is frequency-dependent (an actual analog computational circuit is used). A plot of the accuracy (using specs from the manual) shows that you really have to be careful for low or high frequencies.
5 4.5 4 3.5 Accuracy (%) 3

2.5 2

1.5 1 0.5 0.04% 0 100000 100 1000000 1000 1 10000 10

Frequency (Hz)

PRACTICAL POINT

An important concept for any instrument is the input impedance. This specification is an indication of how much of a load the instrument places on the circuit you are measuring. For the HP 34401A, the input impedance is 1 M (10 M for DC measurements) in parallel with less than 100 pF of shunt capacitance between the leads.

IF YOU ARE NOT USING AUTORANGING, ALWAYS USE THE DIGITAL VOLTMETER (DVM) SETTING THAT YIELDS THE LARGEST NUMBER OF SIGNIFICANT FIGURES. Otherwise, you are getting much less information than it can deliver. (Also remember to take off your shades when using oscilloscopes...) The Hewlett-Packard Model 1740A Oscilloscope The 1740A is a two-channel oscilloscope operating from DC to 100 MHz. You generally use an oscilloscope when you want to look at the actual shape of a signal versus time (or if you just want to play with something with lots of knobs...) Figure 2 below is a quick reminder of how an oscilloscope works....

INPUT SIGNAL TO DISPLAY

volts

time
Electron Beam Source VERT AMP

HORIZ AMP

CRT Screen

HORIZONTAL SWEEP SIGNAL

volts

time

Figure 2: A block diagram illustrating how an analog oscilloscope works. The input signal is amplified and applied to the vertical deflection plates to move the electron beam up and down. A ramp signal is applied to the horizontal deflection plates to move the beam left to right at a desired rate. The electron beam hitting the phosphor on the inside of the cathode-ray-tube (CRT) glows (for some time after the beam moves on) leaving the image of the input signal on the screen.

Besides the setting of the vertical gain (to see the part of the input signal you are interested in) and the horizontal sweep rate (to sweep the beam from left to right at the appropriate speed to see what you are interested in), the triggering of the oscilloscope must be set up correctly (or else you will see stuff on the CRT screen that is about as relevant to your edification as Leave it to Beaver reruns, not to mention the fact that youll really look clueless!). The trigger circuitry in an oscilloscope determines at which point on a waveform to begin the horizontal sweep. Trigger circuits work by determining the slope of the input signal (positive- or negative-going) and comparing the input signal to a reference voltage (the trigger level). When the input signal crosses the trigger level in the appropriate direction (i.e., with the correct slope) the trigger circuit initiates a horizontal sweep. If this is happening fairly often, a stable display is seen on the oscilloscope screen. Figure 3 below illustrates the effects of the trigger settings.

Figure 3: Illustration of the effect of trigger settings on the display of the oscilloscope. Case A shows a positive slope and a trigger level that is crossed more than once per cycle of the waveform. Notice the garbled display. Case B shows a better choice of trigger level, still with a positive slope. Case C shows the effect of changing the slope to negative while keeping the same trigger level.

PRACTICAL POINT

You should note that most oscilloscopes have several triggering modes. The most important ones are normal (NORM), automatic (AUTO), and line frequency (LINE). Normal mode operates as illustrated in Figure 3 above. Auto mode operates more-or-less like normal mode, but it helps you find a good trigger point automatically. Line mode uses the beginning of each 60 Hz cycle of the AC power to start a sweep (this is good for determining if you are looking at 60 Hz power-line noise on a signal). Always start out using AUTO triggering if you are not sure about all of the other settings! The oscilloscope has a frequency response that greatly exceeds that of the DVM described above. Try writing down the numbers from the DVM while measuring a 0.1 Hz sine wave, graphing the data points on a piece of paper as you go (just kidding, but if you pull it off, try it for 1 Hz!). No way thats going to work is there?!? Now you get it dont you... Oscilloscopes can be pretty handy! Its input impedance is 1 M shunted by approximately 20 pF (dont worry, there wont be another problem to work out here, but at least think about it will you!). The input voltage ranges are 5 mV/div to 20 V/div, with an accuracy of 3% (there is a built-in calibrator). The input voltage must be kept below 500 V peak-to-peak or you will see (in order): 1) smoke coming out of the oscilloscope, 2) the T.A. coming over to your

bench with a fire extinguisher, 3) your checking account balance dropping by the cost of repairing a fried oscilloscope.... The timebase sweep rate range is 50 ns/div to 2 s/div with an accuracy of +/- 3%.

The HP Model 33120A 15 MHz Function Generator The 33120A is the main function generator you will use. It can synthesize all of the basic waveforms (square, sine, triangle, ramp, etc., as well as noise and programmable arbitrary waveforms). It can also synthesize AM and FM waveforms with somewhat limited parameters. It is menu-driven and quite intuitive. During the lab, you are encouraged to study its users manual.

The HP Model 8904A Multifunction Synthesizer The 8904A is a four-channel signal generator, and likely only to serve as a backup instrument to the 33120A. Each channel can be set independently to a chosen frequency, phase, amplitude and waveform. These channels can then be fed simultaneously to the same output, the resulting voltage being the sum of the voltage in each channel. Alternately, the output of one channel can be multiplied by that of another, thus providing amplitude modulation (AM). Frequency modulation (FM) can also be achieved using this unit. Such a synthesizer is an important tool for generating test signals to use as inputs to circuits (or to demonstrate test instruments!). An interesting feature of this unit is the multiple outputs that can be summed. This allows you to prove to yourself some of the concepts about Fourier series that you have probably been dying to test... As you may recall, the Fourier series for a signal tells you what combination of amplitudes and frequencies of sine and cosine waves to sum together to make the original signal.

Overview of Spectrum Analyzers The Spectrum Analyzer is the frequency domain counterpart of an oscilloscope in the time domain. In other words, it can give you a plot of amplitude vs. frequency as opposed to amplitude vs. time. In practice, you look at the amount of energy present at each frequency plotted as the y-axis against the frequency (the x-axis). Spectrum analyzers are extremely useful instruments, providing nearly instant information about the frequency content of signals. They can also be used to assess such things as the frequency responses of filters, distortion in amplifiers, and noise levels in signals. There are two types of spectrum analyzers: analog and digital. In EE122, you will probably only deal with the digital type, but the analog ones are important enough that they need to be considered.

Analog Spectrum Analyzers Basically, an analog spectrum analyzer is like a fancy radio, where the tuning is swept between two frequencies. Analog spectrum analyzers are represented by the block diagram shown below... A local oscillator (voltage-controlled-oscillator, or "VCO ") is mixed with (multiplied by) the input signal. This is the basic principle behind heterodyne radios -> the frequency of interest is "heterodyned" down to a lower frequency at which a fixed ("bandpass") filter is centered so that only a "chunk" of spectrum of width (the bandwidth of the band-pass filter) is passed to the envelope detector. The envelope detector is a circuit, such as an AC-to-RMS converter, that computes the energy coming out of the bandpass filter at a given time. This has the same effect as sweeping a band-pass filter of width through the frequency spectrum and looking at its output. The energy (i.e., RMS voltage) value measured for a given frequency is fed to the y-axis of an oscilloscope. Simultaneously, the x-axis is swept in synchrony with the control voltage fed to the local oscillator. Thus, the frequency that is heterodyned down by the detector is varied as the beam is swept across the x-axis.

What about the negative frequency component? It is reflected about f=0 and simply adds to the term at fo... You can't physically have negative frequencies...

Figure 4: Block diagram of an analog spectrum analyzer.

If the frequency of the VCO is swept from fo to some maximum frequency, fm, over the period T, then the frequency spectrum is divided into N frequency resolution "cells" (or regions of the frequency spectrum that are passed by the bandpass filter into the envelope detector at a given time) given by,

N = fm - f o
O.K... these are the ONLY equations in this whole prelab... think you can handle 'em? OOOH! subtraction! AAHH! division! GOSH! an exponent...

with a time spent per "cell" given by,

T cell = T N
Therefore, it is clear that the response time of the filter, tc , must be much less than Tcell if the output is to be meaningful. Since it is known (not necessarily by you, yet!) that tc is approximately 1/ , we can obtain a simple equation telling us how fast to sweep the VCO for a given frequency range and filter bandwidth...

c 1 << T cell = T = T N fm - f o
Or, rearranging,
2 T >> fm - fo = N fm - f o 2

This result tells us that for a high resolution (small ), we need long sweep times. For example, with = 100 Hz, fm = 20 KHz and fo = 0 Hz, the sweep time should be greater than 2 seconds! If the sweep time is too fast, "blurring" of the spectrum occurs.

Typically, a storage tube CRT is used to "hold" the results of the sweep if you need to use long sweep times. This type of spectrum analyzer can be easier to construct if high frequencies are to be examined, but cannot directly provide phase information about the different components of the input signal. Also, this type of spectrum analyzer can be "tuned in" to a single frequency and used to study instantaneous changes over time (used more like a radio). Digital Spectrum Analyzers Digital spectrum analyzers first digitize (record a continuous analog function as rounded numbers with n bits of precision using an analog-to-digital converter) and discretize (sample at a high frequency) the input waveform so that it is simply numbers. Then they take a discrete Fourier transform (DFT) of the data to compute the frequency components. This type of spectrum analyzer can provide phase information but needs to have a fast enough digitizer to handle the frequency range of interest.

Figure 5: Block diagram of a digital spectrum analyzer.

Hewlett-Packard Model 3561A Dynamic Signal Analyzer This instrument obtains frequency domain information from timedomain input signals by digitizing them and digitally computing the desired results using the Fast Fourier Transform, which is a computationally efficient version of the DFT. Think (if you can) about some situations in which you would want to use each type of instrument. If you dont do this, its o.k., because well force you to try them all out anyway when you do the lab!

NOTE that you can always capture a signal using the digitizing oscilloscope (see below) and compute the Fourier spectrum of the data using your computer (e.g., with the FFT or DFT in Matlab). Depending on the resolution, this method could be either more or less accurate than using the 3561A. Of course, its not real-time...

Hewlett-Packard INFINIUM Digitizing Oscilloscope This instrument is a digitizing oscilloscope or digital storage oscilloscope (DSO). The DSO is a versatile instrument that operates by digitizing the input signals with an analog-to-digital converter, storing the corresponding numerical values, and then displaying them on a display. This allows a waveform (even from a one-shot event) to be stored indefinitely as numbers. The resulting display can be modified (zoomed in on, scaled, etc.) and printed. Also, since the information is already stored as numbers, measurements on the waveform are easy and accurate, and most can be displayed in real-time on the device (frequency, peak-topeak voltage, amplitude, etc...). This makes many measurements (such as those done for EE122 labs!) much easier. Please refer to the Users Manual for detailed instructions (which are pretty simple). Also, please be careful to observe that you can save acquired waveforms to disk and then import them into a computer for further analysis or incorporation into write-ups.

Wait... there's more...

INTRODUCTION TO SPICE: A VIRTUAL INSTRUMENT Spice (and several variations that are now available) is a circuit simulation tool that can be run on many types of computers, from mainframes to personal computers. This prelab provides an overview of Spice. Additional information will be available as separate handouts and by referring to the various books and manuals for Spice in the lab room, or on the web. Be sure to read the manuals that apply to the version of Spice you are using! IF YOU ARE USING A GRAPHICAL INPUT SPICE (Such as PSPICE), you can basically ignore this section since the schematic entry for those tool is GRAPHICAL - you just draw the schematic, hook up your virtual instruments, and run. To get an overview of the Spice-type circuit simulators, begin by considering how you can specify a circuit to a computer. This can be done by making a list of each component in the circuit (including its characteristics/value) that includes any points where components connect together. These interconnection points are referred to as nodes. The complete list of parts and connections is sometimes referred to as a netlist, or a deck which youll hear about shortly. The example circuit shown below has the components named and the nodes numbered.
Node 1 Quartz Crystal Equivalent Circuit Rs 240 Lx 4.2 H Cx 0.006 pF Node 4

Signal Source

+ -

Node 2

Node 3 RL 10 K

Vin

Node 0 (ground)

Figure 6: Example circuit showing components names and Spice-style node numbering. Note that ground must always be node 0 in most versions of Spice. The numbering of the other nodes is arbitrary.

The list representation of this circuit is shown below:


Component Tells SPICE that this is the end of the list. Connection Nodes Cx Lx RL Rs Vin .end 4 2 4 1 1 3 3 0 2 0 0.006PF 4.2H 10K 240 AC 1 Value

NOTE!
For PSpice, you need to add a ".probe" line before ".end" line to generate a plot output file...

Notice that the nodes are listed for each pin of each component in the list. This tells the software how they are connected together. Incorrect wiring of Spice components is one of the most common sources of problems with Spice simulations, not unlike in the lab! While most devices you will be using in simulation (resistors, capacitors, etc...) are two-terminal, for devices with more terminals, such as transistors, there are naturally more connections listed after the first entry for the device. Using terminology from the days when you used to have to enter such lists on a deck of punched paper cards, such a list is often referred to as a Spice deck. Such a deck can be input directly to the Spice program as a text file. Using commands that will be discussed below, Spice can calculate the DC levels in the circuit, its time-domain response to various AC input signals, and its frequency response. As you will see, Spice is a very powerful tool for circuit design. As you use Spice in this course, try to think about how hard the prelabs would be if you had to do all of the work by hand! Additional commands are necessary to tell Spice what it is that you want to simulate. To study the frequency response of the circuit in Figure 6, add the following line before the .end command:
.AC DEC 20 100K 10MEG

This tells Spice that you want to calculate the response of the circuit sweeping by D E C ades at 20 frequency points from 100 KHz to 10 MHz (Mega, or 1 million, is expressed as either X or MEG because Spice is case-in sensitive and m is used for milli). Figure 7 below is the output of Spice when given the deck shown above (a log/log plot is shown in Figure 7).
ac3.V(4) 10mV 1mV 100uV 10uV 1uV 100nV 10nV 1nV 100KHz ac3 1MHz FREQ 10MHz

Figure 7: Frequency response of the circuit in Figure 6.

Warning: plots can be deceiving/useless if the axes are scaled differently than you expect. Be sure to plot using appropriate scaling. Later on, we will consider transient analysis in the time domain in more detail, but for the time being, here is how you would change the above Spice deck to look at the circuits response to a 1 millisecond wide square pulse:
Ideal crystal response to a short input pulse. Cx 4 3 0.006PF Lx 2 3 4.2H RL 4 0 10K Rs 1 2 240 Vin 1 0 PWL (0,0 0.1u,1 1u,1 .TRAN 1u 50u .probe .end

Here, ".probe" is added for PSpice...

1.1u,0)

The Vin statement before the .end command tells Spice to input a P iece- W ise- L inear waveform that starts out at 0 V at time=0, climbs to 1 V at 0.1 S, stays at 1 V until 1 S, and falls to 0 V by 1.1 mS. The .TRAN statement tells Spice to carry out transient analysis over the time 0 to 50S, taking steps of 1S. Figure 8 below shows the input pulse. Figure 9 below shows the results of the transient analysis (note the oscillation.... eventually it is damped out). You should note that transient analysis takes a lot more computation than frequency analysis (and therefore much more time). The way to keep them fast is to set up the .TRAN statement so that the total time divided by the time step (number of time steps to compute) is reasonable (i.e., not 10,000... probably a few hundred is best). This is because Spice computes the voltage at each node for each time step by solving all of those equations we want to avoid. It is fast, but not that fast. Even rather simple circuits will take a long time to simulate if you use a zillion timesteps!
2V

1V

0.0V

-1V 0.0S tran3

1uS

2uS TIME uS

3uS

Figure 8: Input pulse applied to circuit in Figure 6 for transient analysis.

400uV 300uV uV 200uV 100uV 0.0V -100uV -200uV -300uV -400uV 0.0S tran3 10uS 20uS 30uS 40uS TIME uS 50uS

Figure 9: Output of circuit in Figure 6 in response to the input pulse.

Exercises - Prelab 1 Work With Your Team


EXERCISE 1: Consider the situation illustrated in Figure 1 below. What is the actual voltage at the outputs of the simple circuit at the left? What is the voltage measured at the meter when connected to the circuit on the left (note the old-fashioned analog meter is the symbol still used for most schematics!)?

1 M

"IDEAL" METER 1 M 100pF

1.00 V

Figure 1: Equivalent circuit of HP 34401 measuring an external test circuit.

Now describe what you would measure if the battery on the left was replaced with a 1V RMS AC voltage source at 10 Hz. How about 10 KHz? Do you see why it is as important as considering what you are measuring to consider what you are measuring it with?

EXERCISE 2: Consider the accuracy of your measurement when reading the trace on the CRT screen with your eyes... If the beam is 2 mm wide and the entire screen is 8 X 10 cm, what is the basic accuracy of your measurements (as a percentage)? Are the accuracies the same for both axes?

EXERCISE 3: Consider a circuit consisting of a signal generator (AC voltage source), vs , having a source resistance, Rs , connected to a load (R in parallel with C). The load voltage is v L.
Rs

+
Vs + R C

+ VL Figure 2: Simple, one-pole low-pass filter.

L Derive an expression for the transfer function, T(f) v v , as a function of frequency. s

Derive a formula for the (upper) cut-off frequency, fu (the frequency at which the output signal is at 1/2 power or 3 dB down). Note that 3 dB down corresponds to an amplitude of 0.707 (one over the square root of two) times the starting amplitude (at DC). This makes sense because the power in a signal into a given resistance goes as the square of the voltage (P = V2/R). One-half the power means the voltage would have to be the square root of 1/2, or 0.707... Above fu, what is the roll-off rate of the amplitude versus frequency (dB/decade)? Hint: your equation should show that the output voltage is 20 dB lower per decade of increase in frequency - in other words, the signal should be 10X smaller if the frequency is raised 10X. If the load consisted of two identical parallel RC circuits, what would the roll-off rate be? (i.e., put a second parallel RC stage in parallel with the parallel RC shown in Figure 2, and recalculate the transfer function) As your transfer function should show, this circuit is a low-pass filter. As the frequency increases, the output voltage, vL decreases because the capacitor tends to act more like a short circuit to ground. Design a simple RC low-pass filter (as shown above) that has an upper cut-off frequency of 3 kHz (top of the voice band), assuming that Rs = 1 k. Use standard components (see table on the course webpage). Use the expression you derived above to select the components. Make a SPICE deck and verify that your design is correct (generate frequency and phase response plots).

That's All Folks!

EE122 Prof. Greg Kovacs

LAB 1: HANDS-ON LEARNING WITH ELECTRONIC TEST INSTRUMENTS


Were having fun now, arent we?
Prof. Bernard Widrow

Note: There are no right or wrong answers here. The idea is to learn and explore as a team. Record your observations in your lab books and then (more neatly) in your write-up, which is due at the beginning of the next lab. That said, please be sure to check with your TA to see what format, and what level of detail/rigor s/he expects. 1) Familiarize yourself with the basic operation of all of the instruments on your bench. Please refer to the users manuals (particularly for the digital oscilloscope) to get a sense for the instruments features. Do not worry about all of the details, as you will learn these as you go. 2) Use the digital multimeter to measure the resistance of various objects (some resistors, your fingertips, some wire). Note the values of the resistors as they are marked, and the values you measure. Note the resistance of your fingertips and how you made the measurements (e.g., two leads on one finger, one lead in each hand, etc.). Yes, these instructions are intentionally vague. Play around. Have fun. 3) Connect the 33120A function generator to the input of the digitizing oscilloscope (Infinium). Note that the voltage that you set the function generator to assumes that you have connected a 50 load (i.e., a 50 resistor to ground). If you do not do this (e.g., use the scope probe, which is high impedance) the output voltage will be larger (theoretically double what you set it to if it is into a very high impedance). Why is this? What happens when you change the input impedance of the Infinium between 1 M and 50? Set the generator to produce a 1 V (peak-to-peak) sinewave at 10 kHz. Set up the oscilloscope so that you have a steady display of a few cycles on the screen (you may have to adjust the triggering). Measure the amplitude. Capture the waveform to disk and import it into your computer to include

in your Lab 1 report. Import it into an Excel spreadsheet (or spreadsheet program of your choice) and plot its square (i.e., compute the square of each points value and plot the squares versus time).

Set the generator to produce a squarewave at the same amplitude and frequency. Zoom in (show just a microsecond or so) to the time around the rising edge. Capture the waveform to disk. Do the same for the falling edge (remember to set the triggering for the falling edge!). Capture the waveform to disk. 4) Connect one of the small electromagnets to the oscilloscopes input. Hold it up to various things (operating power supply, oscilloscope, AC line cords, etc.). Look at the signal you pick up and comment on what you see. If you can, try using the dynamic signal analyzer to look at the frequency components of the signal (do not worry about capturing the waveform, but comment - e.g., is there a lot of 60 Hz line pickup?).

EE122 Prof. Greg Kovacs

PRELAB 2: BASIC OP-AMP CONCEPTS


My favorite programming language is solder. Todd K. Whitehurst

OBJECTIVES (Why am I doing this prelab?)


To obtain a practical understanding of what operational amplifiers (op-amps) are and some applications for which they can be used. To understand the basic op-amp circuit configurations. To understand the basic characteristics (good and bad) of op-amps before measuring some of them in the lab.

INTRODUCTION
A circuit model of an ideal operational amplifier is shown in Figure 1 below. The basic idea is that it is a three-terminal device with two inputs, one inverting (- symbol) and the other non-inverting (+ symbol). The output signal of the op-amp is given by the difference between the voltages applied to the two inputs, multiplied by the gain, A, of the op-amp. The inputs of the ideal op-amp are such high impedance that no current flows into them (on the ideal circuit diagram, note that they are shown as not connected to anything inside the op-amp!).

V1 A(V2-V1) V2
+ -

A fun op-amp project!


For example, to make a "simple" amplifier with a

Figure 1: Circuit diagram of an ideal op-amp.

As explained above, the device shown in Figure 1 would give an output in response to the difference between the two inputs. What

op-amp and two resistors!

would this be good for? It turns out that it is good for such a large number of things that we can barely cover the basics in the time available in this course! It can be used to make amplifiers, integrators, differentiators, comparators, precision rectifiers, oscillators, filters, and a whole mess of other things! The basic characteristics of the ideal op-amp can be roughly summed up with the following five points: 1) The input impedance is infinite - i.e., no current ever flows into either input of the op-amp. 2) The output impedance is zero - i.e., the op-amp can drive (supply enough current for) any load impedance at any voltage. 3) The open-loop gain (A) is infinite. 4) The bandwidth is infinite. 5) The output voltage is zero when the input voltage difference is zero. Quite often, typical integrated circuit op-amps can be considered to be ideal, but as you all know, there arent many truly ideal things around. Well get into all of the imperfections of real op-amps later on (bet you just cant wait!).

To simulate the ideal op-amp shown in Figure 1 in Spice, the following text would be required: EXXXXXXX N+ NNC+ NCGAIN

where a voltage-controlled-voltage source (whose name must begin with E1) has positive and negative outputs (N+ and N-, respectively) and is controlled by a positive and a negative control voltage (NC+ and NC-, respectively). The open-loop gain of the voltage source is determined by the value used for GAIN. A Spice line corresponding to the circuit in Figure 1 might be: Eout 3 0 2 1 100K if you wanted to simulate an open-loop gain of 100,000. Note that the negative output node is connected to Spice ground (node 0).
1

Of course, you can replace the Xs with any meaningful characters....

Also note that you must always be careful about the ordering of the nodes... It is easy to switch the NC+ and NC- nodes and invert your design! One big difference between this ideal op-amp and a real op-amp is that the model can swing its output between +/infinity and real op-amps cannot swing beyond their power supply voltages. Note that real op-amps can also be modeled quite well, although it can get somewhat complex to simulate all of their imperfections! This will be discussed below. The basic circuit configurations for op-amps will be covered below after a brief message about feedback (since it is used in nearly all op-amp circuits). It is not the purpose of this course to give you an in-depth overview of feedback.... Instead, the point is to show you some ways to use it!
For a more detailed preview of feedback, see Sedra & Smith, Chapter 8.

FEEDBACK: WHAT IS IT AND WHERE CAN I GET SOME?


As you may already know, there are two types of feedback: regenerative (positive feedback) and degenerative (negative feedback). In general, positive feedback is not great for amplifiers.... it tends to make transistors blow up and smoke emerge from circuits (not to mention oscillations)... Of course, if you want to make an oscillator, positive feedback may be just the thing you need.... On the other hand, negative feedback is great (not always the case when used with people)! It is used in most amplifiers and offers to improve your circuits in several ways: The gain of the circuit is made less sensitive to the values of individual components. Nonlinear distortion can be reduced. The effects of noise can be reduced. The input and output impedances of the amplifier can be modified. The bandwidth of the amplifier can be extended. Sounds good, doesnt it? All you have to do to get some feedback (of the negative kind) is to supply a scaled replica of the amplifiers output to the inverting (negative) input and presto ! Of course, if you use negative feedback, the overall gain of the amplifier is always less than the maximum achievable by the amplifier without feedback.

For the ideal op-amp shown in Figure 1, without feedback the gain of the amplifier would be A (otherwise referred to as the openloop gain, meaning that there is no closed feedback loop). The best way to understand the effects of feedback on the actual circuits of interest is to dive right in and have a look at them (of course, there will be a few exercises to do as well....).

WHAT CAN YOU DO WITH OP-AMPS?


This section contains an overview of some basic op-amp circuits. These are the fundamental building-block circuits from which the majority of op-amp application circuits are built. This overview covers the bottom lines on these circuits. For more detail, see the textbook or some of the references listed at the end of this prelab. Also note that later we will cover some of the more advanced op-amp circuits....

THE VOLTAGE FOLLOWER The voltage follower (or unity-gain buffer) is the simplest op-amp circuit. It produces an identical copy of its input at its output. The first question that might come to mind is why not use a device called wire to accomplish this?! By connecting the output of one stage directly to the next stage the signal itself could be adversely affected (e.g.,, if the input impedance of the next stage is too low and the input-driving device cannot drive enough current). With a voltage follower in place, however, the input signal is connected to a very high-impedance input and a copy of it is made available at a very low-impedance output (i.e., the output follows the input, and the op-amp makes sure that both sides are happy). As shown in Figure 2 below, the output of the op-amp is connected directly to the inverting input. The input signal is applied to the non-inverting input. As for all op-amp circuits using negative feedback, the circuit automatically keeps the voltage difference between the two inputs at zero (or very nearly so!). This is a key point! If you remember that, op-amp circuits generally make a lot more sense! (The truth of the matter is that if the voltage difference were exactly zero, the output of the op-amp would be zero too... in practice the difference is on the order of a millivolt, and the error introduced by assuming it is zero is negligible.)

VVIN V+

VOUT

Figure 2: The voltage follower, or buffer.

If one works out the math, it is clear that the output voltage can be obtained by substituting, V- = VOUT into the basic op-amp equation, VOUT = A V+ - Vwhich yields, VOUT = A V+ 1+A

Since the op-amps open-loop gain is very large (infinity for the ideal op-amp), the output voltage thus equals the input voltage.

THE INVERTING AMPLIFIER The next op-amp configuration is the inverting amplifier, which produces an inverted (180 out of phase if purely sinusoidal or otherwise symmetric) output with respect to the input signal. The output signal is also amplified by a factor that is determined by the ratio of the two resistors shown in Figure 3. (You get to derive this relationship as a Prelab Exercise!)
R2

VIN

R1

VV+

i fb VOUT

i in

Figure 3: The inverting amplifier.

The intuitive way to analyze this circuit is to consider that , since the non-inverting input is grounded and negative feedback is used, the inverting input will be kept at virtual ground by the feedback. Thus, the currents iin and ifb must be equal. (We could also see that these currents must be equal by noting that very little current can enter the high-impedance terminals of the op-amp) This means that the output of the op-amp must swing far enough that a current

through R2 is drawn that equals iin . If R2 is larger than R1, the required output voltage from the op-amp is larger than the input voltage.... AHA! GAIN AT LAST! To see why the V- input must be at or near ground in this case, consider that , VOUT = A 0 - Vor V- = - VOUT A Since A is very large, V- ends up being very near zero.... This comes back to the statement made above that the voltage difference between the inverting and non-inverting inputs is very small, but may not actually equal zero. This is because A is not infinity in real op-amps, among other reasons. Derive the voltage gain of the circuit in Figure 3 assuming that R2 was replaced by a capacitor (more on this circuit below). Compute the input impedance of the circuit for both cases (again consider the assumptions about V-....)2. THE NON-INVERTING AMPLIFIER The non-inverting amplifier looks a lot like the inverting amplifier except that the input signal is applied directly to the non-inverting input and R1 is grounded at one end. A key point to note here is that the V- node is not a virtual ground in this configuration! The important thing to consider is that the voltage difference between V+ and V- is kept near zero. In other words, V- VIN. You will also derive the transfer function (Vout/Vin) for this circuit in the Prelab. I bet you cant wait!
R2

R1

VV+ VIN

i2 VOUT

i1

Figure 4: The non-inverting amplifier.

THE SUMMING AMPLIFIER


2

Here you can again consider the way the feedback loop holds the V- input at virtual ground by negative feedback. You could also look at it using the Miller Approximation...

The (inverting) summing amplifier shown in Figure 5 below, can be used for adding together several input signals (this circuit forms the heart of audio mixers used in recording studios). V1 V2 V3 V4 Vn
R1 Rf

i1

R2 R3 R4

VV+

if VOUT

Rn

Figure 5: The (inverting) summing amplifier.

THE INTEGRATOR
R2

C1

VIN

R1

VV+ VOUT

i in

Figure 6: The op-amp integrator.

The op-amp integrator shown in Figure 6 has one component, R2, that is not needed in ideal integrator circuits. Its purpose is to limit the DC gain of the op-amp so that its small DC offset voltage will not charge up the capacitor. For DC inputs, the gain can be found as for the inverting amplifier to be (yeah, this is part of the answer to Exercise 1, but you have to show your work!), VOUT = - R2 VIN R1 For AC inputs of sufficiently high frequency that R2 can be neglected (assuming no R2), one can write the equations for the currents that must be equal in the input and feedback circuits (again noting that the V- input is a virtual ground), iin = ifb

thus, vin = - C1d vout R1 dt From which the output signal from the ideal integrator circuit (without R2) should be, vout = 1 R1 C1 vindt

But this only works for frequencies above the point where the effect of R2 dominates the DC gain of the circuit. The frequency below which the circuits behavior becomes more like a DC amplifier than an integrator is given by: fmin = 1 2 R2 C1

THE DIFFERENTIATOR
R2

R1

C1

if VV+ VOUT

VIN i in

Figure 7: The op-amp differentiator.

In the differentiator circuit shown in Figure 7, there is also a component, R1, that is sometimes not shown in textbook op-amp differentiator circuits. Its purpose is to limit the high-frequency gain of the differentiator so that the circuit does not get swamped by high frequency noise (which may have a large derivative despite a small amplitude). For low-enough frequencies that the input impedance is dominated by C1, iin and i f can be equated to show that, vout = - R2 C1 dvin dt As for the integrator above, there is a frequency range over which the differentiator will not work very well. In this case, there is an

upper frequency above which the circuit simply acts as an inverting amplifier. The maximum frequency is given by: fmax = 1 2 R1 C1

For higher frequency AC inputs, the gain approaches (you guessed it!), VOUT = - R2 VIN R1

AN UNAUTHORIZED HISTORY OF OP-AMPS


The term operational amplifier dates back to the days of the analog computer.... Before every 12-year-old kid had a personal computer with tons of RAM, people used analog computers a lot. The slide rule is an example of an analog computer that can double as an eating utensil if necessary. Other analog computers had lots of tubes, got very hot, and seldom worked well (it is interesting to note that the term de-bugging as applied to computer programs dates back to the physical removal of bugs such as moths from tube-filled computers into which they were attracted). These glassand-metal contraptions often used analog techniques to compute integrals, differentials, and so on (as we have just seen, these are relatively straight-forward things to do with analog components). The basic sub-circuit of the computational units was the so-called operational amplifier which usually consisted of two or more tubes and took up the volume of a small engineering textbook. As computers were miniaturized, and with the advent of transistors, op-amps became increasingly smaller until they were only the size of a pack of matches (you know, those things people used to use to light cigarettes). Inside the outer casings were lots of discrete resistors, transistors, capacitors, etc., soldered together and potted with plastic resin in to one solid chunk. These blob-amps eventually gave way to the integrated circuit op-amp that we use today. Figure 8 below indicates that there have been considerable improvements in integrated op-amps over the years, but no matter what, marketing guys are always the same....

1972 LM741 Monolithic Operational Amplifier Features:


Ultra high performance It works (often) 1MHz Gain-Bandwidth Product Monolithic Low cost

2000 LT 1028 Ultra-High Performance Op-Amp


Features: Ultra high performance 75 MHz Gain-Bandwidth Product 35 nV/ Hz noise 12 nA Input Offset Current Low cost

Marketing hasn't changed!


Figure 8: Comparison of parts of two typical op-amp data sheets from 1972 and 2000. Note that performance has changed, but marketing has not.

BASIC PARAMETERS OF OP-AMPS


This section is concerned with discussing the various electrical parameters of real op-amps. Some of the parameters are features that improve performance. Others are imperfections that hinder it. (You can get a good sense for what category any specification falls into by looking at the data sheet!) We will now consider the major specifications of operational amplifiers. OFFSET VOLTAGE If an op-amp were perfectly balanced, the DC output voltage, VOUT, would be zero when no differential voltage is applied to the inputs. Owing to minor imbalances, this is not the case. A real op-amp can be thought of as a perfect op-amp with a small offset voltage, VOFF, applied differentially to the inputs. Due to the large voltage gain, even a small VOFF can result in a large VOUT. With a circuit gain of 100,000, a typical offset voltage of 1 mV would result in an output voltage of 100 V. Since the power-supply voltages are much smaller than 100 V, the amplifier would rail (the output will be near V+ or V -, depending on input polarity).

Many op-amps have two pins to which an external potentiometer (variable resistor) connected to a DC voltage can be connected to null out V OFF, if needed. GAIN, BANDWIDTH, AND STUFF LIKE THAT... The open-loop gain (A) is the specification that indicates the maximum gain of the op-amp (this is the gain that you would obtain without any feedback, hence the name). Open-loop gains of opamps are generally very high (on the order of 100K to 1MEG!). As you will see in the lab, that means that the open-loop gain is rather hard to measure since the op-amps output can only swing to near the power supply voltages (thus it is hard to apply a small enough signal to the input so that you get an undistorted output, even without worrying about offset!). Measuring the slew rate of a lobster with a piece of bungie-cord.... So, open loop gain is essentially infinite, but, since op-amps are not infinitely fast, their gain decreases as the input frequency increases. This makes sense, since for a higher frequency, the transistors inside must swing the output faster and faster to reach the same output amplitude. In practice, the output eventually cannot swing fast enough and the amplitude of the output signal falls with increasing frequency... which brings us to the term slew rate . The slew rate specifies the maximum rate at which the op-amp can swing its output. Slew rate is traditionally given in units of V/S (but newer op-amps, that can swing at over 5,000 V/S make you wonder if we will change to V/nS...). The unity-gain bandwidth is the frequency at which the open-loop gain of the op-amp falls to one. As you can see in Figure 9, below, the open-loop gain falls rapidly above the low frequency cutoff (or break frequency) fu which is defined as the frequency at which the gain has fallen 3dB from the DC value, as shown in the close-up in Figure 10 below. The slope of the open-loop (voltage, not power!) gain curve is -20 dB/decade (-6 dB/octave). In other words, for a ten-fold increase in frequency, the gain falls ten times. This first-order low-pass effect is due to the "dominant pole of the op-amp (typically due to an on-chip capacitance put there to ensure stability of the circuit). Such capacitors (compensation capacitors) are often used in even single-transistor amplifiers to obtain a controlled gain roll-off.

1.0M

-3 dB

100

10m 1.0h fu V(5)/V(1)

100h Frequency

10Kh

1.0Mh

10Mh

Figure 9: Simulation of the open-loop gain of the 741 op-amp. The plot is the output voltage divided by the input voltage, shown with log/log axes. Note that the gain falls very rapidly, beginning at very low frequencies.

1.0M

100K

10K 1.0h V(5)/ V(1)

3.0h

10h

30h Frequency

100h

Figure 10: Close-up view of the open-loop gain near the cutoff frequency, fu (approximately 9 Hz in this case).

NICE HAT!

Traditional costumes of analog circuit designers.

30

The unity-gain bandwidth is the frequency at which the open-loop gain falls to 1, as shown in Figure 11 below.
100

1.0

10m 100Kh V(5)/ V(1)

300Kh

1.0Mh

3.0Mh Frequency

10Mh

Figure 11: Close-up view of the open-loop gain near the unity-gain frequency, fT (approximately 1 MHz in this case).

A very important fact is that the product of the gain and the cutoff (3dB) frequency is constant at any point on the response curve of the amplifier. This means that you are always trading off gain for frequency response! The more gain, the sooner the response begins to roll off. Another way of looking at this is that at higher gains, you get closer to the open-loop gain situation, where the roll-off begins at fu, and at lower gains, you are closer to the unity-gain situation where the gain extends out to fT. This gain/frequency response trade-off is expressed as the gain-bandwidth product of the op-amp. The gain-bandwidth product is a key parameter in the selection of op-amps since it expresses the limits for amplification/frequency response performance! RULE OF THUMB! Note that to ensure that op-amp circuits operate without distortion, you should design the circuit so that the gain at your maximum frequency is no more than approximately 1/10 th to 1/20 th of the open-loop gain at that frequency. In other words, leave yourself a 10-20X safety factor! (For precision circuits, such safety factors may be quite a bit larger, but their determination is beyond the scope of these notes!) STABILITY AND COMPENSATION Real op-amps have an open-loop gain roll-off with frequency that is approximately first-order (-20 dB/decade) over much of their useful bandwidth. The major internal capacitance that causes this roll-off is often referred to as the dominant pole of the amplifier (mentioned

previously). At higher and higher frequencies, other capacitance effects come into play as additional poles (sometimes there are three or more). This means that the open-loop phase response of the amplifier will eventually reach -90 times the number of poles.... If the phase is between +180 and -180 when the gain of the amplifier reaches a gain of unity (0 dB), everything remains stable. However, if the phase crosses -180 before the (closed loop) gain falls to unity, oscillations will probably occur (since an inverted replica of the amplifiers output is fed back into the inverting input, resulting in positive feedback)! If an op-amp circuit is unstable, almost any noise present in the circuit will have enough of a highfrequency component to cause the circuit to oscillate. In other words, if the phase crosses -180 at a frequency where the gain of the amplifier is less than unity, the amplifier is unconditionally stable! The most common way to guarantee stability is to compensate the amplifier with some additional components that shape its frequency response so that its gain is less than unity by the time the phase hits -180. This does, however, compromise the high-frequency response of the amplifier! In practice, higher gain circuits have less of the output signal fed back to the input, and are thus less susceptible to instability. Thus, the lower the closed-loop gain, the more likely it is that compensation will be required. You will see this first hand in the lab. Most op-amps are internally compensated, which means that the component(s) required to guarantee stability are included on the chip itself. Some of the older op-amps, and those designed for high-speed operation, are externally compensated, which means that you, the designer, must choose external components to assure that the amplifier will not become unstable.

COMMON-MODE SIGNAL REJECTION If op-amps were perfect difference amplifiers, then the output should always be zero if you apply the same signal to the non-inverting and inverting inputs at the same time, right? Well, as you might guess, they are not perfect at this either.... Such a signal, applied to both inputs at the same time, is called a common-mode signal. Common-mode rejection is important to consider because sometimes external noise is applied to op-amps unintentionally...

POWER SUPPLY REJECTION If you think about it, a good amplifier should be relatively insensitive to undesired variations in the voltages that are powering it. Most DC power supplies have some ripple and it would be bad if that ripple was picked up (and/or amplified!) by the op-amp. Op-amps are generally very good at rejecting variations in their power supply voltages (i.e., not reflecting them at their outputs). OUTPUT VOLTAGE SWING A note about power supplies is that, while the op-amp can swing its output nearly to the supply voltages (usually +/- 12 or 15 volts), it cant swing them farther. What happens when the input signal is so large that the op-amp circuits gain calls for a swing beyond the supply voltages is that the amplifiers output will clip (i.e., the voltage hits either rail and stays at that supply level until the input returns to the linear range of the op-amp). This is the effect that causes the nasty audio distortion when you turn an amplifier up too loud. (A note for you rock & rollers: at high enough volumes, your ear drum will clip too!)

"We don't need no education...."

OTHER OP-AMP PARAMETERS Other op-amp parameters that are often considered (but will not be discussed in depth here) are the noise performance of the op-amp (referring to its internally-generated noise), its power consumption, its input impedance (sorry folks, its not infinity, but often darn close!),

and many others. If you are interested, you should refer to some of the references given at the end. Also be sure to check out the datasheets for some common op-amps (741, 411, 1056, etc...) that are on the manufacturers or the courses websites. HOW TO MAKE SPICE SIMULATE REAL OP-AMPS
GOLDEN RULE OF OP-AMP SIMULATION: The lousier the op-amp, The harder it is to simulate!

As discussed above, it only takes one line to specify an ideal op-amp in Spice. However, it is considerably more complex to model the imperfections of op-amps! (Interesting that we have to work so hard to simulate things we dont really want at all!) While the details of these models are beyond the scope of this course , the interested reader (is there any such thing?) can inquire to obtain some more information. An example model of the UA741 (a somewhat obsolete, but still useful, op-amp) is listed below and is available on the lab computers or the web. Most op-amp manufacturers provide downloadable macromodels for the majority of their op-amp products. * UA741 operational amplifier "macromodel" subcircuit * connections: non-inverting input * | inverting input * | | positive power supply * | | | negative power supply * | | | | output * | | | | | .subckt UA741 1 2 3 4 5 * c1 11 12 4.664E-12 c2 6 7 20.00E-12 dc 5 53 dx de 54 5 dx dlp 90 91 dx dln 92 90 dx dp 4 3 dx egnd1 98 0 3 0 0.500000 egnd2 99 98 4 0 0.500000 fb1 7 99 vb 10610000.000000 fb2 7 99 vc -10000000.000000 fb3 7 99 ve 10000000.000000 fb4 7 99 vlp 10000000.000000 fb5 7 99 vln -10000000.000000 ga 6 0 11 12 137.7E-6 gcm 0 6 10 99 2.574E-9 iee 10 4 dc 10.16E-6 hlim 90 0 vlim 1K q1 11 2 13 qx q2 12 1 14 qx r2 6 9 100.0E3 rc1 3 11 7.957E3 rc2 3 12 7.957E3 re1 13 10 2.740E3 re2 14 10 2.740E3 ree 10 99 19.69E6

ro1 8 5 150 ro2 7 99 150 rp 3 4 18.11E3 vb 9 0 dc 0 vc 3 53 dc 2.600 ve 54 4 dc 2.600 vlim 7 8 dc 0 vlp 91 0 dc 25 vln 0 92 dc 25 .model dx D(Is=800.0E-18) .model qx NPN(Is=800.0E-18 Bf=62.50) .ends To use this and other subcircuits in Spice, you need to insert a line in your deck that begins with an X to make each copy of the subcircuit. An example of a unity-gain circuit made with the UA741 subcircuit is shown below. X1 1 2 3 4 2 UA741 Vplus 3 0 15V Vminus 0 4 15V Vin 1 0 AC 1 0 .AC DEC 100 1hz 10MEG .probe .end Note that you have to explicitly specify the power supplies for these op-amp subcircuits.

WHY ARE THERE SO MANY DARNED OP-AMPS AROUND?


At last count, there were hundreds of types of operational amplifiers currently available from U.S. manufacturers. An astute reader (i.e., one who noticed the above heading) might ask, Why are there so many darned op-amps around? The answer has to do with either the basic functions of the op-amps or with the details of their specifications. Examples of the different basic op-amp functions include power op-amps (that can output several amperes of current), high-speed op-amps (that can operate at frequencies of hundreds of MHz), dual or quad op-amps (that include two or four amplifiers in a single i.c. package), and so on. Examples of different specifications include low-noise, low-power, high-gain, low-offset voltage, and other specific improvements in op-amp characteristics, such as those discussed above. Other factors in choosing op-amps include such basic things as the semiconductor technology with which they are built.... Some, like the 741, use strictly bipolar transistors. Others, such as the

LF411 use JFET inputs to increase their input impedance and decrease their noise. Still others are built with CMOS circuits for lower power.... If you are serious about designing with op-amps, it would be very useful to look through a few modern databooks to see whats out there!

GOOD FURTHER READING ON OP-AMPS


(This is only a sampling, not a comprehensive list....)
T. C. Hayes and P. Horowitz, Student Manual for The Art of Electronics, Cambridge University Press, 1989, pp. 163-243 H. M. Berlin, Design of Op-Amp Circuits, Howard W. Sams & Co., 1990 W. C. Jung, IC Op-Amp Cookbook, Howard W. Sams & Co., 1989 (?)

Often, you can get these free or cheap if you call and tell them you are a student!

"Analog Devices 1992 Amplifier Applications Guide," Analog Devices, Inc., Norwood, MA, 1992, (617) 329-4700 The Handbook of Linear IC Applications, Burr-Brown, Co., International Airport Industrial Park, P.O. Box 11400, Tucson, AZ Linear Technology Applications Guide, Linear Technology, Co., Milpitas, CA National Semiconductor Linear Applications Guide, (more than one volume these days!), National Semiconductor, Co., Santa Clara, CA

ENGINEERING UNITS REVIEW


10 12 10 9 10 6 10 3 10 10 -3 10 -6 10 -9 10 -12 10 -15 10 -18 helluvaheckuvalotsabunchadeccasillipismobananadoodoonononada-

(from Science Made Stupid, by Tom Weller)

Exercises - Prelab 2 Work With Your Team


EXERCISE 1: Derive the voltage gain of the inverting amplifier (Figure 3) in terms of R1 and R2. Hint: remember that V - will be approximately zero volts. Remember to show your work.

EXERCISE 2: Derive the voltage gain of the circuit shown in Figure 4 (non-inverting amp) in terms of R1 and R2. Hint: remember the fact that the input current to the op-amp is (almost) zero. What is the input impedance of this circuit (assuming an ideal operational amplifier)?

EXERCISE 3: Derive an expression for the output signal of the circuit in Figure 5 (inverting summing amplifier) in terms of the resistors shown and the input signals V1 through Vn. Hint: all of the input resistors are connected to a virtual ground... What is the input impedance at each of the input resistors? Comment on how you could use this circuit for an audio mixer (e.g., in a recording studio). Comment on how you could use it for an audio equalizer (hint: think about a bank of filters in front of it).

EXERCISE 4: Design an integrator (assume an ideal op-amp with an open-loop gain of 100K) that will provide a triangle wave output of 1 V peak-to-peak for a 1 V peak-to-peak square wave input at 1 Khz. Start with a sketch of the waveforms and consider the scaling of R1 and C1 to get the correct output signal. Hint: sketch the waveforms and consider the time over which you are integrating things!!! Start out with a value of R2 chosen to obtain a DC gain of 10. If you are not using a graphical-input SPICE, your Spice deck (why?) should look like this (you replace the ? marks with your chosen component values): Op-Amp Integrator Simulation *YOU fill in the component values! R1 1 2 ?

CI2 2 3 ? R2 2 3 ? E1 3 0 0 2 100K Vin 1 0 pulse(-0.5 0.5 0 5nS 5nS 500uS 1mS) .TRAN 100uS 10mS .probe .end Simulate the circuit in the time domain using an ideal op-amp in the above Spice deck. When you get it right, you should get some output from Spice that looks something like Figure 12 below.
V(3) 10V V(1)

Actually, this plot was made using a 2V Peak-to-Peak input signal.... Yours should use 1V Peak-to-Peak...

0.0V

-10V 0.0S tran3

2mS

4mS

6mS

8mS TIME mS

10mS

Figure 12: Example output of an integrator with square wave input.

What is wrong with this picture? The integrator is starting out with initial conditions of -1V DC applied to its input. The way Spice works, it first computes the initial conditions therefore, the circuits output starts at +10V! Modify your Spice input (or your plot) to obtain a nice looking plot of the integrator in operation after it has settled down. (Dont try for perfection here! Just show that the output amplitude is close to what you designed for!) Now try changing R2 to get DC gains of 5 and 1. What effect does this have on the output waveform and the time to settle down to a steady-state output waveform? Is it what you expected? Obtain the gain and phase responses versus frequency for your integrator design using Spice.

EXERCISE 5: Design a differentiator that, when placed in series with the integrator you designed above, gives you back the 1 V peak-to-peak square wave that you input to the integrator. Verify that it works using Spice. You should get some output that looks at least as good as Figure 13 below. Obtain the frequency and phase responses of the integrator/differentiator combination. Comment.
V(3) 2V V(1) V(6)

Actually, this plot was made from a circuit with a 2V Peak-to-Peak output... yours should be 1 V Peak-to-Peak...

0.0V

-2V 10mS tran2

11mS TIME mS

12mS

Figure 13: What your simulation results should look like (or close).

EXERCISE 6: Using the UA741 subcircuit model (available on the lab computers, on the web, or in the PSpice parts browser), simulate the frequency and phase response of a gain-of-100 inverting amplifier built with the 741. Then determine the slew rate of a unity-gain amplifier using the 741 model by running a transient analysis with a pulse input signal at a frequency that makes the 741 have difficulty keeping up with the input voltage swings (try around 100 KHz).

That's All Folks!

EE122 Prof. Greg Kovacs

LAB 2: WHAT IS AN OP-AMP ANYWAY?


What in the world is electricity? And where does it go after it leaves the toaster? Dave Barry

NOTE: This is not a spoon-fed lab. You will not be told which buttons to push. You will have to plan and execute the necessary measurements. The TAs will, of course, be there to guide you. You will not be told exactly what to put in your write up. The idea is that you present your data and what you learned from it. Typically, you will make plots and analyses a part of the write-up. Write-ups must not be longer than ten pages. But, they must be a sufficiently clear and complete account of your experiments with commentary on the results.

INTRODUCTION
In this lab session, you will use a solderless breadboard, illustrated below. This is a really useful tool for prototyping circuits without soldering (you DO know what soldering is, don't you grasshopper?). You can put ordinary "dual-in-line" integrated circuits into the central area of the breadboard and be able to connect multiple wires to each pin. You can also put transistors, diodes, resistors, capacitors, etc., into the holes. You should carefully look at the figure below so you get a sense for the internal connections of the pins. If you don't do that, you can waste a LOT OF TIME!!!.

Each set of five pins are shorted together internally so you can make multiple connections to one i.c. pin or component lead...

Each of the long rows of pins is shorted together so you can use them as power supply and ground lines...

Figure 1: Layout of a standard solderless breadboard, showing the internal electrical connections. Please take note of this carefully! (On some older breadboards, the four long bus connections on opposite sides of the board are split in the middle - you must jumper them in the middle if you want them to be connected the whole way across the breadboard.)

Offset Null 1

8 N.C.

-IN 2 +IN 3 V- 4

7 V+ 6 Out 5 Offset

Null

LM741
Figure 2: Typical op-amp pin-out. Please refer to the datasheets for the exact devices you are using, just to make sure!

PRACTICAL POINT

You should note that virtually all single op-amps in 8-pin DIPs ("dual in-line package") are pin-for-pin compatible. In other words, you can just plug any of them into a pre-existing circuit configuration and go. There are some exceptions however (particularly in the offset-null circuits), so always check the data sheets!

Before you begin constructing your op-amp circuits, you should set the current limits to 50 mA (to limit the maximum current in case something is wired up wrong). Your TA should demostrate this procedure, as it is an important safety consideration...if not for you, certainly for your circuit. Be sure to turn off the power before you change op-amps.

1) This set of experiments calls for exploring the basic properties of some common op-amps. In each case, build the circuit and test at least two of the op-amps available (you must use the 741 and the LT1056 or equivalent the TAs will give you). Be constantly on the alert for output oscillations. Not all op-amps are unity-gain stable. For example, the LT1221 is only stable for gains 4. Thus, you would not use the LT1221 for a unity-gain experiment. ALWAYS use 0.1 F decoupling capacitors on each power supply rail, right next to each op-amp. Use one capacitor from the positive rail to ground and one from the negative rail to ground. Set up an inverting op-amp circuit with an inverting gain of ten and an output load resistor (to ground) of 2 k (you may need to use two 1 k resistors in series). Use 15 V supplies. You may wish to put an input 50 or 51 resistor from the signal generators output to ground so that the amplitudes on the signal generator are correct (they assume a 50 load). Choose an input signal amplitude such that, for each gain you use, the output swing is 10 V (20 volts peak-to-peak) at a low frequency like 100 Hz. For each op-amp tested record the gain and phase in response to a sinewave at a series of frequencies you choose to illustrate its performance. A good approach is to use log steps (1 - 2 - 5 - 10 - 20 -... and so on). Do not take too many measurements, but try to go high enough to see the 3 dB frequency (you will not necessarily be able to get there for the faster op-amps). Record your observations and all input voltage and other details. Repeat for a gain of 100. If you are clever, you can wire up more than one copy of the circuit and make measurements faster. Comment. Is this in keeping with a gain-bandwidth product? If you want, you might want to hunt for the 3 dB frequency at a gain of 1000.

2) Wire up at least two unity-gain stable op-amps (741 and LT1056) in unity gain configuration. Drive them with a 1 VPP squarewave with the signal generator terminated into 50 and an op-amp load resistance of 2 k to ground. Using the digital oscilloscope, calculate the slew rates for each op-amp on the rising and falling edges of the squarewave. Try the same op-amps at a gain of ten, and also try a fast op-amp (LT1221). How do your measurements compare to slew rates reported in the data sheets? When you are done measuring them, try without the power supply decoupling capacitors. Do you see why they are needed? 3) Build the integrator and differentiator you designed in the prelab. If you cannot get the exact component values, approximate, but be consistent in both circuits. Test with the LT1056 or equivalent the TA suggests. Observe and compare to your simulations. Try hooking them in series (integrator first) and putting in a squarewave - what do you get out?

Note: There are no right or wrong answers. The idea is to learn and explore as a team. Record your observations in your lab books and then (more neatly) in your write-up, due at the beginning of the next lab. Also, be sure to address any comments your TA had for your previous write-up.

EE122 Prof. Greg Kovacs

PRELAB 3: MORE OP-AMP CIRCUITS!


If you cant fix it, make it a feature... Anonymous

OBJECTIVES (Why am I doing this prelab?)


To gain insight into op-amp application beyond those considered in Lab 2. To understand the basics of analog filters. To understand circuits.
For more details on filters, see Horowitz & Hill or the references listed at the end of the filters section.

circuits

comparator

and

Schmitt-Trigger

To understand some linear and nonlinear oscillators.

INTRODUCTION TO ACTIVE FILTERS


One of the basic building blocks for analog circuits is the filter. The purpose of filters is generally to achieve some frequency selectivity by processing input signals so that desired signal frequencies are passed through the filter (sometimes amplified as well) and undesired frequencies are attenuated. As electrical engineers (or their ancient equivalents) have known for many years, filters can readily be constructed from passive components (resistors, capacitors and inductors). The advent of active components has led to tremendous improvements in filter performance, as indicated in the Pros and Cons list below: Pros of Active Filters 1) elimination of inductors 2) low cost (largely due to item 1) 3) smaller size and weight (due to item 1) 4) high isolation (high input impedance, low output impedance) 5) characteristics relatively independent of loading (due to item 4) 6) user-defined gain Cons of Active Filters 1) requirement for power 2) limited dynamic range (lower limit due to noise, upper limit due

to clipping) 3) limited frequency range (lower limit due to large capacitors, upper limit due to active device performance) While many filtering applications now use digital filters to obtain virtually arbitrary transfer functions, analog filters are still required in such cases at the analog inputs and outputs of the digital systems. In addition, analog filters form vital parts of several common electronic devices such as radios, televisions, and home audio equipment3. THE BASIC TYPES OF FILTER There are five basic filter types that bear consideration at this point (shown below in Figure 1): low-pass, high-pass, band-pass, notch, and all-pass (more on that last, weird-sounding one later). Lowpass filters (by far the most common type) ideally pass all frequencies below a specific cut-off frequency. High-pass filters ideally pass all frequencies above a specific cut-off frequency. Band-pass filters ideally have a passband between a low and a high cut-off frequency and reject frequencies outside of this band (the stopband ). Notch filters ideally reject only a specific, and often very narrow, band of frequencies, passing all others. All-pass filters ideally pass all frequencies equally in amplitude (as the name implies!), but change the phase of the input signals depending upon their frequency (more on this later).

Figure 1: The gain (or frequency) response of the basic types of filters. Unfortunately, none of these brick-wall filters can be realized. Actual filters have more rounded transfer functions...

For frequencies between approximately 0.1 Hz and 100 KHz, op-amp filters are generally reasonable. Above these frequencies, LC filters are small and inexpensive, and are typically used.

REALLY SIMPLE FILTERS! To start the discussion, it is worthwhile to review some basic, passive RC filters and get a sense for where their poles and zeros are on the S-plane4 (or, for the less-informed reader, what poles, zeros and the S-plane are !). For the first-order, RC low-pass (the schematic of which is shown in Figure 2 below), the transfer function can be shown (easily!) to be: vout = a0 vin S +1 0 with the single pole at S = -o as shown in Figure 2 below (ao is the gain for low frequencies). The cutoff frequency of this filter is given by, 0 = 2 fc = 1 RC

R V
in C

out

Figure 2: Schematic and pole position of the first-order, RC low-pass filter.

The frequency and phase response of this filter is shown in Figure 3 below. In this example, the cutoff frequency (shown as fc in Figure 2) is 1KHz. At this frequency, the amplitude of the filters output has fallen to 0.707 times its amplitude in the passband (frequency range without significant attenuation) and the phase is at - 45. In addition, the cutoff frequency in radians, o, is the distance of the pole from the j axis (measured perpendicular to the j axis, as shown in Figures 2 and 4).
If you hadnt remembered by now, S is the Laplacian operator, and the complex frequency variable (S = + j )
4

0.707 V

- 45

1 KHz
Figure 3: Gain and phase responses of the first-order, RC low-pass filter.

For the first-order RC high-pass (the schematic of which is shown in Figure 4 below), the transfer function is: vout = a1S vin S + 0 with a single pole at S = -o and a single zero at S = 0 (a1 is the gain for high frequencies). The cutoff frequency is, of course, the same.

C V
in

V R

out

Figure 4: Schematic and pole position of the first-order RC high-pass filter.

0.707 V

+ 45

1 KHz
Figure 5: Gain and phase responses of the first-order, RC high-pass filter.

As you can see, the poles and zeros correspond to the values of S that set, respectively, the denominator or numerator of the transfer function equal to zero. If you plug a specific sinusoid (s = 0 + j) into the transfer function, you get the relative response to an input at that frequency (). A pole will make the frequency response of the circuit fall off at a rate of -20dB/decade (-6db/octave) when the frequency exceeds the cutoff frequency (the point at which the response is 3 dB lower than in the passband, or 0.707 times the passband amplitude). A zero, on the other hand, gives the circuit infinite attenuation of the input signal at zero frequency (D.C.), and decreasing attenuation up until the cutoff frequency, above which the frequency response flattens out. For a zero, the rate of increase in output amplitude is +20db/decade. From inspection of the circuits in Figures 2 and 4, it should be clear (for these simple cases) how the capacitors infinite DC impedance and AC impedance that decreases with increasing frequency can give rise to the observed frequency responses. For the high-pass filter shown in Figure4, two additional observations should be made. First, the zero alone would make the frequency response of the circuit continue to increase to infinity, but the coexistent pole at the cutoff frequency cancels out the zero to flatten the response. Second, you cannot have a zero without a pole in real circuits.

HOW TO VISUALIZE POLES AND ZEROS In general, the transfer function of a filter is of the form, TS = AS S - Z1 S - Z2 = BS S - P1 S - P2 S - Zm S - Pn

where the numerator is a polynomial, A(S), which defines the zeros (Z1 ... Zm), and the denominator is also a polynomial, B(S), which defines the poles (P1 ... P n, where n is the order of the transfer function). Physically, the order of a filter is equal to the number of passive energy-storage elements (capacitors and inductors) in the circuit. Mathematically, the order of the filter is the order of denominator polynomial of its transfer function, n. For example, the transfer function of an nth order low-pass filter falls off as fn for frequencies well above the cutoff frequency (where f is the frequency, of course!). The best way to remember the big picture about the influence of poles and zeros on a circuits transfer function to make use of a simple (dumb?) analogy: the circus tent! Think of the poles as just that... poles to hold the tents canvas off the ground. Think of zeros as tent pegs, hammered through the canvas and into the ground. With this in mind, look at Figure 6 below...

Figure 6: S-plane plot of the transfer function of a second-order low-pass filter. The plot is cut along the j axis to reveal the frequency/gain response.

Figure 6 (above) shows the S-plane plot of the transfer function, LPF S = 1 S + 1+4j S + 1-4j = 1 S + 2S +17
2

which represents a simple, second-order low-pass filter. Adding two zeros at the origin gives the transfer function, HPF S = S2 S + 1+4j S + 1-4j

which represents a simple second-order (as mentioned above, the zeros dont count in the order) high-pass filter, whose magnitude response is shown in Figure 7 below. The zeros serve to cancel the roll-offs of the poles to allow the filters response to flatten-out at frequencies relatively far above the cutoff frequency (here the cutoff frequency is 4 radians per second... = 4).

Tourists in S-Plane-Land...

Figure 7: S-plane plot of the transfer function of a second-order low-pass filter. Again, the plot is cut along the j axis to reveal the frequency response (=0).

More complex frequency responses can be realized by using more poles and zeros! You can arrange the poles and zeros of a filter to achieve very sharp cutoff slopes, but the ultimate slope of the filters frequency response (well into the stopband5) is always -20
5

just a reminder that stopband is the frequency range in which the filter stops or attenuates

signals...

dB/decade times the number of poles minus the number of zeroes! One of the ways to obtain steeper cutoff slopes is to use inductors as well (however, as discussed above, RLC filters are generally costly, bulky, and heavy).

WHAT IF YOU PUT LOTS OF FILTERS IN SERIES? You might think that simple, higher order filters could be obtained by cascading identical, passive RC filter stages such as those shown in Figures 2 and 4. In practice, however, this does not work, since each succeeding filter stage loads the preceding ones and alters their frequency responses (the poles and zeros can interact with each other!). The loading and interaction effects result in a very mushy frequency response for higher-order filters built in this way, as shown in Figure 8 below.

1.0V

1.0mV

1.0uV 1.0h V(2) V(3)

V(4)

V(5)

100h V(6)

V(7) V(8) Frequency

10Kh V(9)

1.0Mh V(10) V(11)

Figure 8: Frequency responses of ten series RC low-pass filters, each with a cutoff frequency of 10 Hz.

Taking cascaded low-pass filters as an example, if buffer amplifiers (such as unity-gain stages) were used to provide isolation between identical passive low-pass sections, the cutoff frequency would shift lower and the ultimate slope of the frequency response would be made steeper, but the loading effects would be eliminated, giving a flatter passband and a sharper initial roll-off (as shown in Figure 9 below). (This idea is explored more thoroughly in Horowitz & Hills, The Art of Electronics.)

1.0V

1.0mV

1.0uV 1.0h V(2) V(4)

V(6)

V(8)

100h V(10) V(12) Frequency

V(14)

10Kh V(16)

V(18)

1.0Mh V(20)

Figure 9: Frequency responses of ten BUFFERED series RC low-pass filters, each with a cutoff frequency of 10 Hz.

It turns out that the practical application of more complex filters typically involves placing various first- and second-order filter sections in series (thereby forming an overall transfer function that is the product of the individual transfer functions). KEY POINT The good isolation of active filters (i.e., filters that use op-amps) allows this to be done! Therefore, second-order active filter stages will be studied in some detail, followed by an overview of how to make more complex filters with them. THE BASIC SECOND-ORDER TRANSFER FUNCTIONS It turns out that, for most op-amp active filters, the basic building block is the second-order stage. Therefore, it makes sense to consider them in some (but not too much) detail... The three basic second order transfer functions (LPF = low-pass, HPF = high-pass, and BPF = band-pass) are shown below: LPF S = A S + So + 2 o Q
2

Figure 10: Transfer function and plot for low-pass filter.

HPF S =

AS 2 S 2 + So + 2 o Q

BPF S =

AS S + So + 2 o Q
2

Figure 10 (cont...): Transfer functions and plots for high-pass (above) and band-pass (below) filters.

For the formulas shown above, o is the cutoff frequency for the high- and low-pass filters (and the center frequency for the bandpass) and Q is the quality factor that determines how far the poles are from the j axis for the low-pass, high-pass, and bandpass filters (the closer they are, the more the peaking of the frequency response).6
6

Sometimes, the damping factor, d, is used instead of Q, since it is directly proportional to the distance between the poles and the j axis.

Pole Distance from j Axis = o 2Q

A large Q (small d) means that the poles are near the j axis, that the filters frequency response is very peaked near o, and that its tendency toward oscillations is high (Q = is an oscillator). KEY POINT For the low- and high-pass cases, it can be shown that the maximally-flat (best roll-off without peaking) occurs for, Q= 1 2 This is the Butterworth filter response, which is what you need for many applications! Other Q values are often required when multiple second order stages are cascaded in more complex designs. The ultimate roll-off slope of the second order high- or low-pass filter is -40 dB/decade, as expected... For the band-pass case, o is the center frequency and the bandwidth (frequency range between the lower cutoff frequency 1 and the upper cutoff frequency 2) is determined by Q, BW 2 - 1 = o Q For the bandpass filter, the ultimate roll-off slope is -20 dB/decade on either side of the center frequency (its still second-order, but the roll-off rate is split because there are two roll-offs!). There are many active filter topologies (basic circuit layouts) that are possible, but in practice, only a few are actually used. Since we can only consider the most common type within the scope of this course anyway, lets get on with it! The most commonly used filter is probably the low-pass, and the most common implementation is the voltage-controlled-voltagesource (VCVS), or Sallen and Key , filter. The simplest type of the Sallen and Key filter is the unity-gain version shown in Figure 11 below, along with a corresponding RLC filter (non-unity gain versions will not be considered within the scope of EE122).

SAME RESPONSE BUT DIFFERENT PARTS!

Figure 11: comparison of the second-order Sallen and Key low-pass filter section and a corresponding RLC low-pass filter. It should be noted that the op-amp does not replace the inductor, but merely produces a transfer function that is equivalent to the RLC filters transfer function.

The Sallen and Key circuit uses a single op-amp, two capacitors and two resistors to obtain a second-order transfer function. Since this is a unity-gain circuit, it does not amplify signals within the passband (desirable in many applications).

THE SCALABLE FILTER A very practical design method for such filters is to use a normalized or scalable filter stage and scale the component values to obtain the desired damping (d is typically used in the design books... just remember that it is 1/Q) and cutoff frequency. A Sallen and Key low-pass filter normalized to a cutoff frequency of 1 KHz and an input resistance of 10 K is shown in Figure 12 below.

0.016 2Q F

Vin

10 K

10 K

Vout

0.016 F 2Q

Figure 12: A unity-gain, Sallen and Key low-pass filter stage normalized to a cutoff frequency of 1 KHz, and a resistance of 10 K .

The capacitor values are usually shown in terms of 2Q since the locations of the poles are given (in terms of R and C) by, P1,2 = - o jo 2Q 11 2Q 2

Scaling the filter (EASY!) is accomplished as follows:


THIS IS SOME VERY PRACTICAL INFORMATION.... PLEASE CHECK IT OUT!

To scale to a new cutoff frequency, first compute the ratio of the old to the new cutoff frequency. Then either multiply the resistances by this ratio or multiply the capacitances by it (just think in terms of scaling the RC time constant up or down!). To scale to a new impedance (without altering the RC time constants), first compute the ratio of the new to the old impedance. Then multiply all resistances by the ratio and divide all capacitances by it. Then all you have to worry about is the degree of peaking you want... Just scale the components with values given in terms of Q on the schematic (capacitors for low-pass, resistors for high-pass, and resistors for the bandpass example used here) to get the Q you want! Simple! As an example, we will examine the design of a second-order low-pass maximally-flat filter with a cut-off frequency of 300 Hz, and resistance normalized to 1K (we could normalize to whatever resistor values are around in lab, 1K is used here for simplicity). Such a filter could be used to select the bass frequencies from audio in order to drive a sub-woofer in a killer stereo system.

How about a worked example?

The resistances should first be normalized to 1K. This means replacing the resistances shown in Figure 12 with 1K resistors and scaling the capacitances to keep the RC time constant the same.... Since the resistances went down ten-fold, multiply the capacitances both by ten... To scale the frequency to 300 Hz from 1KHz, the RC time-constant must be multiplied by the ratio of the frequencies, i.e.,: RCnew = RCold 1000 Hz 300 Hz Since we need to keep the 1K resistor values, you must multiply the capacitor values by this ratio. To get a maximally-flat response, you need to substitute Q = 0.707 into the equations defining the capacitor values in Figure 12 (you multiply the one in the feedback loop by 2Q, and so on...). The final design ends up being that shown in Figure 13 below.
0.753 F

Vin

1 K

1 K

Vout

0.376 F

Figure 13: A unity-gain, Sallen and Key low-pass filter stage scaled to a cutoff frequency of 300 Hz, and a resistance of 1 K .

To test the design, you can use the following SPICE deck (or graphical SPICE entry): 300Hz Sallen and Key LOW-PASS FILTER Vin 1 0 AC 1V R1 1 2 1K Cfb 2 Vout 0.753UF R2 2 Vninv 1K Cg Vninv 0 0.376UF E1 Vout 0 Vninv Vout 100K .AC DEC 20 1Hz 100KHz .PROBE .END You obtain a frequency response as shown in Figure 14 below.

0.707 V

300 Hz

Figure 14: Frequency response of example 300 Hz low-pass filter (plotted on a linear y-axis scale).

If you use the nearest available real capacitor values of 0.68 F and 0.33 F, the cutoff frequency shifts to about 340 Hz but the filters shape is roughly the same. This would be o.k. for some applications, but if accurate cutoff frequency were required, you might have to scale to a different resistance to use the standard capacitors better (you have way more choices of values for resistors than capacitors!). To test the filter designs time-domain performance with a 10 mS, 1V square pulse, change the Spice deck so that the Vin line reads: Vin 1 0 pwl(0 1V 10mS 1V 10.001mS 0V) and replace the .AC line with: .TRAN 100US 30mS The results are shown in Figure 15 below.

Figure 15: Time-domain testing of the example filter.

WHAT ABOUT HIGH-PASS? To obtain the high-pass equivalent to the filter shown in Figure 12, simply swap the positions of the resistors and capacitors, taking note that their values change, as shown in Figure 16 below. The scaling is done exactly as described above.
10 K 2Q

Vin
0.016 F 0.016 F 10 K 2Q

Vout

Figure 16: Unity-gain, Sallen and Key high-pass filter stage normalized to a cutoff frequency of 1 KHz, and a resistance of 10 K .

These people are so dumb, it makes me want to chuck my cookies! Even doing my EE122 Prelab would be better than this!

Gee Bill, I hear you traded in your BMW for a low-pass filter! Biff and I think it might be better to go for a notch filter.... we heard they were more exclusive...

Yuppies sometimes get the idea that a filter is a status symbol...

BANDPASS ANYONE? The type of bandpass filter described below is not a Sallen and Key type. It is called the multiple-feedback bandpass7. This circuit is shown in Figure 17 below, and implements the second-order BPF equation shown above (in Figure 10), normalized to 1 KHz.

0.016 F 10 K 2Q 10 K 2Q

Vin
0.016 F

Vout

Figure 17: Multiple-feedback bandpass filter with a 1KHz center frequency.

This circuit can be scaled up or down in impedance and frequency as described above for the low-pass filter. It should be pointed out that this circuit has a gain of -2Q2 at the center frequency (which means that you might have to use an input attenuator for large signals and high Qs). Also note that the op-amp must have an available gain of at least 20Q2 at the center frequency to avoid distortion (i.e., take GB product for op-amp, divide by the center frequency, and you should have at least 20Q2 gain available).
7

Sallen and Key bandpass filters can be built, but they have some limitations in terms of tuning and the requirement of a high op-amp gain bandwidth product.

ALL-PASS? MAYBE IN LIBERAL ARTS. THIS IS EE! The last filter to be covered here is the all-pass filter. It passes all frequencies equally, but shifts the phase of the input signal with frequency, from 0 at low frequencies to -90 at the center frequency ( o = 1 ) to -180 at higher frequencies. Such filters are sometimes used to equalize the delay in communications systems (since delay is really the same thing as phase shift, after all). A simple all-pass filter circuit is shown in Figure 18 below. R V
in

RC

R Vout

R C

Figure 18: A simple op-amp all-pass filter circuit.

The transfer function of the circuit shown above is, T S = 1 - SRC 1 + SRC (This is not really a scalable filter... it is simpler: just choose the RC time constant for the center frequency and make all of the resistors the same value.) If you are not convinced that the gain is really one for all frequencies, substitute j for S in the above equation and determine the magnitude.

MORE COMPLEX FILTERS As mentioned above, more complex filters are generally obtained by cascading several second-order sections (perhaps with a firstorder section as well, if an odd order is required). This discussion is intended to provide only a simple overview of these more complex filter types, the design of which is somewhat beyond the scope of EE122. The basic idea is that the poles of these filters are distributed so that the response on the j axis (frequency response) has the desired shape. The classical, maximally-flat filter response is that of the Butterworth filter. This response (an example of which is shown in Figure 19 below) is obtained by arranging the filters poles around the unit circle in the S-plane, at the solutions to the equation, S = - -1
1 n 2n

where n is the order of the filter. The poles end up being located at equal distances from each other around the unit circle.

1.5 1.0 0.5 -1.0 0.0 -3.0 -2.5 -2.0 -1.5 -0.5 -0.5 -1.0 -1.5

Figure 19: S-plane plot of the response of a 6th-order Butterworth low-pass filter. The insets at upper left show the frequency response and pole positions (linear scaling).

The other commonly used complex filter is the Chebyshev type. Here, the poles are arranged around an ellipse in the S-plane to achieve much steeper roll-off than the Butterworth, traded off against ripple in the pass-band. These filters are generally specified in terms of order and ripple, which determine the relative steepness of the slope beyond the cut-off frequency. An example of a Chebyshev filter response is shown in Figure 20 below.

jw
1

0 -1.0 -0.5 0.0

-1

-2

Figure 20: S-plane plot of the response of a 6th-order (0.5 dB ripple) Chebyshev low-pass filter. The insets at upper left show the frequency response and pole positions (linear scaling).

EVEN MORE NERDINESS...


For readers interested in obtaining further information on filter design and implementation, these are several worthwhile references:
Lancaster, D., Active Filter Cookbook, Howard W. Sams & Co., Carmel, Indiana, 1975 Huelsman, L. P., and Allen, P. E., Introduction to the Theory and Design of Active Filters, McGraw-Hill Book Co., New York, New York, 1980

THE COMPARATOR AND THE SCHMITT TRIGGER


A comparator is a basic circuit that is very useful for determining when an input voltage crosses (equals or exceeds) a pre-set reference voltage. The comparator circuit shown in Figure 21 below does this function by swinging its output voltage fully to the positive supply rail when the input voltage vi exceeds the reference voltage Vref. It is easy to see that this circuit is simply the one used in Lab 2 to examine the open-loop behavior of the op-amp, but with sufficiently large input signals to saturate the op-amps output. In other words, the comparator has only two output states!8 This makes it a one-bit analog-to-digital converter!9 Note that comparators can be used in inverting and non-inverting modes depending upon which input, V+ or V- receives the input signal (clearly, the remaining input is connected to the reference voltage). While a precision reference voltage is often generated using a zener diode (or a voltage-reference chip), a voltage divider is often perfectly adequate.

Vref

Vin

Vout

Figure 21: A simple op-amp comparator.

The comparator shown in Figure 21 above can be simulated (using a simulated 741 op-amp in this case) using the following Spice deck, not including the 741 macromodel from Prelab 2, a 1 KHz, 10 V peak sinewave is used as a test input, with results shown in Figure 22 below: 741 Comparator Simulation X1 Vninv Vref 4 5 Vout UA741 Vplus 4 0 12V Vminus 0 5 12V R1 4 Vref 1.4K
In practice, that is. For very small input signals, the op-amp will simply provide an amplified replica of the input signal at its output. For practical op-amps, with gains of over 1 million, this really doesnt happen! It is worth pointing out that an important class of analog-to-digital converter, the so-called flash A/Ds, is made of a series of op-amp comparators, each with a progressively higher reference voltage and all connected to the input signal with their remaining inputs. This results in a thermometer-type output, where, for a given input voltage, all of the comparators below a certain point are ON and those above them are OFF. Digital logic circuits are used to convert this to the binary output of the A/D.
9 8

R2 Vref 0 1.0K Vin Vninv 0 sin(0 10 1000) .TRAN 10uS 2mS .probe .end
15V

0V

-15V 0.0ms V(Vref)

0.5ms V(Vout)

1.0ms V(Vninv) Time

1.5ms

2.0ms

Figure 22: Results of simulating a comparator with the 741 op-amp macromodel. The reference voltage was +5V and the input signal was a 20V P-P sinewave.

Note that the reference voltage was set by the voltage divider made of R1 and R2 to be 5V. A zero-crossing detector is the same circuit, with the reference voltage set to zero volts. It is useful for determining when the input voltage crosses zero in either direction. The Schmitt trigger (shown in Figure 23 below) is a type of comparator that adds a useful feature by the use of positive feedback: hysteresis . This means that there are two distinct threshold voltages that each control either the positive- or negative-going swings of the op-amps output voltage. For example, if the positive-going threshold were 1 V, the output voltage would swing to near the positive supply rail when the input signal exceeded 1 V. If the negative-going threshold were 0.5 V, the output voltage would not swing back toward the negative supply rail until the input signal went below 0.5 V.

R3 V R4
ref

Vout

Vin

R1

R2

Figure 23: The basic op-amp Schmitt-Trigger circuit.

This hysteresis effect can be very useful if you want to use the circuits output signal to initiate some event (such as the horizontal sweep of an oscilloscope) when a threshold is crossed, but do not want noise on the input signal to prematurely swing the output signal the wrong way. This problem was illustrated in the above Spice simulation exercise.10 Design of a Schmitt Trigger (not always easy) of the type shown in Figure 23 involves the selection of the four resistors, R1, R2, R3, and R4. The hysteresis (the upper and lower thresholds) are defined by R1 and R2, and the mean threshold voltage (in the center of the hysteresis curve) is set by R3 and R4. To understand the operation of this circuit, consider that with positive feedback (and no negative feedback to counterbalance it), the output of the op-amp will be at either the positive or negative maximums of its voltage swing (Vsat+ and V sat- , respectively). (As before, since there is no negative feedback, the two op-amp inputs will not be kept at the same voltage by the op-amp!) Once you realize that, you can work out that the voltage at the non-inverting input is given (by superposition), to be:

V + = V out

R1 R2 + V in R1 + R2 R1 + R2

where, as mentioned above, Vout can be either Vsat+ or V sat- . The trip-point or threshold of the overall circuit in each direction of the hysteresis curve is defined by setting V+ equal to the reference voltage set by R3 and R4 and Vout to either Vsat+ or Vsat- . You can then easily solve for the upper and lower thresholds, respectively:

V U = V ref

R1 + R2 R1 - V satR2 R2

and

V L = V ref

R1 + R2 R1 - V sat+ R2 R2

(Note that Vsat- is negative!)

In a way, the 741 op-amp helps minimize the problem illustrated by applying a signal plus noise to the input of the comparator. It is such a slow op-amp that it cannot respond to all of the noise purturbations that would cause multiple output transitions. Faster op-amps can really messup in this situation!

10

A simplified example, with the inverting input (the reference voltage) connected to ground, is given by the following Spice deck fragment and the plot shown in Figure 24 below: X1 Vninv 0 4 5 Vout UA741 Vplus 4 0 12V Vminus 0 5 12V R1 Vinput Vninv 1K R2 Vout Vninv 10K Vin Vinput 0 pwl(0 -10 0.5mS 10V 1mS -10V) .TRAN 10uS 1mS .probe .end You can readily observe from the above plot that the Schmitt Trigger has well defined positive and negative trip-points, as desired. In the example, setting vref = 0V simplifies the above equations (good to remember when designing zero-crossing detectors).

Figure 24: Simulation of a Schmitt Trigger with a 0V reference voltage and upper and lower trip-points of approximately +1.1 and -1.1 V, respectively.

OP-AMP OSCILLATORS
In this section we will consider two of the several types of oscillators that can be built using operational amplifiers. Squarewave, trianglewave, and sinewave oscillators will be considered in some detail, followed by a brief discussion of the other types of waveforms that can be generated using op-amps. LINEAR OR NONLINEAR... THAT IS THE QUESTION There are two basic types of oscillators that can be built with analog components: linear and nonlinear. Nonlinear oscillators turn out to be the easiest to build! This category includes oscillators that rely on saturation or other nonlinear circuit properties to work. Since you should know by now that it is relatively easy to get semiconductor devices to be nonlinear, this should be a piece of cake, right? The most common nonlinear oscillator is the square-wave oscillator, where you simply let the amplifier alternate between its positive and negative maximum output voltage swings (i.e., saturation!). A linear oscillator ideally produces a pure sinusoidal output at a single frequency (hopefully). To achieve linear oscillation, a linear amplifier must oscillate without external stimuli (other than a start-up transient to get it going, perhaps). In order to understand this type of oscillator, a minor excursion into theory (GAK!) will be required (its worth it, since a little bit of intuitive understanding goes a long way!). What is required to make a linear oscillator (that works, that is!) is the arrangement shown in Figure 25 below.

Figure 25: Block diagram of a linear (sinusoidal) oscillator showing a linear amplifier of gain A, and a feedback loop of gain .

A linear amplifier of gain A provides an output voltage vout that is fed through a feedback loop with gain , and summed back into the input of the amplifier. The overall gain of the circuit with feedback, Af(S), is given by, Af S = AS 1-AS S

where S is the Laplacian operator (Hello operator... get me Barneys Burrito Barn please!). Without going into all of the details, but by examining the denominator of the above equation, it is easy to see that the overall gain can be made infinity by setting the round-trip gain around the entire feedback loop so that,

AS S =1 This condition, known to those who care as the Barkhausen Criterion , appears to make the circuit blow up! Actually, it is a necessary condition for this type of oscillator to work. Intuitively, however the fact that the overall gain is infinity means that the output of the circuit is some signal (to be determined!), even with NO input at all! Thus, to make an oscillator, we set the input to the block diagram in Figure 25 to 0V, and let the thing oscillate! If you are clever enough to arrange it so that the Barkhausen Criterion is met at only a single frequency, you will get a very pure sinewave out (if it is met at multiple frequencies, you might get an interesting mix of frequencies). More on this below, after a thrilling look at nonlinear oscillators.

SQUAREWAVE OSCILLATORS: REAL FUN AT LAST OR JUST ANOTHER NONLINEAR CIRCUIT? The square-wave oscillator can be obtained by a simple modification of the alternative Schmitt trigger circuit discussed in the footnote above. All you have to do is add a negative feedback resistor and a capacitor from the inverting input to ground, as shown in Figure 26 below. Noting that the output of the amplifier (given the positive feedback from R1 and R2, will either be at Vsat+ or Vsat-, capacitor C1 will either be discharged or charged through R3. The voltage across C1 will thus either rise or fall exponentially with a time constant R3C1 and be compared against the voltage at the noninverting input of the op-amp, V+. When the voltage on the

capacitor reaches either the positive or negative trip point of the Schmitt Trigger (depending upon whether it is charging or discharging), the output of the op-amp will swing to the opposite maximum voltage, reversing the charge/discharge cycle. As you might have guessed by now, this cycle repeats (you had better have guessed, since we are talking about OSCILLATORS here!). It can be shown that the output frequency is given (approximately) by, fo 1 2 R3 C1 ln 2R1 + 1 R2

R3 C1 Vout R2

R1

Figure 26: An op-amp square-wave oscillator.

If you want a square-wave output of less amplitude than +/- Vsat of the op-amp, you can easily add a potentiometer to the output and use it as an adjustable voltage divider. Another variation on this circuit uses two Zener diodes on the output to limit the voltage swing to the well-defined breakdown voltages of these diodes rather than to the saturation voltages of the op-amp (using diodes to establish well-known voltages instead of the rails is another way to do this).

THE NEAT AND NIFTY TRIANGLE-WAVE OSCILLATOR (BUILD IT YOURSELF FOR PENNIES!) A triangle-wave oscillator can readily be made from a square-wave oscillator by (remember Prelab 2?) integrating its output with an op-amp integrator. Of course, as you know by now, you have to appropriately scale the integrators time-constant to get the desired output amplitude.

SINEWAVE OSCILLATORS There are, as you might have guessed, many ways to make sinewaves! These days, probably the most versatile way to do this is to digitally synthesize them. However, if you need sinewaves of extremely high spectral purity, and may be willing to sacrifice tunability over a wide frequency range, an analog oscillator may be what you need. As discussed above, if the Barkhausen Criterion can be met, one can design a nifty oscillator with only a few components! Continuing with the previous discussion, the overall loop gain must be one (1) and the overall phase shift must be zero (0) (recall the role of compensation capacitors in preventing unwanted oscillations by guaranteeing that the overall gain was kept to less that one when the phase reached zero.) This all sounds good in theory, but in practice, you cant build a circuit with an overall loop gain of exactly one! Component tolerances, temperature effects, etc., limit our ability to do this. What happens in practice is that the gain is somewhat larger than one and the amplitude of oscillations is limited either by the onset of nonlinearity of the circuit (such as decreased gain or clipping) or by some clever gain-control circuit! One of the best known analog sinewave oscillators that takes advantage of this is the Wien Bridge Oscillator, one type of which is shown in Figure 27 below. The basic operating principle behind this type of oscillator is to provide both negative and positive feedback in the same circuit, with the positive feedback slightly larger, and through a tuned circuit make it satisfy the requirements for sinusoidal oscillation. Examination of the circuit in Figure 27 will show that it has a negative feedback circuit consisting of R1 and R2, setting the amplifier gain A to be (for the basic non-inverting amplifier), A = 1+ R1 R2

It can be shown (no, dont worry, you wont have to do the math!) that the positive feedback loop yields, = RC 3RC - j 1 - RC 2

Vout

C R1 R Vout

R2

Figure 27: On the left, the classical Wien-Bridge Oscillator. On the right, the basic Wiener-Bridge Oscillator, formed using four hot-dogs.

Setting A = 1, it becomes apparent that when = 1/RC, is equal to 1/3 (purely ohmic). This occurs at, fosc = 1 2 RC

where the phases of the high-pass (upper) and low-pass (lower) RC stages in the positive feedback loop cancel out. Therefore, if the amplifier gain A is set equal to 3, the Barkhausen Criterion (there, got to mention it again!) is met and the oscillator should oscillate.... Unfortunately, this is rather difficult to do, since it is hard to set the A product to exactly equal one! You can, however, adjust the value of R1, for example, to obtain stable oscillations (at least for a while...).

In the real world, ever-present noise sources tend to help start oscillators such as the one you just designed. In Spice models, sometimes you have to kick-start them with a transient pulse from a voltage (or current) source. This technique is used in this exercise.

The basic Spice deck is shown below (without the 741 macromodel): X1 Vninv Vinv 4 5 Vout UA741 Current pulse Vplus 4 0 15V to "kick-start" Vminus 0 5 15V the oscillator. R1 Vinv 0 ? R2 Vinv 8 ? C1 Vout 7 ? R3 7 Vninv ? C2 Vninv 0 ? R4 Vninv 0 ? Istart Vninv 0 pwl(0 1mA 10us 0V) .model dmod D .TRAN 100uS 8mS 0uS 100uS .probe .end With any luck, you should be able to get some output like that shown in Figure 28 below.

Figure 28: Spice output from the 741 op-amp-based wien bridge oscillator as described above.

If the negative-feedback loop gain is too large, the oscillator will saturate. If it is too low, oscillations will die out. One solution to this amplitude-control problem is the circuit shown in Figure 29 below. The feedback resistor R1 is split into two series resistors, R1a and R1b. Two diodes are connected back-to-back across R1b. Assuming that R1a > R1b, the diodes will begin to conduct only when the output amplitude begins to get too large, shunting current past R1b, and thus automatically reducing the gain of the amplifier. This provides closed-loop control over the gain of the oscillator and greatly enhances its stability.

R1a R1b

Figure 29: Diode-stabilized Wien-Bridge Oscillator.

Think about the design of a diode-stabilized Wien-Bridge Oscillator. All you have to do is realize that you want to split R1 in Figure 27 into the two negative feedback resistors in Figure 29... The idea is to set up the two resistors so that the diodes begin to conduct at roughly the output voltage you want... (You will experiment with this circuit in the lab.)

Exercises - Prelab 3 Work With Your Team


EXERCISE 1: Design a high-pass maximally-flat filter with a cutoff frequency of 30 Hz and resistance normalized to 1K. Obtain its frequency and phase responses using Spice (use an ideal op-amp). In addition, obtain its time-domain response to the 10 mS, 1V square pulse used to test the low-pass filter. Comment. Make up a Spice deck that places your high-pass filter design in series with the low-pass filter design given above in the Prelab text (see Figure 13). NOTE: you have to be careful to rename some of the nodes when you paste the two Spice decks together. This would be an improved sub-woofer driver, preventing speaker damage from near-DC signals. Obtain the frequency, phase and time-domain responses (using the same 10 mS, 1V square pulse for the time-domain stuff) using Spice. Comment.

EXERCISE 2: Design a 1KHz bandpass filter with Q = 10 using the circuit shown in Figure 16 above. Test your design using Spice and the 741 macromodel used in previous Prelabs (obtain the gain and phase responses). (Does the 741 meet the requirement for a gain-bandwidth product of at least 20Q2 at the center frequency?) Given the gainbandwidth product cited by its manufacturer, does the 741 meet the requirement for an available gain of 20Q2 at the center frequency? (You will build this circuit in lab.)

EXERCISE 3: Design an op-amp Schmitt Trigger with a threshold voltage of approximately +5V and upper and lower trip points approximately 2 V on either side of the threshold voltage (i.e., +7V and +3V). Assume that the saturation voltages are +/- 12V and that the voltage divider of R3 and R4 is connected to +12V. Simulate it using the 741 op-amp macromodel in Spice, with the noisy input signal again a 10V, 1KHz sinewave plus a 3 V, 10KHz sinewave (the noise). Replace the input voltage with two sinewave current sources and a 1 resistor! (This is a good Spice trick to know for generating complex waveforms.). If these trip points do not allow you to reject the noise, design another Schmitt Trigger that has appropriate trip points. Obtain a close-up plot to verify the thresholds. Comment.

Try changing the voltage driving R3 and R4 to -12 V. What should the trip points be now? Hint: The trick is to solve for the difference between the upper and lower thresholds, i.e., vU - vL , noting that (for practical purposes) Vsat- = -(Vsat+ ): R1 + R2 R1 R1 + R2 R1 - V sat- V ref + V sat+ R2 R2 R2 R2

V U - V L = V ref which yields,

R1 V U - V L = R2 2V sat+ from which v ref (and hence R3 and R4) can be computed using: R1 R2 R1 + R2 R2

V U + V satV ref =

It is often useful to include some reference voltages in your Spice deck when you want to verify exact voltages. For example, to obtain a 4V and a 6V reference, you could add the following lines: VP6 Vsix 0 pwl(0 6 1mS 6) Rsix Vsix 0 1K VP4 Vfour 0 pwl(0 4 1mS 4) Rfour Vfour 0 1K If you plot these voltages, they will act as reference markers. Note that the "pwl" statements are necessary for .TRAN analysis since DC voltages would all be zero! Likewise, for DC sweeps, the pwls wouldnt work.

EXERCISE 4: Design a 1KHz square-wave oscillator using the above circuit, assuming a 0.047 F capacitor , the use of the 741 op-amp macromodel, and standard11 5% resistor values (see the Standard Component Values sheet on the course website). Simulate your design using Spice.

EXERCISE 5: Design an integrator that will generate a 2V peak-to-peak triangle wave from the output of the 1KHz square-wave oscillator designed above. Hint: the output of the above oscillator will be +/- Vsat ! Simulate your design with Spice using an ideal integrator.

EXERCISE 6: Design a 1KHz Wien-Bridge oscillator (try to use real component values, such as 0.01 F capacitors, since you will have to build it in the lab). Simulate your design in Spice using either an ideal op-amp or an op-amp macromodel of your choosing (e.g., the 741). Can you get it to oscillate?

Welcome to the Real World, folks! Real resistors do not come in 27 values! They are arranged in odd-seeming values that repeat for each decade of values. For 5% tolerance resistors, they are approximately 20% apart in value. Real capacitors come only in rather annoying values, often spaced farther apart than 20%. Dont worry, youll get used to it!
11

EE122 Prof. Greg Kovacs

LAB 3: MORE OP-AMP CIRCUITS!


When all else fails, lower your standards. Anonymous

You will not be told exactly what to put in your write up. The idea is that you present your data and what you learned from it. Typically, you will make plots and analyses a part of the write-up. Write-ups must not be longer than ten pages. If you have questions, please ask. We are here to help!! INTRODUCTION In this lab session, you will have to build and test many of the circuits you designed in the Prelab using a solderless breadboard. BE CAREFUL TO OBSERVE THE CONNECTIONS OF EACH COMPONENT!!! YOU CAN WASTE A LOT OF TIME IF YOU RUSH AND DONT CHECK!

ALWAYS use 0.1 F decoupling capacitors on each power supply rail, right next to each op-amp. Use one capacitor from the positive rail to ground and one from the negative rail to ground. Use 12 V supplies. You may wish to put an input 50 or 51 resistor from the signal generators output to ground so that the amplitudes on the signal generator are correct (they assume a 50 load).

1) This experiment is designed to demonstrate the bandpass filter you designed in the prelab. Determine your circuits frequency response using a 741 op-amp and with an LT1056. Do not measure a large number of data points by hand. You can use the dynamic signal analyzer and a noise source for a quick look and take only key measurements by hand, such as a few measurements in the pass-band, and both 3 dB frequencies. Determine the slope of roll-off for both low and high frequencies.
C2 R2 C1
2 +12V 7 V+ 6 5

V in

R1

LM741
3 + 1 -12V V4

V out

Component locations for the band-pass filter.

Measure the center frequency, the maximum gain and the Q of the filter you designed in the Prelab. To determine Q, plot an amplitude versus frequency curve and determine the frequencies that correspond to the two half power points. Note that the HP35665A dynamic signal analyzer (on the cart in the lab) can automatically generate Bode plots for you. Instead of using its printer, however, you will save the data to disk and then upload it into MATLAB for plotting. Your TA will describe the process during lab. 2) In this experiment, you will test your Schmitt Trigger design.
V in
-12V 3 +

R1

R2
+12V 7 V+ 6 5

R3
2

V out

LM741
1 -12V V4

R4

Component locations for the Schmitt trigger.

Determine the trip points of the Schmitt trigger you designed. Use as input triangular waves from the signal generator. Superimpose the input and output signals on the scope. Try using -12 V as the reference voltage, as shown below. Then try using +12 V. Is there any difference? Try adding some noise to the input signal. How much noise can be present without false transitions at the output of the Schmitt Trigger? You should use the multiple output signal generator (HP 8904A), which can sum multiple signals together.
NOTE Re: HP8904A The 8904A is a four-channel signal generator. Each channel can be set independently to a chosen frequency, phase, amplitude and waveform. These channels can then be fed simultaneously to the same output, the resulting voltage being the sum of the voltage in each channel. Alternately, the output of one channel can be multiplied by that of another, thus providing amplitude modulation (AM). Frequency modulation (FM) can also be achieved using this unit. Such a synthesizer is an important tool for generating test signals to use as inputs to circuits (or to demonstrate test instruments!). An interesting feature of this unit is that the multiple outputs can be summed internally. Remember that the total amplitude of the signal generator (all summed signals) cannot exceed 10V ! Thus, when you add noise, you will have to decrease the amplitude of the triangle wave. Also, be sure to set the output of the signal generator to float.

3) In this experiment, you will test the square- and triangle-wave generators you designed in the prelab. These circuits are key building blocks of analog function generators and music synthesizers. Measure the amplitude, frequency, and duty cycle of the squarewave generator. Use your integrator design to generate a 2 V peak-to-peak triangle wave. Comment on the performance of your design - how perfect do the triangle waves look compared to an equivalent amplitude and frequency waveform from the signal generator? Is there a DC component (offset) in the triangular wave? Is it positive or negative? Turn the system off and on a number of times and see if on each occasion the polarity of the DC component remains the same.

C1

R3
+12V 7 V+ 6 5 3

C2 R5 V out1 R4
2 +12V 7 V+ 6 5

2 -

R2

LM741
3 + 1 -12V V4

V out2

LM741
+ 1 -12V V4

R1

Component locations for the square- and triangle-wave oscillator.

4) This experiment is designed to allow you to explore your Wien Bridge oscillator design. Using a decade box, change R1A and determine over what range of resistance the amplitude-control scheme insures an (apparently) undistorted sine-wave output. Try varying R1A without the amplitude-stabilization diodes and note the range of resistance that allows the oscillator to work. Compare the two and comment. Observe the distortion visually (from the wave shape on the oscilloscope screen) and also with the signal analyzer (connected to vout). If an audio analyzer is available (ask your TA), you can directly measure the distortion in the sinewave. If not, you can estimate by summing the amplitudes of the harmonics and expressing that sum as a percentage of the amplitude of the fundamental frequency. Note that the HP3561A dynamic signal analyzer can automatically calculate the Total Harmonic Distortion (THD).

D1 D2 R2 R 1A R 1B
+12V 2 7 V+ 6 5

D1, D2 are1N4148 or 1N914

LM741
3 + 1 -12V V4

Vout

R Component locations for diode-stabilized Wien-Bridge oscillator.

EE122 Prof. Greg Kovacs

PRELAB 4: INTERFACE CIRCUITS


AAAAAAAHHHHH.... ZZZZZZ..... FTHFPHTHTF..... AAAAAHHHH!!!! EE122 Student Who Tests Circuits with Wet Fingertips

OBJECTIVES (Why am I doing this prelab?)


To investigate some of the electronics to the real world. ways we interface

WHERES MY PRELAB TEXT ??? At this point, you should be working on your projects. Surprise! No prelab text to read!!! While the materials in the lecture notes are sufficient, it would make sense to flip through Horowitz and Hill to investigate some of the many variants of interface circuits. You will notice that the Prelab 4 Exercises are much more design oriented than the previous ones. This trend will continue until your prelabs are, in fact, just your project!

Exercises - Prelab 4 Work With Your Team


EXERCISE 1: Design a low-cost seismic sensor. Start with a block diagram and then move on to a schematic. Simulate the circuit as well as you can (substituting a signal generator for the geophone). The following is a suggested description, but the details are left to you: The first stage should be an amplifier with a variable gain. You may have a rough idea about the signal levels if you played with the geophone during the last lab. If not, dont worry, but be prepared to adjust the gain. The second stage should be a 2nd order low-pass filter (suggested cut-off 30-40 Hz) designed using the Filter Perfect program from Burr-Brown. This program is available on the lab computers, but may also be downloaded from the course website. You may wish to use a Chebychev or a Butterworth type. You may also wish to explain what type you chose, and why. The final stage should be a comparator or Schmitt trigger (your choice) that drives an LED to indicate that the seismic signal has exceeded a threshold that you choose. Simulate as much of the circuit as you can, providing the filters transfer function (gain and phase) and step response, and verifying end-to-end operation all the way through to the comparator output (if you have no idea about the geophone signals, simply choose, and be ready to change your design in the lab if necessary). Turn in a complete schematic showing all component values and types (be sure you can actually build this circuit using parts available in lab). Be sure to consult data sheets to make sure the LED current is within specifications for the op-amp you choose.

EXERCISE 2: Come up with at least two possible project ideas that you and your partner might consider for this courses Final Project. Please include a few sentences of description (functional) of each, and perhaps a simple block diagram of each. These will be evaluated and used to provide helpful feedback.

EE122 Prof. Greg Kovacs

LAB 4: INTERFACE CIRCUITS.


The path to measuring open-loop gain is as narrow as walking the razors edge A Stanford Dali

You will not be told exactly what to put in your write up. The idea is that you present your data and what you learned from it. Typically, you will make plots and analyses a part of the write-up. Write-ups must not be longer than ten pages. If you have questions, please ask. We are here to help!! INTRODUCTION In this lab session, you will have to build and test many of the circuits you designed in the Prelab using a solderless breadboard. BE CAREFUL TO OBSERVE THE CONNECTIONS OF EACH COMPONENT!!! YOU CAN WASTE A LOT OF TIME IF YOU RUSH AND DONT CHECK!

ALWAYS use 0.1 F decoupling capacitors on each power supply rail, right next to each op-amp. Use one capacitor from the positive rail to ground and one from the negative rail to ground. Use 12 V supplies. You may wish to put an input 50 or 51 resistor from the signal generators output to ground if you are using it to test your circuits. This is done so that the amplitudes on the signal generator are correct (they assume a 50 load).

Build the low-cost seismograph circuit you designed in the prelab. This is your first effort to implement a complete system that you have designed. As such, it is up to you to decide how to test the circuits functionality. Below are a set of steps that you should take as suggestions for how to proceed. They are certainly not comprehensive, but should get you started. Remember...have fun! Measure its total noise (give as an RMS value) while the input to the circuit is grounded (no geophone). Verify the filters transfer function, step response, and the entire circuits end-to-end performance as you did with virtual instruments in the prelab. Adjust the front-end gain as necessary. Attach the geophone and test the circuit. Look at the time-domain signal (oscilloscope) and the frequency-domain content (dynamic signal analyzer). Describe your experiments - what can you detect?

EE122 Prof. Greg Kovacs

PRELAB 5: OPTOELECTRONIC CIRCUITS


Its o.k. if we lose money on the product, well just make it up in volume! Harvard MBA Graduate

OBJECTIVES (Why am I doing this prelab?)


To learn about interfaces between the optical world and the electronic world.

WHERES MY PRELAB TEXT ??? At this point, you really should be working on your projects. Surprise! Again, no prelab text to read!!! While the materials in the lecture notes are sufficient, it would make sense to flip through Horowitz and Hill to investigate some of the many variants of optoelectronic circuits. You will notice that the Prelab 5 Exercises are much more design oriented than the previous ones, except for Prelab 4, which is similar.

Exercise - Prelab 5 Work With Your Team


Design an optical data transmitter and receiver. You can use LEDs or lasers as the output devices, and a photodiode or phototransistor as the input device. You must not use more than 20 mA drive current for LEDs. If you use a laser, the drive voltage for the laser module must not exceed 5 V. Your transmitter should frequency-modulate an incoming voltage signal (from a stereo, a microphone, a function generator, etc...) and send out the modulated waveform through the light source of choice. Though you are free to design your own FM block, we suggest using an AD654 (see datasheet/application note on the web). Visible light is probably the best, but you can use IR if you dare... Modulate the light at a sufficiently high frequency that 60 and 120 Hz flicker from room lights will not affect your receiver. Your receiver will not be required to demodulate on its own. The signal analyzer (high frequency) can perform FM demodulation if it is given a clean FM signal. You will have to receive the signal, clean it up (remove unwanted frequencies) and pass it with sufficient energy to the demodulator. Use a transresistance amplifier to capture the light signal - you will only need to pass the AC signal, so you may want to design it so that the DC gain is minimal. The best way to do this is to use a low feedback resistance value (e.g., 10 k), AC-couple using a series capacitor into a second amplifier stage where more gain is provided. Consider using analog filters to fight noise. Flesh out the design, select components, and simulate what you can. Comment on the design tradeoffs you considered - gain, bandwidth, power, etc. Carry out a design review with your partner and, if you can, with another team.

EE122 Prof. Greg Kovacs

LAB 5: OPTOELECTRONIC CIRCUITS.


Is this guy ever bright! One LED talking about another.

You will not be told exactly what to put in your write up. The idea is that you present your data and what you learned from it. Typically, you will make plots and analyses a part of the write-up. Write-ups must not be longer than ten pages. If you have questions, please ask. We are here to help!! INTRODUCTION BE CAREFUL TO OBSERVE THE CONNECTIONS OF EACH COMPONENT!!! YOU CAN WASTE A LOT OF TIME IF YOU RUSH AND DONT CHECK!

ALWAYS use 0.1 F decoupling capacitors on each power supply rail, right next to each op-amp. Use one capacitor from the positive rail to ground and one from the negative rail to ground. If you use a signal generator, you may wish to put an input 50 resistor from the signal generators output to ground if you are using it to test your circuits. This is done so that the amplitudes on the signal generator are correct (they assume a 50 load).

This is your second effort to implement a complete system that you design. Build the opto-electronic FM transmitter and receiver circuit you designed in the prelab. You will probably have to make some modifications to the circuit in the lab. As with last week, we provide you with a few necessary, but not sufficient, suggestions for characterizing your circuit. Have fun! If you are using a laser diode module from a laser pointer, the drive voltage must not exceed 5 V. How far can you transmit before you can no longer detect the signal? Can you estimate the channel capacity? (You will need Shannons Channel Capacity equation from the Lecture Notes) Describe any design changes you made in the lab. obvious from the simulations you did? Why werent they

In addition to your normal lab write-up (which adequately describes the circuit you have built, tests you have run on it, and an evaluation of its performance), please summarize in a few sentences the key points you learned from this exercise, focusing primarily on the design and planning aspects.

EE122 Prof. Greg Kovacs

PRELAB 6: ADDITIONAL CIRCUIT CONCEPTS


If you dont know where youre going, any path will take you there. Unknown

OBJECTIVES (Why am I doing this prelab?)


To learn about oscillators and how to simulate them in Spice.

Exercise - Prelab 6 Work With Your Team


EXERCISE 1: Design and simulate a simple quartz-crystal controlled oscillator. Use the quartz crystal model given in the grab-bag lecture - you may want to adjust the component values to change the frequency. Note, also, that the numbers listed in the lecture do not necessarily reflect a complete set of values for the circuit shown. They are typical values one might find associated with quartz crystals. It may not work at first, and require some effort... You do not need to see sustained oscillations. But, do what is necessary to see transient oscillations at the crystals resonant frequency after a kick-start, and plot this response. Choose any circuit you like, but the simpler the better. Suggestion: see Linear Technology Application Note AN-12, figure 1E (shown below). Other topologies can be found in Horowitz and Hill.

EXERCISE 2: Simulate as much of your proposed EE122 final project circuitry as you can. Acquire the plots that most clearly elucidate the successful simulation of pertinent circuit blocks. Prepare a brief write-up that explains what simulations you carried out.. Prepare TWO transparencies to briefly present your design to the class. (Think: block diagram)

EXERCISE 3: Prepare a plan of action for testing your designed (and now simulated) circuit blocks in the lab this week. Of course you may want to refer to previous labs to be sure you are testing all that you should.

EE122 Prof. Greg Kovacs

LAB 6: ADDITIONAL CIRCUIT CONCEPTS


100 % of the shots you do not take do not go in. Wayne Gretzky

ALWAYS use 0.1 F decoupling capacitors on each power supply rail, right next to each op-amp. Use one capacitor from the positive rail to ground and one from the negative rail to ground. Use 12 V supplies. If you use a signal generator, you may wish to put an input 50 resistor from the signal generators output to ground if you are using it to test your circuits. This is done so that the amplitudes on the signal generator are correct (they assume a 50 load). This weeks lab is simple to describe: Work on circuits relevant to your proposed final project. As has been the trend with Labs 4 and 5, you are left to determine for yourself what this means. But, we will still keep you honest: Prepare a brief (4 - 5 pages) write-up of the experimental work you do in this lab session. Your experiments need not be in the form of a coherent lesson, but the report should be well-organized and complete. Remember: the TAs are there to help you in lab. They will not design and build your circuits for you, but they will give you ideas, places to look for written resources, and insight into what steps you might take to fully test your circuit before integration. And, as always, have fun.

EE122 Prof. Greg Kovacs

PRELAB 7: ENTERING THE HOME STRETCH


Where, oh, where did the prelabs go... now I actually have to worry about my project! Unknown

OBJECTIVES (Why am I doing this prelab?)


To work on my EE122 project.

Exercise - Prelab 7 Work With Your Team (and Another Team)


EXERCISE 1: Carry out a design review on your project with another team. Schedule a time, meet, and review each others designs. Submit a one paragraph note documenting the design review and any suggestions made for both your project as well as the other teams project. Please try to take this seriously and help each other. A little outside opinion can go a long way.

EE122 Prof. Greg Kovacs

LAB 7: THE HOME STRETCH


Were having fun yet. Unknown

Continue to work on circuits relevant to your proposed final project. Prepare a brief (1 - 2 pages) write-up of the new work you do in this lab session (this should be fully distinct from the write-up prepared for Lab 6). We know that you are very busy trying to get your project to work. Experience shows, however, that the time spent carrying out a write-up is saved two-fold during the composition of the Final Report.

You might also like