ELEC 320, Fall 2007
Profs. Nepal & Kozick

Laboratory 6

Using the FFT on the Oscilloscopes,
A/D and D/A Procedures, and Design Project


One objective in this lab is to learn how to use the Fast Fourier Transform (FFT) capabilities of the oscilloscope to analyze the frequency content of signals. The other objective is to learn how to use the A/D and D/A capabilities in the labs. Finally, the design project for this course will be introduced.

A formal report is not required for this lab. However, before leaving lab today, you must demonstrate to the lab instructor that you can use the FFT on the oscilloscope and perform A/D and D/A conversion.

1. Using the FFT on the Oscilloscope

Begin by connecting the function generator to the oscilloscope. Set the function generator to produce a sine wave with amplitude 100 mV and frequency 1 kHz. Display the sine wave on the oscilloscope, and save this "time-domain" view of the signal as setup 1 using the SETUP key on the scope.

We can display the sine wave in the "frequency domain" using the FFT function on the oscilloscope. Instructions will be provided in lab. Familiarize yourself with the various items that can be specified for the FFT display, such as the scaling of the horizontal axis (frequency), and the format of the vertical axis (linear or logarithmic = dB). For the WINDOW option, please choose "Hanning." Save this "frequency-domain" view of the signal as setup 2. Now you can view signals in the time-domain by recalling setup 1, and setup 2 will produce a frequency-domain view of the signal.

Please do the following exercises.

The FFT is an important and useful tool to analyze the frequency content of signals. You should now be able to use the oscilloscope to perform the FFT operation.

Note: The DTMF code is for wireline phones. You may want to test your cell phone to see what tones are used when you dial.

2. A/D and D/A Procedures in Dana 307

Analog-to-digital (A/D) and digital-to-analog (D/A) conversion circuits are important in the analysis of signals and systems. The computers in Dana 307 contain Keithley A/D and D/A cards (some of the other EE labs have similar cards). We would like you to know how to use these cards with Matlab in case you need them for your design project in this course.

The following procedure is used for the Keithley cards.

  1. Use the function generator to apply a sine wave with frequency 1 kHz and amplitude 3 V to channel 1 of the A/D card. Input channel 1 is pin 32 (+) and pin 14 (-). This is a differential input, so pin 17 (ground) should be connected to pin 14. The card has a total of 8 input channels, and you can use the other channels for your project.

  2. The Matlab commands to access channel 1 of the A/D card are as follows.
    >> ai=analoginput('keithley')
    >> addchannel(ai,1)
    >> set(ai,'SampleRate',fs)
    >> set(ai,'SamplesPerTrigger',NS)
    >> start(ai)
    >> data=getdata(ai);
    >> point=getsample(ai);
    >> stop(ai)
    >> delete(ai)
    The getsample command will get one sample. The getdata command will get a vector of NS samples. It is usually not necessary to use both commands.

    The following Matlab function conveniently combines these commands:

    get_sig.m
    To run this function, save the get_sig.m file in your folder. Then from the Matlab command window, you can type, for example,
    >> x = get_sig(2000, 4000);
    This will get 4,000 samples from the A/D card with sampling rate 2,000 samples per second.

  3. Collect some samples of the sine wave in Matlab, and produce a plot of the samples versus time, labeled in units of seconds. Make sure your sampling rate is greater than 2,000 samples/sec (why?)! Change the amplitude and frequency of the sine wave, and check the calibration of the A/D card.

  4. The Matlab commands to access channel 1 of the D/A card are as follows. Pin 35 is the output from D/A channel 1. You can connect pin 35 to the oscilloscope (and connect ground).
    >>ao=analogoutput('keithley')
    >>addchannel(ao,1)
    >>set(ao,'SampleRate',Fs)
    >>putsample(ao,level)
    >>putdata(ao,data)
    >>start(ao)
    The putsample command will set the output to a constant value of level volts. The putdata command will output the data vector. It is usually not necessary to use both commands.

  5. Generate constant signals with 2.5 V, 5.0 V, and 10 V, and observe them on the oscilloscope. (Use the putsample command.) Also, use the D/A to output the sine wave samples that you obtained from the A/D in step 3. (Use the putdata command.)

You can also use the soundcard on the PC to sample and output signals. These are most convenient for audio signals. You can access the soundcard from Matlab with the commands

>>ai=analoginput('winsound')
>>ao=analogoutput('winsound')
Try to record a sentence using the soundcard and microphone, and then play the sound back at twice and one-half the original sampling frequency.

3. Design Project

Browse Lab 7 and begin to formulate ideas for your design project. Please describe your plans for the project in lab on October 24 or 25.

Thank you.