DSP EA Laboratory

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

Digital Signal Processing for Engineering

Applications

Laboratory Experiments

Prof. Dr. C. Roppel


Dipl.-Ing. (FH) M. Margraf
Faculty of Electrical Engineering
Laboratory for Telecommunications

Contents:

General Information ................................................................................................................ 1 


1  Using the Function Generator and the Oscilloscope ...................................................... 2 
1.1  Check basic settings ............................................................................................................ 2 
1.2  Using BenchVue ................................................................................................................. 3 
1.3  Fast Fourier Transform (FFT) with the oscilloscope .......................................................... 5 
1.4  Aliasing ............................................................................................................................... 7 
2  Sine and Dual Tone Signal ................................................................................................ 8 
2.1  Sine Signal .......................................................................................................................... 8 
2.2  Dual Tone Signal................................................................................................................. 9 
3  FFT and Power Spectral Density ................................................................................... 10 
4  Bearing Vibration Analysis............................................................................................. 12 
4.1  Spectral Analysis ............................................................................................................... 12 
4.2  Envelope Detection ........................................................................................................... 14 
Digital Signal Processing for Engineering Applications Page 1

General Information

 Handle the hardware in the laboratory (the measurement equipment, PCs, cables,
connectors etc.) with care!

 Username and password for the PCs is "student".

 All user files have to be stored in C:\usr. There you will find a subdirectory
DSP_EngineeringApplications, where the files required for this lab are stored.
For your own files (documents, screenshots etc.) create another subdirectory in
C:\usr for your lab group. At the end of each lab session, copy your files on a
USB stick.

Please use a blank USB stick containing no other data. The stick is scanned by the
virus scanner and will generate an alarm, if a virus is detected!

 MATLAB: If you are not familiar with MATLAB, prepare for the lab by studying an
online tutorial (available e. g. at www.mathworks.com). The comprehensive
documentation is available on the PCs (MATLAB online help).

Scilab and Octave are free software packages which are widely compatible with
MATLAB:
Scilab: http://www.scilab.org/
Octave: http://www.gnu.org/software/octave/

 Laboratory report: Each student has to prepare one report. Some hints for the report:

o On the title page include your name, HSM-ID (Matrikel-Nr.) and the date
when you finished the report.

o Describe the experiments concisely and document your measurement results


using tables, a few screenshots from the oscilloscope and MATLAB plots
where applicable. Each Figure has a caption.

o Include the essential part of your MATLAB code.

 Send the report as a pdf document per e-mail to labornt@hs-schmalkalden.de. The


deadline for the report will be announced in the lecture.

Fakultät Elektrotechnik Prof. Dr. C. Roppel


Digital Signal Processing for Engineering Applications Page 2

1 Using the Function Generator and the Oscilloscope


In the lab you work with the HP33120A function generator and the digital oscilloscopes
Keysight DSOX 2002A or Agilent DSO 6032A. The user manual for the HP33120A is
available in printed from in the lab. The user's guide for the oscilloscopes is available on the
PCs in the directory C:\usr\Keysight. Screen shots of the oscilloscope can be taken with the
BenchVue software.

Do not change the language settings (English) of both the oscilloscope and the BenchVue
software.

The following instructions refer to the DSOX 2002A. The operation of the DSO 6032A is
similar; the BenchVue software is used for both oscilloscopes. In the text below, [key]
refers to a key and SK[key] refers to a softkey of the oscilloscope. A softkey is one of the
five keys below the screen. By rotating and pressing the entry knob to the right of the screen
you select entries in the softkey menus. With the round key (Back) to the left of the
softkeys you can step back in the softkey menu.

1.1 Check basic settings

1. Connect the function generator output to channel 1 input of the oscilloscope. Generate a
1 kHz sine wave with amplitude 2 Vpp (peak-to-peak). Press [Autoscale] on the
oscilloscope.

2. Check and correct the following oscilloscope settings:


− Digital voltmeter (DVM) off (DSOX 2002A only):
Key [Analyze]  Softkey SK[Features]  Uncheck DVM
− Probe 1:1:
Key [1] (Channel 1)  SK[Probe]  turn the entry knob to the right of the screen
to select an attenuation factor 1.00: 1
− Signal acquisition normal:
Key [Acquire]  Acquisition Mode SK[AcqMode]  normal
− Set the horizontal scale knob to coarse adjustment (DSOX 2002A only):
Key [Horiz]  SK[Fine]  Uncheck

Fakultät Elektrotechnik Prof. Dr. C. Roppel


Digital Signal Processing for Engineering Applications Page 3

The status line at the top of the display shows the vertical and the horizontal scale settings.
When you followed the previous steps, the vertical scale now is 500 mV/ and the
horizontal scale is 200 µs/.

3. Measure the amplitude (peak-to-peak) and the frequency of the sine signal:
− Key [Meas]  SK[Source]  Select channel 1
− SK[Type]  Select "Peak-Peak" with the entry knob
− SK[Add Measurement]  Select "Frequency" with the entry knob

The measurements of the sine signal should show an amplitude of 2 Vpp and a frequency
of 1 kHz. If the amplitude is too large, the load setting of the function generator has to be
corrected. The function generator has a source impedance of 50 . If the generator is
connected to a 50  load, the amplitude is only one half compared to the case when the
generator is connected to a high impedance load. The generator can be configured for a
50  load or a high impedance load in order to show the correct amplitude. The setting
can be modified in the menu. Press the keys [Shift] [Menu], navigate with the arrow
keys to D:SYS MENU and further to 1:OUT TERM, where you can select either 50 OHM
or HIGH Z. Since the oscilloscope is a high impedance load (approx. 1 M), choose
HIGH Z.
Ua

HP33120A

Upp
Ri = 50 


t
RL Ua

Figure 1-1: The amplitude of the function generator depends on the load impedance RL

1.2 Using BenchVue

1. Start the BenchVue software on the PC.

2. To start the oscilloscope app, double-click on the oscilloscope symbol in the lower right
corner.

Fakultät Elektrotechnik Prof. Dr. C. Roppel


Digital Signal Processing for Engineering Applications Page 4

3. Go to the Screen Image tab. Select "Invert Colors" (otherwise the graphics have a black
background color, which is unfavorable for printing). Click on "Get Current Screen".

4. Click on "Export" or the save symbol in order to save screenshots of the oscilloscope in
various formats.

Fakultät Elektrotechnik Prof. Dr. C. Roppel


Digital Signal Processing for Engineering Applications Page 5

1.3 Fast Fourier Transform (FFT) with the oscilloscope

Measurements in the frequency domain are based on the Discrete Fourier Transform (DFT).
Fast Fourier Transformation (FFT) is a term for algorithms, which allow for a fast and
efficient computation of the DFT. In this section we use the oscilloscopes built-in FFT
function to display the spectrum of the signal.

1. Activate the FFT:


Key [Math]  SK[Operator]  select FFT  SK[Source]  select Channel 1,
SK[More FFT]  SK[Auto Setup] to show the entire available spectrum

On the screen the magnitude spectrum of the signal is displayed. The frequency range
(span) and the resolution are displayed above the softkeys.

Fakultät Elektrotechnik Prof. Dr. C. Roppel


Digital Signal Processing for Engineering Applications Page 6

2. The span depends on the sampling rate. The sampling rate is shown in the upper right
corner and depends on the horizontal scale setting. A horizontal scale of 200 µs/ results in
a sampling rate of 250 MSa/s (Million Samples per second). However, the FFT sampling
rate is usually lower and is related to the span by
FFT sampling rate = 2 times Span
The resolution depends on the FFT sampling rate:
Resolution = FFT sampling rate / Number of samples
Change the horizontal scale and observe how this changes the signal in the time domain,
the sampling rate, the span and resolution of the FFT.

By manually setting the span and the center frequency you can zoom into the FFT (this
was done in the screenshot shown). But this does not change the resolution! With the
knobs to the right of the [Math] key you can change the vertical scale of the FFT.

3. Autoscale the FFT (SK[More FFT]  SK[Auto Setup]). Set the horizontal scale to
200 ms/. The span now is 15.6 kHz (sampling rate 31.2 kHz). The spectral line of the sine
wave at 1 kHz is clearly visible [DSO 6032A: horizontal scale 2 ms/, span 25 kHz,
sampling rate 50 kHz]. Use the cursor to measure the frequency:
Key [Cursors]  SK[Source]  select Source: Math, SK[Cursor]  select X1,
move the cursor in x direction by turning the cursor knob. Move the cursor to the peak,
the frequency is displayed in the cursor box.

4. The FFT vertical units are dBV (Decibel-Volt referenced to an rms voltage of 1 V):
U rms
U dBV  20 log
1V
A sine wave having an rms (root-mean square) voltage of 1 V has an amplitude of 0 dBV.
Use the cursor to measure the amplitude:
Key [Cursors]  SK[Source]  select Source: Math, SK[Cursor]  select Y1,
move the cursor in y direction by turning the cursor knob. Move the cursor to the peak,
the amplitude is displayed in the cursor box.

5. Select different amplitudes at the function generator, and note down in a table the
following values:
 The peak-to-peak amplitude of the function generator
 The calculated rms value
 The calculated dBV value
 The measured dBV value

Fakultät Elektrotechnik Prof. Dr. C. Roppel


Digital Signal Processing for Engineering Applications Page 7

6. When the amplitude of the input signal exceeds the vertical range of the oscilloscope, the
signal is clipped. Increase the amplitude of the function generator until clipping occurs,
while observing the spectrum. In order to see more details in the spectrum, you can switch
off the time-domain signal by pressing key [1] for channel 1 two times.

1.4 Aliasing

1. Adjust the function generator to generate a sine wave with a frequency of 1 kHz and an
amplitude of 2 Vpp. Adjust the horizontal scale of the oscilloscope to 200 ms/, activate
the FFT and select auto setup (SK[More FFT]  SK[Auto Setup]). The span will
be 15.6 kHz [DSO 6032A: 2 ms/, Span 25 kHz].

2. Increase slowly the frequency of the function generator. Wait for a stable FFT display and
watch the peak in the spectrum moving to the right.

3. Increase the frequency beyond 15.6 kHz. Since the FFT sampling rate is 31.2 kHz, signals
above 15.6 kHz will be aliased. Watch the peak, while increasing the frequency
further[DSO 6032A: sampling rate 50 kHz, aliasing above 25 kHz].

4. What happens, if you reach a frequency of 31.2 kHz [DSO 6032A: 50 kHz]? What
happens, if you increase the frequency further?

5. Complete the table below. f0 is the function generator frequency, and FFT frequency is the
frequency of the peak in the spectrum.

6. Select different frequencies at the function generator, and note down in a table the
following values:
 Generator frequency f0
 Effective sampling rate (FFT sampling rate) fs
 FFT frequency (frequency of the peak in the spectrum)
 The difference fs − f0
 The sum −fs + f0

Fakultät Elektrotechnik Prof. Dr. C. Roppel


Digital Signal Processing for Engineering Applications Page 8

2 Sine and Dual Tone Signal


In this experiment we generate a discrete-time version of a sine wave in MATLAB and we
plot the signal. By using the sound card of the PC we can generate an analog signal, which we
can measure with the oscilloscope. Next we generate a dual tone signal, which is composed of
two sine waves having different frequencies and amplitudes.

2.1 Sine Signal

1. Start MATLAB. Try out some commands. Clear the Workspace (enter clear) and the
Command Window (enter clc).

2. Generate a sine wave with frequency f = 1 kHz and amplitude 1,


y(t) = sin(2  f t),
using the function sin(). MATLAB calculates the sine values for predefined times t.
Define the variables f = 1000 and fs = 8000 (sampling rate). Create a vector
t = (0, 1/fs, 2/fs, ...) with a total length of 160000 samples corresponding to 20 seconds.

Hint: Test your MATLAB commands with a few samples first and observe the output. The
output of a command in the Command Window can be suppressed by attaching a
semicolon at the end of the command.

3. Generate a plot including plot labels and axes labels similar to Figure 2.1. Use the
commands subplot(), plot() and stem(). Plot the first 33 samples of the sine
signal.

4. Generate a script file sinus.m containing the MATLAB code developed so far. You can
copy the commands from Command History Window.

5. Clear the Workspace and the Command Window (see above). Run and test the script file
sinus.m.

6. Use the command sound() to send the signal to the sound card (make sure to use the
correct sampling rate). Connect the headphones to the audio output and listen to the
signal. Next, connect the oscilloscope to the audio output.
− Measure frequency and amplitude of the signal in the time domain.
− Measure frequency and amplitude of the signal using the FFT function. Convert the
dBV value of the amplitude to the peak-to-peak value.

More hints: You obtain a more compact output in the Command Window, if you enter the
command format compact.
By default numbers are printed with 6 digits in the Command Window. You
can see more digits if you enter the command format long.
The command close all closes all graphics windows.

Fakultät Elektrotechnik Prof. Dr. C. Roppel


Digital Signal Processing for Engineering Applications Page 9

f = 1 k Hz , fA = 8 kHz
1

0.5

sin(2  f t)
0

-0.5

-1
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
t [s] -3
x 10
1

0.5
sin(2  f t)

-0.5

-1
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
t [s] -3
x 10

Figure 2-1: Plot of the sine signal

2.2 Dual Tone Signal

1. Add a second sine wave to the 1 kHz signal. The second signal shall have the amplitude
A = 0.5 and the frequency f = 1.7 kHz. Again, generate a plot of the first 33 samples.

2. The sound() command assumes that the signal is in the range 1. Larger amplitudes
will result in distortions. Scale your dual tone signal accordingly.

3. Send the signal to the sound card and connect the oscilloscope.
− Measure the frequencies and amplitudes of the two sine signals using the FFT
function.
− Convert the dBV values of the amplitudes to their peak-to-peak values, and confirm
that the ratio is 2:1.
− Calculate the ratio of the amplitudes using the dBV values.

Fakultät Elektrotechnik Prof. Dr. C. Roppel


Digital Signal Processing for Engineering Applications Page 10

3 FFT and Power Spectral Density


A simple method to estimate the power spectral density is the periodogram,

| DFT |

where T = 1/fs is the sampling period. It is calculated as the square of the magnitude of the
discrete Fourier transform (DFT) of x(n):
N 1
S DFT ( k )   x ( n ) e  j 2 π n k / N , k  0 , 1, ..., N  1
n 0

Although the Signal Processing Toolbox of MATLAB provides a function


periodogram(), we will calculate the spectrum using the FFT function in order to
understand how typical spectral plots are generated from the FFT.

The periodogram calculated by means of an N-point DFT is composed of N values spaced


 f = fs /N apart. Each value thus represents the power of the signal in the frequency range  f
(Figure 3-1). All N values represent the spectrum in the frequency range from 0 to fs, so for
the kth value we have
, 0, 1, … , 1

fs /N

Figure 3-1: Each FFT value represents the power in the frequency range  f

In this experiment we will calculate the periodogram of the dual tone signal of Section 2.2.
The power spectral density of a sine signal with frequency f0 and amplitude A is given by

4
2
and its signal power is S = A /2.

1. Use the MATLAB code from Section 2.2 to generate the dual tone signal (frequencies
1 kHz and 1.7 kHz, amplitudes 1 and 0,5, sampling rate 8 kHz). Now the signal shall have
a length of N = 4096 samples. Modify the code accordingly.

2. Calculate the periodogram of the signal. Use the MATLAB function fft() to calculate
the DFT. Plot the whole spectrum over k (k = 0, 1, …, N  1).

3. Plot the whole spectrum over f k (k = 0, 1, …, N  1).

Fakultät Elektrotechnik Prof. Dr. C. Roppel


Digital Signal Processing for Engineering Applications Page 11

4. Determine the maxima of the peaks and their position in the spectrum. Use the values to
calculate the signal power of the two sine signals.

5. Plot the spectrum in Decibels (dB) over frequency in the range 0  f  fs /2.

Fakultät Elektrotechnik Prof. Dr. C. Roppel


Digital Signal Processing for Engineering Applications Page 12

4 Bearing Vibration Analysis


Here we analyse the signals from bearings with different faults available from the Society For
Machinery Failure Prevention Technology (https://mfpt.org/fault-data-sets/). The bearings
have the following parameters:

Revolution per second of the axle: frev = 25 Hz


Number of balls: N=8
Ball diameter: d = 0.235 inch
Average bearing diameter: D = 1.245 inch
Contact angle: =0

The data set can be found in the directory DSP_EngineeringApplications\Fault-Data-Sets. The


structure of this subdirectory is as follows:

1 - Three Baseline Conditions: 270 lbs of load, sample rate of 97,656 sps, for 6 seconds

2 - Three Outer Race Fault Conditions: 270 lbs of load, sample rate of 97,656 sps for
6 seconds

3 - Seven More Outer Race Fault Conditions: 25, 50, 100, 150, 200, 250 and 300 lbs of load,
sample rate of 48,828 sps for 3 seconds

4 - Seven Inner Race Fault Conditions: 0, 50, 100, 150, 200, 250 and 300 lbs of load, sample
rate of 48,828 sps for 3 seconds

5 - Analysis: Data analysis (.m) files provided with the data which we will not use here.

6 - Real World Examples: Data from an intermediate shaft bearing from a wind turbine,
an oil pump shaft bearing from a wind turbine, and a real world planet bearing fault.

4.1 Spectral Analysis

1. Calculate the characteristic frequencies of the bearing:


 Fundamental Train Frequency (FTF)
 Ball Spin Frequency (BSF)
 Ball Pass Frequency Outer Race (BPFO)
 Ball Pass Frequency Inner Race (BPFI)

Fakultät Elektrotechnik Prof. Dr. C. Roppel


Digital Signal Processing for Engineering Applications Page 13

2. The data files are MATLAB binary files (.mat). Copy the file baseline_1.mat to your
working directory. Load the file with load('baseline_1'). In the workspace, you
can see that the file contains a structure "bearing". Double-click on it to open the Array
Editor. There you can see that the structure has four fields:
 sr: the sampling rate
 gs: the signal
 load: the load applied to the bearing
 rate: the shaft rate (frev)

3. Define variables for the sampling rate and the signal:


fs = bearing.sr
signal = bearing.gs;
Don't forget the semicolon after bearing.gs in order to prevent MATLAB from printing
hundred thousands of numbers in the command window. Plot the signal over time.

4. Use the code from Section 3 to calculate the periodogram of the signal. Plot the spectrum
in Decibels (dB) over frequency in the range 0  f  fs /2.

5. The characteristic frequencies of the bearing are at rather low values. Plot the spectrum in
dB over frequency in the range 0  f  500 Hz. For the baseline signals, you will see
spectral lines at frev = 25 Hz and integer multiples.

6. Now repeat steps 2 to 5 for an outer race fault file. Describe the differences you can see in
the time domain and in the frequency domain with respect to the baseline signal. For an
outer race fault, we expect to see a spectral line at BPFO. Try to identify this line (this is
not for all outer race fault files possible).

7. Now repeat steps 2 to 5 for an inner race fault file. Describe the differences you can see in
the time domain and in the frequency domain with respect to the baseline signal. For an
inner race fault, we expect to see a spectral line at BPFI. Try to identify this line (this is
not for all inner race fault files possible).

8. Use the command sound() to send the signal to the sound card and listen to the audio
(make sure to use the correct sampling rate, and scale the amplitude to the range 1).

Fakultät Elektrotechnik Prof. Dr. C. Roppel


Digital Signal Processing for Engineering Applications Page 14

4.2 Envelope Detection

When a ball hits a fault on the outer or inner race, a signal with BPFO or BPFI is generated,
respectively. However this signal modulates signals at other characteristic frequencies. One
method for demodulating these amplitude modulated signals is envelope detection. A simple
version is composed of the following signal processing steps:
 take the absolute value of the signal
 apply a lowpass filter
 remove the mean from the signal

1. Design a FIR lowpass filter using the MATLAB function fir1(). Use a filter order of
256 and a cutoff frequency of 1000 Hz (note that MATLAB uses a normalized frequency
range 0 … 1, where 1 corresponds to fs /2). Plot the impulse response (i. e. the filter
coefficients) of the filter.

2. Plot the transfer function of the filter using the function freqz().

3. Take the absolute value of the bearing signal (function abs()) and filter this signal using
the lowpass filter (function filter()).

4. Remove the mean from the signal (use the function mean() to calculate the mean).

5. Calculate the periodogram of this signal using the code from Section 4.1. Plot the
spectrum in dB over frequency in the range 0  f  500 Hz.

Fakultät Elektrotechnik Prof. Dr. C. Roppel

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy