6
INTEGRATIVE HANDS-ON PROJECTS IN CONTINUOUS AND DISCRETE TIME SIGNAL PROCESSING A. A. (Louis) Beex and Avik Dayal ECE, Virginia Tech, Blacksburg, VA 24061 ABSTRACT To reduce its abstractness level, a couple of hands-on projects have been introduced recently to our Junior level Continuous and Discrete System Theory course. For several years our students have been supplied with their own Lab- in-A-Box kit that facilitates them experimenting on their own, at their own pace. This made it possible for them to design and build a reasonably practical bandpass filter out of analog components, with the idea of measuring and influencing filter performance towards certain goals. Most recently a discrete time filtering experiment was added to the course, based on sampling of the earlier continuous time filter. In observing and explaining what is happening, the students achieve a better understanding of the sampling concept itself, as well as getting comfortable with the idea that (some) continuous time filters can be very well approximated by digital filters. Index Terms— Continuous time filters, Lab-in-A-Box, Discrete time filters 1. INTRODUCTION The introduction of the Lab-in-A-Box (LiAB) kit at Virginia Tech (each EE student has one) has made it possible for students to do hands-on experiments with analog and digital circuits on their own, and at their own pace. LiAB contains resistors, capacitors, inductors, Op- Amps, logic chips, etc, as well as a multi-meter, a function generator, and a software based oscilloscope. While initial usage started in the early circuits and electronics courses, the LiAB environment is quite capable of allowing something a little more complex to be implemented, such as a system or filter. We report on the continuous time hands- on project as part of a paper on closing the design cycle [1]; that coverage is extended, and the corresponding discrete time hands-on project added, as well as the linking – through the sampling process – between the continuous time and discrete time domains. In our Continuous and Discrete System Theory (CDST) course, a la [2], we start with an analog circuit, use the element equations and Kirchoff’s laws to derive the governing integro-differential equation, turn it into a differential equation, and use one-sided Laplace transforms to find zero-state, zero-input, and impulse responses, as well as transfer functions. Analyzing at the level of the transfer function brings us to frequency response, its connection with poles and zeros, and the specific systematic way frequency response is represented in Bode plots. At this juncture, by changing parameters, one can move towards designing a filter with certain specifications in mind. Next come synthesis and implementation, the reverse of the earlier analysis process. After convincing the students that implementation in terms of differentiators is not such a good idea, the governing transfer function is expressed in parallel, cascade, and feedback configurations, consisting of integrators, summers, and multipliers. Implementation of the latter is shown in terms of Op-Amp circuits, essentially the analog computer of yore. The students can build the system on the breadboard in LiAB, and use their software oscilloscope to measure magnitude and phase of its frequency response in terms of Bode plots. The next two-thirds of CDST consists of revisiting systems and their properties in the discrete-time domain, drawing extensively on the almost equal wording to express the concepts for continuous and discrete time. Differential becomes difference, Laplace becomes Z, zero-input and zero-state are the same in words, impulse response becomes unit pulse response, and transfer function becomes system function; sometimes the usage of a slightly different wording is helpful for keeping the concepts separated between continuous-time and discrete-time. The latter is needed to get and keep clarity of what happens when sampling continuous-time signals. So, while Nyquist sampling was mentioned in an earlier course, it is revisited here in detail. The second hands-on project in CDST involves finding the impulse-invariant digital filter corresponding to the continuous-time filter that was designed in the first hands-on project. Subsequent to finding the digital filter, a finite impulse response (FIR) approximation is determined and implemented. For the latter, a Texas Instruments TMS320C5505 eZdsp USB Stick is used; this allows the students to have a physical device-based filtering experience with great similarity to the LiAB experience. The hope is that, in using the analog filter as a starting point and carrying it through the sampling process into the digital filtering domain, the student gains an appreciation for the interconnectedness and usefulness of both domains. 302 978-1-4799-1616-0/13/$31.00 ©2013 IEEE DSPSPE 2013

[IEEE 2013 IEEE Digital Signal Processing and Signal Processing Education Meeting (DSP/SPE) - Napa, CA, USA (2013.08.11-2013.08.14)] 2013 IEEE Digital Signal Processing and Signal

  • Upload
    avik

  • View
    214

  • Download
    1

Embed Size (px)

Citation preview

INTEGRATIVE HANDS-ON PROJECTS IN CONTINUOUS AND DISCRETE TIME SIGNAL PROCESSING

A. A. (Louis) Beex and Avik Dayal

ECE, Virginia Tech, Blacksburg, VA 24061

ABSTRACT

To reduce its abstractness level, a couple of hands-on projects have been introduced recently to our Junior level Continuous and Discrete System Theory course. For several years our students have been supplied with their own Lab-in-A-Box kit that facilitates them experimenting on their own, at their own pace. This made it possible for them to design and build a reasonably practical bandpass filter out of analog components, with the idea of measuring and influencing filter performance towards certain goals.

Most recently a discrete time filtering experiment was added to the course, based on sampling of the earlier continuous time filter. In observing and explaining what is happening, the students achieve a better understanding of the sampling concept itself, as well as getting comfortable with the idea that (some) continuous time filters can be very well approximated by digital filters.

Index Terms— Continuous time filters, Lab-in-A-Box, Discrete time filters

1. INTRODUCTION The introduction of the Lab-in-A-Box (LiAB) kit at Virginia Tech (each EE student has one) has made it possible for students to do hands-on experiments with analog and digital circuits on their own, and at their own pace. LiAB contains resistors, capacitors, inductors, Op-Amps, logic chips, etc, as well as a multi-meter, a function generator, and a software based oscilloscope. While initial usage started in the early circuits and electronics courses, the LiAB environment is quite capable of allowing something a little more complex to be implemented, such as a system or filter. We report on the continuous time hands-on project as part of a paper on closing the design cycle [1]; that coverage is extended, and the corresponding discrete time hands-on project added, as well as the linking – through the sampling process – between the continuous time and discrete time domains.

In our Continuous and Discrete System Theory (CDST) course, a la [2], we start with an analog circuit, use the element equations and Kirchoff’s laws to derive the governing integro-differential equation, turn it into a differential equation, and use one-sided Laplace transforms

to find zero-state, zero-input, and impulse responses, as well as transfer functions. Analyzing at the level of the transfer function brings us to frequency response, its connection with poles and zeros, and the specific systematic way frequency response is represented in Bode plots. At this juncture, by changing parameters, one can move towards designing a filter with certain specifications in mind.

Next come synthesis and implementation, the reverse of the earlier analysis process. After convincing the students that implementation in terms of differentiators is not such a good idea, the governing transfer function is expressed in parallel, cascade, and feedback configurations, consisting of integrators, summers, and multipliers. Implementation of the latter is shown in terms of Op-Amp circuits, essentially the analog computer of yore. The students can build the system on the breadboard in LiAB, and use their software oscilloscope to measure magnitude and phase of its frequency response in terms of Bode plots.

The next two-thirds of CDST consists of revisiting systems and their properties in the discrete-time domain, drawing extensively on the almost equal wording to express the concepts for continuous and discrete time. Differential becomes difference, Laplace becomes Z, zero-input and zero-state are the same in words, impulse response becomes unit pulse response, and transfer function becomes system function; sometimes the usage of a slightly different wording is helpful for keeping the concepts separated between continuous-time and discrete-time. The latter is needed to get and keep clarity of what happens when sampling continuous-time signals. So, while Nyquist sampling was mentioned in an earlier course, it is revisited here in detail. The second hands-on project in CDST involves finding the impulse-invariant digital filter corresponding to the continuous-time filter that was designed in the first hands-on project. Subsequent to finding the digital filter, a finite impulse response (FIR) approximation is determined and implemented. For the latter, a Texas Instruments TMS320C5505 eZdsp USB Stick is used; this allows the students to have a physical device-based filtering experience with great similarity to the LiAB experience.

The hope is that, in using the analog filter as a starting point and carrying it through the sampling process into the digital filtering domain, the student gains an appreciation for the interconnectedness and usefulness of both domains.

302978-1-4799-1616-0/13/$31.00 ©2013 IEEE DSPSPE 2013

2. CONTINUOUS TIME FILTERING The students are presented with the diagram in Fig. 1 (a bi-quad active filter [3]), and asked to derive the governing transfer function. While some recognize that this is an interconnection of integrators, summers, and multipliers, and use the connected subsystem idea to determine the overall system function, others see it as a circuit diagram, to which element equations, Kirchoff’s laws, and ideal Op-Amp relations can be applied.

Fig. 1 Continuous-time filter diagram.

Either way, the resulting transfer function is

2

2

1

1 1G

B F

sR C

H ss s

R C R C

(1)

so that center frequency, 3 dB bandwidth, and max gain

correspond to 1

FR C

, 1

BR C

, and 1

B GR R

respectively. The students choose element values in order to produce a bandpass filter with a center frequency of 2.5 kHz and a 3 dB bandwidth of 1.5 kHz. Figure 2 shows a LiAB implementation of the above filter.

Matlab simulation is used before implementation, perhaps to experiment with different choices for component values as well as to have a preliminary idea of what to expect from the physical implementation.

Figure 3 shows the results from simulation, based on design values as well as based on measured component values, in comparison with the Bode plot measurements taken by the software controlled LiAB function generator and oscilloscope. The implementation is seen to produce a filter that performs very close to what is expected in theory.

Working in teams of two, students then cascade their respective LiAB implementations, perhaps with a buffer amplifier in between, and measure the Bode plots, in order to observe – and explain – what is happening.

Fig. 2 LiAB implementation of bi-quad filter.

102

103

104

105

-40

-30

-20

-10

0

Mag

nitu

de (

dB)

Single Section Magnitude Response

102

103

104

105

-200

-100

0

100

Pha

se (

deg)

Frequency (Hz)

Single Section Phase Response

Design - w ideal component values

Design - w measured component values

Implementation - measured

Fig. 3 Simulated and measured frequency responses.

The sharpened filter has the same center frequency, a narrower bandwidth, and steeper roll-offs (now 40 dB/dec).

The final challenge is to use a cascade of two filters as in (1) for the design of a POTS (plain old telephone system) bandpass filter: with a passband from 400 to 3400 Hz over which the ripple remains within ±0.75 dB, while rejecting everything outside of the passband as much as possible.

After some experimentation, preferably in Matlab, most students find that keeping the Q factor constant results in the Bode plot magnitude shape remaining constant when the center frequency is changed and that this helps in producing a balanced ripple in the passband. Other students stay with the idea of the sharpening filter, keep the center frequencies the same, and change (increase) the bandwidth to cover the POTS frequency range. While the latter results in a reasonable bandpass filter it does not maximally reject frequency content outside of the passband. Maximal rejection comes from maximizing Q for both sections and adjusting center frequencies until the ripple of ±0.75 dB is seen between the center frequencies; that way the resonant

303

behavior of the sections – after adjusting overall gain – pushes the 40 dB/dec roll-offs down when still close to the POTS passband range. Figure 4 shows a typical result for the latter type of implementation.

102

103

104

105

-80

-60

-40

-20

Mag

nitu

de (

dB)

POTS Bandpass Magnitude Response

102

103

104

105

-200

-100

0

100

200

Pha

se (

deg)

Frequency (Hz)

POTS Bandpass Phase Response

Design - w ideal component values

Design - w measured component values

Implementation - measured

Fig. 4 POTS filter frequency responses.

Generally, good correspondence between Matlab simulation and LiAB implementation is found. In Fig. 5, the passband requirements are seen to be more than met, with total ripple closer to 1 dB rather than 1.5 dB. Allowing a slightly larger passband ripple could produce better stopband rejection.

103

-22.5

-22

-21.5

-21

-20.5

-20

Mag

nitu

de (

dB)

Frequency (Hz)

POTS Bandpass Magnitude Response

Design - w ideal component values

Design - w measured component values

Implementation - measured

Fig. 5 POTS filter passband response close-up.

From a practical point of view, students will notice that the passband gain is suppressed, as the first filter in the cascade still needs its dynamic range to avoid saturation, while its passband is located in the roll-off region of the second filter in the cascade. As a consequence ~20 dB of dynamic range is used internal to the POTS cascade which leads to running into the dynamic range limitations of the LiAB Bode plot measurements, as seen in Fig. 4 in the 20-40 kHz range (Note that the same ~35 dB dynamic range limitation is

discernible in Fig. 3 – barely, after zooming in – when approaching 100 kHz).

Using an MP3 device or CD player, together with a couple of buffer Op-Amps, students can listen to voice plus music and experience the filtering effect of their implementation. In a limited way, this brings their frame of reference closer to the magical one of their day-to-day listening experience. The speech coming out of their implementation turns out to be quite understandable, while higher frequency contamination has been reduced.

Most students feel positive about this experience, while many express frustration about the amount of time it takes to bring everything to working order.

3. DISCRETE TIME FILTERING

Even though the students have encountered Nyquist sampling in a prerequisite course, it is covered again in detail. So when the discrete time fundamentals have been covered, and the time comes to design a digital filter and implement it, the students have the necessary background as well as the experience of the continuous time filter project above. To make a connection with the world known to them, the students are instructed to design a discrete time filter using the impulse invariant process. The analog filter they start with is their POTS bandpass filter design. The approach is to find the partial fraction expansion (PFE) of

cH s for their design, for which they can use Matlab as

long as they verify its correctness. The partial fraction expansion naturally lends itself to sampling and Z-transformation of individual factors, the result of which is then readily interpreted as a parallel configuration of subsystems with transfer functions that can be evaluated

readily. The students plot jH e and jH e for

0,3 using a linear frequency scale, for 16 .sF kHz

For comparison, in the same plots, they need to show

cH j and cH j , where the x-axis is

0,3sT , i.e. normalized w.r.t. the sampling frequency.

Figure 6 shows the phase response results. Students will notice similarity in the phase plots and a

large difference in scale of the magnitude plots. They soon realize where that difference comes from and then modify the unit pulse response samples by multiplication by sF .

The resulting magnitude plots are shown in Fig. 7. Having plotted over the 0,3 range, students are

guided to realize that the discrete time filter is showing its periodic frequency domain behavior. While bringing the system function in rational form is not necessary to get this far, it is illustrative to determine where the poles and zeros of the discrete time filter are. The latter then shows that impulse invariant design is a direct s-plane to z-plane mapping of the poles but not of the zeros.

304

0 1 2 3 4 5 6 7 8 9 10-4

-3

-2

-1

0

1

2

3

4

frequency (rad/sample)

phas

e (r

ad)

Impulse Invariant Design result - from PFE

analog filter

Fig. 6 Continuous/discrete POTS filter phase (16 kHz).

0 1 2 3 4 5 6 7 8 9 100

0.2

0.4

0.6

0.8

1

1.2

1.4

frequency (rad/sample)

mag

nitu

de

Impulse Invariant Design result - from PFE

analog filter

Fig. 7 Continuous/discrete POTS filter magnitude (16 kHz).

Repeating the impulse invariant design process for 44.1 ,sF kHz yields the results in Figs. 8 and 9, showing a

very close approximation to the continuous time filter response over the Nyquist portion of the frequency range.

0 1 2 3 4 5 6 7 8 9 10-4

-3

-2

-1

0

1

2

3

4

frequency (rad/sample)

phas

e (r

ad)

Impulse Invariant Design result - from PFE

analog filter

Fig. 8 Continuous/discrete POTS filter phase (44.1 kHz).

0 1 2 3 4 5 6 7 8 9 100

0.2

0.4

0.6

0.8

1

1.2

1.4

frequency (rad/sample)

mag

nitu

de

Impulse Invariant Design result - from PFE

analog filter

Fig. 9 Continuous/discrete POTS filter magnitude (44.1 kHz).

To see the extent to which the discrete time filter

satisfies the original POTS filter specifications, in Fig. 10 the magnitude is plotted on a dB scale versus frequency in Hz, while Fig. 11 provides a close-up of the passband.

0 5 10 15 20 25-40

-35

-30

-25

-20

-15

-10

-5

0

5

frequency (kHz)

mag

nitu

de (

dB)

Impulse Invariant Design result - from num/den

Fig. 10 Discrete time POTS filter magnitude in dB.

0.5 1 1.5 2 2.5 3 3.5-5

-4

-3

-2

-1

0

1

2

frequency (kHz)

mag

nitu

de (

dB)

Impulse Invariant Design result - from num/den

Fig. 11 Close-up of discrete time POTS filter magnitude.

305

It is clear from these figures that the passband ripple does not exceed the 1.5 dB allotted for the analog design.

So far we have arrived at a reasonable digital filter. However, the present digital filter is an IIR filter and such filters require careful scaling for successful fixed-point implementation. The latter subject matter is outside of the scope of the CDST course (it is covered extensively in the subsequent DSP & Filter Design course). 4. FIR APPROXIMATION AND IMPLEMENTATION To provide experience with a digital filter, the IIR filter above is approximated with an FIR filter. The FIR filter is determined by truncation to the first N coefficients of the IIR unit pulse response at which the following approximation criterion is met:

0,

max 0.1j jIIR FIR

dB dBH e H e dB

(2)

The resulting FIR unit pulse response is generally 300 to 400 samples long.

In order to successfully use the FIR filtering routine on the DSP, which operates with 2’s complement integer arithmetic, the students prepare appropriate coefficient files. The inputs they desire to use as test signals – to measure and verify the actual responses to known inputs – need to be scaled first to have values between -1 and 1, as seen in .wav files; secondly those values are multiplied by 215 and rounded. The students are informed that the actual range of values that is usable for the input is [-215, 215-1] due to the use of 2’s complement; using a value of 215 is interpreted in the DSP as -215 and that is a very different input value (which turns out to be the exact explanation for some strange nonlinear behaviors). For the unit pulse response the scaling that is used is dividing by gain G, the sum of absolute values of the unit pulse response; the resulting values (which fall well within the unit amplitude range) are then multiplied by 215 and rounded. For correct interpretation, the outputs from the DSP are divided by 215 and multiplied by the gain G.

One of the common test signals is the unit pulse, which is expected to reproduce the unit pulse response that was supplied by the student. As long as the +1 equivalent is avoided, this experiment produces the expected result, almost. As the DSP I/O routine outputs one sample as it takes one sample in, causality dictates that the output sample is the one associated with the previous sample time, i.e. the output appears delayed by one sample.

To capture and experience the utility of the Fourier series concept, the students are asked to use the first 4 non-zero amplitude components of a 400 Hz square wave as a test signal. Figure 12 shows the test signal and the responses from the Matlab FIR simulation and from the DSP.

0 50 100 150 200 250 300 350 400 450 500-2

-1.5

-1

-0.5

0

0.5

1

1.5

2

2.5

sample index

comparison of outputs for various FIR filters - Fs=44.1 kHz

input

MatlabDSP

Fig. 12 Approximate 400 Hz square wave and responses thereto.

As indicated, the DSP response is trailing by one sample. The output clearly does not look like a square wave approximation, even though the 400, 1200, 2000, and 2800 Hz components all fall within the POTS passband. The students are expected to recognize that the distortion seen here is mostly phase distortion. Grasping the effect a linear time-invariant filter has – in steady state – on a combination of sinusoids makes it possible to synthesize that steady state response, thereby providing the explanation for what is observed. Figure 13 shows the one-sample advanced output from the DSP and the synthesized steady-state output.

0 50 100 150 200 250 300 350 400 450 500-2

-1.5

-1

-0.5

0

0.5

1

1.5

2

2.5

sample index

after accommodating one sample delay in DSP results - Fs=44.1 kHz

input

DSP

synthesized

Fig. 13 Reconciliation of observed and steady-state response.

The DSP output is seen to overlap with the synthesized

steady state response based on the magnitude and phase of the frequency response applied to the four Fourier series components. The transient response is visible as the red part of the DSP output and seen to last about 150 samples. As can be understood from the linear convolution sum, the effective duration of the transient corresponds to the memory inherent in the unit pulse response; the latter is

306

shown in Fig. 14 and seen to be essentially over after about 150 samples.

0 50 100 150 200 250 300 350-0.25

-0.2

-0.15

-0.1

-0.05

0

0.05

0.1

0.15

FIR unit pulse response for Fs = 44.1 kHz

sample index

Fig. 14 FIR unit pulse response.

These hands-on projects were intended to make the CDST course less abstract, to guide students towards making connections between concepts, lecture material, and observations in the physical domain; i.e. towards a component of learning that is experiential. Students can then start to own what they learned, cementing a well-rooted foundation upon which to proceed.

5. ASSESSMENT

It is not hard to imagine that a hands-on learning

component is helpful in the struggle to make sense of abstract concepts. However, it is not so straight-forward to design educational experiments that provide quantified direct measures of the (imagined) benefits of adding hands-on experiments versus not adding them. In the long term it may become noticed that there are fewer student complaints about the level of abstractness of a class, and/or fewer instructor complaints about the apparent level of student preparedness for a subsequent class.

For the short term, as these hands-on experiments were introduced in the most recent semester, the decision was made to provide the students with an articulated learning exercise [4]; one in which the students reflected only and specifically on the (two) hands-on experiences in CDST.

To “What did I learn?” responses were the technical topics themselves, being able to relate analysis and implementation techniques and relate analog and discrete domains, becoming more fluent with Matlab, gaining insight into physical and literal effects of filtering on signals, and learning about time management. Hands-on helped transition from cursory knowledge to more in-depth comprehension, which wouldn’t normally have occurred.

To “How, specifically, did I learn it?” most responses were variations of “learned by doing, mistakes were made,

understanding revised, and lessons learned.” Hands-on requires intelligent experimentation, a back-and-forth mixture between thinking and doing.

To “Why does this learning matter, or why is it significant?” responses were that “for some this struggle is the only sort of learning that seems to stick”, you end up learning more than you were hoping for, having to do the work cemented the ideas taught much more than book learning would have, it matters because this is what we’ll be doing after graduation, it’s a bridge from idea to product.

To the final question “In what ways will I use this learning; or what goals shall I set in accordance with what I have learned in order to improve myself, the quality of my learning, or the quality of my future experiences or service?” responses were that theory is often different from practice, so I should try to practice what I’m learning, better now than later; I hope it leaves me well qualified to take technical electives, I need to continue to improve in learning and time management, the method of going about breaking problems down into small ones and pinpointing problems will be used in other classes and future projects, this is a model for my future learning and connected to employment opportunities, I want to incorporate this in everything.

While the articulated learning reflection is not a direct measurement of student achievement, it is clear that at the end of the semester these students had developed an appreciation for the hands-on learning experience in a class perceived as difficult, just theoretical, and without practical real-life benefit. The experience was seen as beneficial.

6. SUMMARY The hands-on experiences described here, one with a continuous time filter implementation and another one with a discrete time filter implementation, are linked through the process of sampling. Taken together, these experiences provide students with visual, auditory, and analytical opportunities to integrate the material they learned in several of the circuits, signals, and systems courses early in their curriculum. Students report benefits from this integrative experience, even though it comes at the expense of substantial effort on their part.

7. REFERENCES

[1] Avik Dayal, Kathleen Meehan, and A. A. (Louis) Beex, “Closing the Design Cycle: Integration of Analysis, Simulation, and Measurement Results to Guide Students on Evaluation of Design,” ASEE Annual Conference, Atlanta GA, 23-26 June 2013.

[2] B. P. Lathi, Linear Systems and Signals, Oxford, 2nd ed., 2005. [3] P. Horowitz and W. Hill, The Art of Electronics, 2nd ed.,

Cambridge University Press, New York, 1989. [4] S. L. Ash and P. H. Clayton, “The Articulated Learning: An

Approach to Guided Reflection and Assessment,” Innovative Higher Education, vol. 29, no. 2, pp. 137-154, Winter 2004.

307