Title: EET 357 Realtime Digital Signal Processing
1EET 357Realtime Digital Signal Processing
2Digital Signal Processing
The applications of electronic technology may be
grouped into two broad categories digital
computation, and signal processing. Signal
processing can be defined as the use of
electrical quantities (current, Voltage, etc.) to
represent other physical quantities of interest
such as position, sound pressure, or light
intensity (or many, many other quantities), and
the processing of these electrical quantities (or
signals) to extract or insert useful
information. Since the electrical signal
represents a physical quantity by analogy, this
is often called analog signal processing.
3Digital Signal Processing
Digital signal processing (DSP) is the confluence
of signal processing and digital computation
electrical signals representing physical
quantities (analog signals) are converted to
sequences of numbers representing those same
physical quantities (digital signals). These are
processed using the techniques of digital
computation to extract or insert useful
information, and may then be converted back to
analog signals. Thus, an embedded digital
computer may be used to replace an analog signal
processing system. Products as diverse as
cellphones and electric motors now contain
embedded computers which are optimized for DSP
algorithms because it allows products to be built
which are flexible and upgradeable.
4Digital Signal Processing
Digital Represented by integers
Signal Carries information
- Sound
- Radio
- Picture
- Position (motion control)
- Etc.
Processing Using or Transforming
5Digital Signal Processing
- Changing or Transforming Information which is
Represented by Integers
Process
6Analog, Continuous Signal Processing
(Realtime)
Input Voltage or Current
Output Voltage or Current
Processed Speech, Music, Position, Etc.
Speech, Music, Position, Etc.
Filter, Amplifier, Etc.
7Digital Processing of an Analog Signal
Input Voltage or Current
(Realtime)
Digital Output Signal
Digital Input Signal
Process
x(t)
y(t)
A/D
D/A
X(n)
Y(n)
Output Voltage or Current
Analog to Digital Converter
Digital to Analog Converter
8Digital Processing of an Analog Signal
(Offline, not Realtime)
Process
x(t)
y(t)
A/D
D/A
X(n)
Y(n)
9Digital Processing of an Analog Signal
Signal Analysis (Realtime)
Process
X(n)
x(t)
A/D
Display
Information About Signal (Spectrum, Statistics, Et
c.)
10Digital Processing of an Analog Signal
Signal Analysis (Offline)
Process
x(t)
A/D
Display
X(n)
11Analog Signals
An analog signal is a Voltage or current (usually
a Voltage) which represents some physical
quantity the instantaneous strength of a radio
field, the instantaneous pressure of air on a
microphone (sound pressure), the position of a
motor shaft, etc. Consider the signal shown at
left.
12Analog Signals
This is a Voltage which represents the sound of
an actor saying There is no Keyser Soze! The
signal can have any value between -1 Volt and 1
Volt. This is a continuous range of Voltage,
with an infinite number of possible values. If
youre viewing the slide show, click on the
speaker icon to hear the sound.
13Analog Signals
The signal exists (has a defined value) at every
value of t between 0 seconds and 1.935 seconds.
This is a continuous time range, with an infinite
number of possible values.
14Analog Signals
Heres a segment of the same signal, magnified.
The Voltage passes through every value between
-0.6 Volts and about 0.7 Volts, while time passes
through every value from 0.2 sec. to 0.205 sec.
This is a continuous signal continuous in
time, continuous in Voltage.
15Digital Signals
To understand digital signals, lets start with
this analog signal and, step by step, convert it
to a digital signal.
16Digital Signals
First, lets magnifiy the signal some more,
looking at a shorter time interval 0.2 seconds
to 0.2004 seconds.
17Digital Signals
Next, apply the signal V(t) to a sample and hold
circuit. This is a circuit which takes a
snapshot of V(t) at regular intervals. Well
take a snapshot 22,000 times per second. This is
a sample rate of 22 KHz or 22,000 samples per
second.
Sample and Hold
Sampled Analog Signal
Analog Signal
18Digital Signals
Heres a simple sample and old circuit. 22,000
times per second, the switch closes just long
enough for the capacitor to charge so that its
Voltage is equal to V(t). Then the switch opens
until it is time for it to close again. While
the switch is open, the Voltage stored on the
capacitor keeps Vs(t) equal to V(t) the last time
the switch closed.
1
Analog Signal
Sampled Analog Signal
Switch closes very briefly, then opens, 22,000
times per second.
19Digital Signals
Heres what the sampled and held Voltage looks
like
20Digital Signals
The next step is quantization. We divide the
input Voltage range (-1 Volt to 1 Volt in this
example into a finite number of increments. To
make things simple, lets divide it into 8
intervals
If, for a given sample,
the quantized value is the integer -2. -2
represents a Voltage 0.25, and any Voltage from
-0.5 V tp -0.25 V is rounded down to -0.25.
Notice that these eight integers can be
represented by 3-bit, 2s complement numbers, so
this is 3-bit quantization.
21Digital Signals
The quantizer produces a sequence of integers,
each one representing the Voltage of one sample.
This sequence of integers is stored in memory for
processing. Each integer has a position in the
sequence
The first sample occupies position 0, the second
position 1, and so on. Each is associated with a
time only by virtue of the sample rate. If the
sample rate is 22,000 kHz, there is a time
interval of 45.5 mS between samples. Sample 0
was taken at t 0, sample 1 at t 45.5 mS, etc.
22Digital Signals
Here again is the sampled and held signal
Voltage.
23Digital Signals
Heres the sampled and held Voltage, quantized to
3-bit resolution. We can improve the resolution
by dividing the Voltage range into a larger
number of smaller steps. We might divide the
range from -1 V to 1 V into 32 segments instead
of 8, a fourfold improvement in resolution This
means using 5 bits to represent each sample.
24Digital Signals
Here again is the sampled and held signal
Voltage.
25Digital Signals
Here again is the sampled and held signal
Voltage, quantized to 5-bit resolution. Notice
that it is much closer to the unquantized
Voltage. The number of bits used in an actual
application depends on the peformance
requirements the most common resolutions are 8,
12 or 16 bits. CD-quality audio uses 16 bit
integers.
26Digital Signals
The sound used in this example was captured with
8-bit resolution, and sounds pretty good. To
hear the same sound quantized with 5-bit
resolution, click the speaker icon
Heres the same sound, at 3-bit resolution
Note the further degradation in quality. Heres
the same sound, at 1-bit resolution
It sounds horrible, but is still understandable.
27Digital Signals
Once an analog signal has been sampled and
quantized, it really exists only as a stream of
integers. These integers arent inherently
associated with times. Even though the samples
from which they are derived are each associated
with a particular time, the quantized samples
only have an index an integer indicating the
position in the stream.
28Digital Signals
Heres the quantized (8-bit) signal, represented
as a sequence of integers.
29Digital Signals
Since the samples dont really exist between
sample times, this is a better way to illustrate
the digital sequence
30Example Analog SSB Transmitter
Heres the block diagram of a simple analog
single sideband transmitter. The phase shifters,
multipliers, oscillator and summer are all analog
sin(wRFt)
functions. Their characteristics are determined
by resistors, capacitors, opamps, and possibly
transistors and inductors. None of these circuit
elements is ideal, and all exhibit variations in
critical parameters..
90 deg. Phase Shift
RF Oscillator
-
USB Output
S
cos(wRFt)
cos(wRFt)
90 deg. Phase Shift
change in critical parameters. This transmitter
is very susceptible to performance degradation
due variations in critical element values.
Audio Input
31Example Analog SSB Transmitter
Another drawback of this transmitter is that
changing to a different form of modulation
requires a hardware change. Switching to lower
sideband
sin(wRFt)
takes a simple change, which could be
accomplished by flipping a switch. Changing to
FM or full-carrier AM would require a different
circuit.
90 deg. Phase Shift
RF Oscillator
-
USB Output
S
cos(wRFt)
cos(wRFt)
90 deg. Phase Shift
Audio Input
32Digital SSB Transmitter
Heres a block diagram of a digital SSB
transmitter. The multipliers, lowpass filters,
synthesizers, and summer are all digital.
Lowpass Filter
cos(wRFt)
USB Output
S
Direct Digital Synthesizer
Direct Digital Synthesizer
DAC
cos(w1t)
sin(wRFt)
sin(w1t)
Lowpass Filter
Since all the functional elements are digital,
their characteristics are ideal and never vary.
The performance of the digital transmitter is
not perfect, but it is perfectly stable and
predictable.
ADC
Audio Input
33Digital SSB Transmitter
The block diagram shown below is probably
implemented as an algorithm executed by a digital
signal processor (DSP) chip, or possibly as
reconfigurable logic.
Lowpass Filter
cos(wRFt)
USB Output
S
Direct Digital Synthesizer
Direct Digital Synthesizer
DAC
cos(w1t)
sin(wRFt)
sin(w1t)
Lowpass Filter
In either case, executing different software
switches the transmitter from USB to LSB, or full
carrier AM, FM, etc. This is often called a
software-defined radio.
ADC
Audio Input
34DC Motor
Heres a simple DC motor. The armature winding
is mounted on a rotating shaft, and suspended
between two magnetic poles. In this motor, the
poles may be permanent magnets or electromagnets.
The shaft also has two contacts, x and y mounted
on it. These contacts
slide along the brushes a and b as the shaft
rotates. Consider the coil rotating, starting
from the horizontal position shown (q 0). The
direction of the current flowing in the rotor
coil is such that the poles repel the portion of
the rotor coil closest to them, making the rotor
turn in the clockwise direction.
DC Power Supply
brushes
-
a
b
coil
Shaft
S
N
x
y
commutator
35DC Motor
As the coil passes through vertical (q 90
deg.), contact y leaves brush b and goes to brush
a contact x moves from a to b. This reverses
the current flowing in the rotor coil, so now
each of the poles attracts the portion of the
rotor coil closest to it, and the rotor continues
turning in the clockwise direction. After
another half revolution, the contacts move from
brush to brush again, reversing the rotor
current, and switching the magnetic force to
repulsion, pushing the rotor in the clockwise
direction. Thus, the rotor current is reversed
every half revolution.
DC Power Supply
brushes
-
a
b
coil
Shaft
S
N
x
y
commutator
36DC Motor
Contacts x and y, along with brushes a and b,
form a commutator. The purpose of the commutator
is to reverse the magnetic field every
half-revolution, so the motor continues to turn.
Otherwise, the rotor would stop as the rotor coil
reached the vertical position.
The sliding action between the brushes and
contacts is obviously subject to wear, due to
friction. It also would exhibit higher
electrical resistance than a permanent
connection. Therefore, the commutator and
brushes are a weakness of this type of motor.
DC Power Supply
brushes
-
a
b
coil
Shaft
S
N
x
y
commutator
37DC Motor
If the stator poles (N and S below) are poles of
an electromagnet, then instead of reversing the
rotors magnetic field every ½ revolution, we
could reverse the stator field by reversing the
stator current. This would make it unnecessary
to reverse the rotor current. Current
could be delivered to the rotor winding via slip
rings, or the rotor winding could be replaced by
one or more permanent magnets. If permanent
magnets were used, no mechanical slip rings or
brushes would be needed. This is an obvious
advantage.
DC Power Supply
brushes
-
a
b
coil
Shaft
S
N
x
y
commutator
38DC Motor
But without some type of mechanical contacts,
what would cause the stator current to reverse at
the correct point in the rotors rotation? Of
course, we would use electronic switches, but how
would they know when to switch? Some sort of
sensor, such as a Hall-effect switch, could be
used to sense the shaft position and reverse the
current at the correct point in the motors
rotation.
The addition of sensors to control the electronic
commutation partially negates the advantage of
eliminating the brushes. Fortunately, theres
another way.
rotor
Shaft
S
N
S
N
commutator
39DC Motor
When the rotor rotates inside the stator, its
magnetic field cuts the stator windings.
Faradays law says this induces an EMF across the
stator terminals. This is called counter EMF, or
back EMF. If the back EMF is converted to a
digital signal, a DSP control algorithm can use
it to generate a running estimate of the rotors
position. This estimate can, in turn, be used to
control the points in the motors rotation at
which the stator current is reversed. No brushes,
no slip rings, and no sensors! Nirvana!
40Spectra of Digital Signals
Two areas in which digital signal processing is
very commonly used are audio or sound, and radio
signals. In both areas, and many others, its
often desirable to know at what frequencies
energy is concentrated in a given signal. Lets
take an absurdly simple example A 1 KHz sine
wave, sampled at 22,000 Hz. Heres the signal.
This view of the signal is called the time-domain
view, because its a plot of Voltage versus
time. Click the speaker to hear it.
41Spectra of Digital Signals
Heres an alternate view of the signal. Its a
plot of power (or energy) density versus
frequency, and is the frequency domain view. It
shows at what frequencies or in what bands of
frequencies the signal power is concentrated.
For our 1 KHz sine wave, the signal power is
concentrated at 1 KHz. (Duh!) This is also
called the spectrum of the signal.
42Spectra of Digital Signals
Heres the time-domain view of a 3 kHz sine wave,
also sampled at 22 KHz. Click the speaker to hear
this signal.
43Spectra of Digital Signals
Heres the frequency-domain view of the 3 kHz
sine wave. Again, the power is concentrated at 3
kHz.
44Spectra of Digital Signals
Heres a more complex signal, created by summing
the two previous signals together. If it got
much more complex, it would be difficult or
impossible to tell by inspecting a time-domain
plot at what frequencies the power was
concentrated. Click the speaker to hear this
signal, and notice that the 1 kHz component is
readily apparent, but its hard to discern the 3
kHz component
45Spectra of Digital Signals
Heres the frequency-domain view. In this view,
both the 1 kHz and the 3 kHz component are
readily apparent.
46Spectra of Digital Signals
Here again is the time-domain view of an actor
saying There is no Keyser Soze! Its virtually
impossible to gain any idea where in the
frequency domain the power is concentrated by
looking at the time-domain view.
47Spectra of Digital Signals
Heres the spectrum of the signal from the last
slide, averaged over the 1.935 second duration of
the phrase. Now its easy to see that nearly all
the power is concentrated in the band from 0 Hz.
to 2 KHz, with a large concentration between 400
Hz. and 600 Hz.
48Spectra of Digital Signals
Zooming in shows clearly where the power is
concentrated.
49Spectra of Digital Signals
Heres the time-domain view of another actor
saying I work for Keyser Soze. Again, little
knowledge of its spectrum can be gained by
inspection.
50Spectra of Digital Signals
Heres the spectrum of the phrase I work for
Keyser Soze. Notice how similar it is to the
spectrum of There is no Keyser Soze!
51Spectra of Digital Signals
Again, zooming in shows clearly where the power
is concentrated.
52Spectra of Digital Signals
Heres the spectrum of There is no Keyser Soze.
(The axis limits have been adjusted)
53Spectra of Digital Signals
Heres the spectrum of There is no Keyser Soze,
shifted upward in pitch by 400 Hz. Click the
speaker to hear it. Notice that it looks very
much like the spectrum in the previous slide, but
has been shifted to the right by 400 Hz.
54Spectra of Digital Signals
Here are the spectra of both the naturally-spoken
phrase and the same phrase shifted up in pitch by
400 Hz, for comparison.
55Spectra of Digital Signals
The process which was used to shift the pitch is
exactly the same as the process for the SSB
transmitter which was presented earlier.
Lowpass Filter
cos(wRFt)
USB Output
S
Direct Digital Synthesizer
Direct Digital Synthesizer
DAC
cos(w1t)
sin(wRFt)
sin(w1t)
Lowpass Filter
This is called the Weaver architecture. An
m-file which implements it is available on the
website, under Matlab links. The simple
spectrum analyzer, which was used to generate the
spectrum plots, is also available.
ADC
Audio Input
56Spectra of Digital Signals
If you would like to experiment with the Weaver
pitch shifter or the spectrum analyzer, download
the m-files and put them in your Matlab work
directory.
Lowpass Filter
cos(wRFt)
USB Output
S
Direct Digital Synthesizer
Direct Digital Synthesizer
DAC
cos(w1t)
sin(wRFt)
sin(w1t)
Lowpass Filter
ADC
Audio Input