ECE 2280 Lab 1: Signals and Frequency

Hello, if you have any need, please feel free to consult us, this is my wechat: wx91due

ECE 2280 Lab 1:

Signals and Frequency

Learning Objectives:

· Understand signals and frequency for a specific speaker circuit.

· Create a magnitude Bode Plot of the circuit through testing.

· Create your own design.

Materials Needed:

· LTSpice

· AD2 or myDAQ

· Breadboard

· 9V battery with connector

· LM386 amplifier

· 0.047uF capacitor

· 270uF capacitor

· 10 ohm resistor

· Speaker

· Additional parts need to be determined based on your idea for Part 3

Laboratory Protocol

Welcome to ECE 2285 labs! Before we begin with our tutorial, it is important to introduce the basic procedures and expectations of these lab sessions. For starters, you may have noticed that every page of this document has a space for you to sign your name and date it. The reason for this is to instill a habit of signing/dating every page in official laboratory notebooks. Although this class does not require students to maintain a proper lab notebook, it will eventually become a regular requirement in later classes.

To receive full credit, you will upload to Canvas each part of this report. You can fill this out electronically or you can print out this document and fill in the blanks wherever indicated. You will also be asked to include any other supplemental documents (e.g., code, hand derivations, screen captures, etc.) and upload those documents also through Canvas.

Please submit a PDF file each time in CANVAS so that the TA may grade it accordingly.  Note that many smart phones have free scanner-to-PDF apps available. Alternatively, Adobe products are freely available to University of Utah students through the Office of Software Licensing (OSL.utah.edu). If you would rather not print out a hard copy, Adobe Acrobat Pro will allow you to type directly into this PDF and then add your code or screen shots to the end of the document. For Mac users, you should be able to accomplish the same thing with Preview.

Students are strongly encouraged to work together and help each other solve problems. However, each student must also perform their own work for each lab submission. That includes simulations, building circuits, taking data, writing code, submitting results, etc. Simply copying/pasting other people's work is plagiarism, and it may result in course failure.

Remember that your TA is here to help you. If you get stuck, need help, or have any other concerns, always feel free to ask questions!

Introduction

In this lab you will measure and the plot the amplification or "gain" of a speaker circuit as a function of frequency and modify your circuit with your own design.  This measure of gain expresses the transfer function of a circuit as a multiplication factor that is the size of the output voltage divided by the size of the input voltage.  If we have several amplifiers connected in series, we can find the overall gain by multiplying the gains of the individual amplifiers.  This, in turn, allows us to treat amplifiers as building blocks characterized by their gains.

We are all familiar with gain controls as the volume control of an audio system.  In this lab you will measure the gain of a simple audio system.  The gain varies, however, with the frequency of the input signal.  When we say "frequency response" we will talking about sinusoidal signals.  In music, the sinusoids are musical notes.  Sinusoids are the natural signals to use when talking about sounds.

What is remarkable about sinusoids is that every waveform may be represented as a sum of sinusoids.  Furthermore, if we have a linear system and measure the gain for every frequency of sinusoid, we have a complete characterization of the system.  We invoke superposition to say that the response of the system is a summation of its responses to all the sinusoids in the input signal added together.

Another idea you will explore is how to plot signals that vary dramatically in amplitude and frequency on a single plot by using logarithmic scaling.

Finally, you will modify the lab circuit to create your own design.

Part 1: Build Speaker Circuit (25 pts)

Build the circuit shown below in Figure 1.  This circuit is an amplifier that can accept a small voltage signal at low current and deliver proportionally more voltage and current that can drive a speaker (shown hand-drawn on the far right side of the schematic).  In our case the small input signal is Vin that comes from the waveform generator of the AD2.  The circuit will allow you to hear what the signal from the waveform generator sounds like.

The speaker needs a fair amount of current, which the LM386 can also provide, whereas the AD2 specifications say its waveform generator output current is limited to 1 mA to 4 mA.  (Why two values are listed here is a mystery, but datasheeets are like that!)

!Caution:

The 10 Ω resistor has a power rating of only 1/4 W and will start melting at a current, I, computed from p = I2R as follows:

  • Since our circuit has a gain as high as 20, this means we must restrict Vin to a very low value of Vin_max that we compute from Ohm’s law:
  • Thus, you must only use a very small voltage setting for AD2 function generator.  We will use 10 mV, just to be safe.

Do not connect Vin to the AD2 yet.  When your circuit is completely built, as shown in Fig. 1, take a picture of your circuit and insert it after the note on the next page. 

Figure 1. Speaker circuit.  Vin is a sinusoid from AD2.

Note on the circuit:

The LM386 circuit is unusual in that it has only one positive voltage for its supply but can amplify a signal that swings both positive and negative (like a sinusoid with no DC offset) and outputs a signal that seems to swing both positive and negative.  In op-amp circuits we have seen previously, we used both positive and negative voltage supplies to accomplish such a task.

How can a circuit work with input signals that lie beyond its power supply voltages?  The answer on the input side lies in a clever design that restricts input voltage variations to ±0.4 V, or less than a diode drop, allowing slightly negative voltages to produce linear changes in transistor currents.  The answer on the output side is that the output sits at half the power supply voltage and swings up and down from there.  By inserting a 270 μF blocking capacitor in series with the output, the speaker sees a voltage that appears to swing up and down around 0 V.  That is, the capacitor looks like an open circuit to the DC offset but looks like a small impedance for the AC part of the signal.  This clever design also allows for polarized capacitors to be used in the circuit, since the voltage across the capacitors is always positive.

(30 pts) Built Circuit ***************** Put a picture of your built circuit on this page.

Part 2: Measure the Gain of the Circuit (30 pts)

The circuit you have built increases both the current and the voltage available to drive the speaker, but it is more convenient to measure the voltage gain of the circuit.  Voltage is easier to understand, and the Thévenin equivalent voltage of each amplifier in a series of amplifiers may be used as the variable that is processed by each amplifier.  Also, if we make voltage measurements across known impedances, we can use Ohm's law to determine the current, if we are interested in that.

!Caution:

You must use a very small output signal from the AD2 in this experiment to avoid damaging the speaker.  In this part of the lab, before you connect Vin to your circuit, setup your AD2 function generator to output a 10 mV peak-to-peak (i.e., 5 mV amplitude from reference to peak voltage) sinusoid with zero DC offset at a frequency of 1 kHz.  Before you connect the AD2 waveform generator to your circuit, connect the oscilloscope inputs on your AD2 directly to the AD2 output wires  for the waveform generator (AD2 yellow wire for Vin, and any of the AD2 black wires for reference) to verify that the output signal is present.  You may have to change the vertical scaling on the AD2 oscilloscope in order to see the small 10 mV sinusoid signal.

Now connect your battery (or AD2 +5V supply and reference wires) to power your circuit, and  connect the output of the AD2 waveform generator to Vin to verify that the speaker is working.  To verify this, connect the oscilloscope inputs across the speaker connections and look for a sinusoid.  If the sinusoid is about 200 mV, things are probably working correctly.  If you want a louder sound, you may turn up the AD2 output amplitude but be careful not to turn the AD2 output voltage higher than 70 mV max.

Once you have verified that the AD2 function generator is putting out the desired signal, set the sinusoid frequency and amplitude to each of the values in Table 1 columns 2 and 3 so you can measure the circuit output voltage, Vout, (which is across the speaker).  Before you proceed, however, there is an issue to discuss.

At very low frequencies, you may have to use a larger input signal in order to get any output signal.  (The 270 μF capacitance before the speaker blocks low frequencies, which is necessary to prevent DC voltages from reaching the speaker and potentially damaging it.  Speakers are designed for AC inputs, and DC offsets can be very large, causing the speaker to displace too far and be damaged.  In our circuit, the DC offset of the signal coming out of the LM324 is about 4.5 V, which could destroy the speaker.)  In the process of blocking DC, the 270 μF capacitor blocks low frequencies, too.  If you increase the Vin voltage, do it carefully, and be sure you do not exceed the ±0.4 V limit of the LM324 input.

If you use a larger value of Vin than shown in Table 1 because the output is too small, replace or cross out the value shown in column 3 and replace it with the actual value.

If your AD2 gives a warning message that a frequency is too high to be used, make a note of that on that row of the table and omit that measurement.

Finally, see the footnote for the last column.  More on that in the next part of the lab.

(30 pts) Table 1:  Measured Input and Output Voltages for Speaker Circuit

 

f in

Vin (peak-to-peak)

Vout (peak-to-peak)

Gain (Vout/Vin)

dB gain*

Test 1

1Hz

10 mV

 

 

 

Test 2

1Hz

10 mV

 

 

 

Test 3

1Hz

10 mV

 

 

 

Test 4

10Hz

10 mV

 

 

 

Test 5

20Hz

10 mV

 

 

 

Test 6

50Hz

10 mV

 

 

 

Test 7

100Hz

10 mV

 

 

 

Test 8

200Hz

10 mV

 

 

 

Test 9

500Hz

10 mV

 

 

 

Test 10

1kHz

10 mV

 

 

 

Test 11

2kHz

10 mV

 

 

 

Test 12

5kHz

10 mV

 

 

 

Test 13

10 kHz

10 mV

 

 

 

Test 14

20 kHz

10 mV

 

 

 

Test 15

50 kHz

10 mV

 

 

 

Test 16

100 kHz

10 mV

 

 

 

Test 17

200 kHz

10 mV

 

 

 

Test 18

500 kHz

10 mV

 

 

 

Test 19

1 MHz

10 mV

 

 

 

*To calculate the dB gain, take the base-10 logarithm of the gain and multiply that by 20.

Note: On calculators, the base-10 log function is usually denoted by “log”, whereas the natural or base-e log is denoted by “ln” (letters "el" and "en").

Part 3: Create Speaker Circuit Magnitude Plot (20 pts)

Notice that the input frequencies for Part 2 are not linearly spaced.  We use logarithmically-spaced values so we can see what is happening at very low frequencies.  It turns out that the mathematics of transfer functions and impedances takes on a convenient form if we use plots with logarithmically-spaced frequencies (and log-scaled gain values).  That is, we get nice results when plot the logarithm of the gain value versus the logarithm of the frequency.  By “nice results” we mean that we get plots with only a few characteristic shapes that we can sketch quickly by hand.  We call such sketches Bode plots, after their inventor, and we will discuss them in the lecture portion of the class.

The convenience of plotting gets even better when we use decibel measurements.  Lab 2 focuses on Bode plots, but for now we will just note that converting a gain value to decibels (dB) means we take the base 10 logarithm of the gain value and multiply by 20, as in Table 1.  The multiplication by 20 gives values that are close to integer (or half-integer) values when the original value is an integer, as shown in Table 2.

Table 2  Decibel (or dB) approximate values

value

dB = 20log10(value)

approx dB

1

0.00

0

2

6.02

6

3

9.54

9.5

4

12.04

12

5

13.98

14

6

15.56

15.5

7

16.90

17

8

18.06

18

9

19.08

19

10

20.00

20

Your next step is to make a plot of your data using a log-scaled frequency axis and linear scaled gain axis for dB (which is already a log-scaled value).  Fig. 2. shows what the plot might look like for a typical amplifier circuit.  We are using a smaller frequency range, and we have difficulty measuring very small gains, but our circuit has similar behavior if we use very high frequency inputs (but with the whole graph shifted down because of lower gain).  At low frequency, the 270 μF blocks signals to the speakers in order to eliminate DC offsets.  At very high frequency, capacitances inside the LM386 circuit would start to short out, lowering the gain.

Make your plot using the MATLAB instructions below, and then read the note below on gain plots.

MATLAB frequency response plot:

Use the semilogx(x,y) command for your plot.  The MATLAB function semilogx(x,y) is just like the plot command but uses a log scale for the x values.  You may add more arguments to semilogx() to specify plotting options like line width, line color, etc., the same as you would with the plot command.

Be sure to label your plot.  See the Resources page on Canvas, link on Home page, and then click on MATLAB Resources there for files to help you label your plot.

Note on gain plots:

When we have a simple plot like that of Fig. 2, we can identify so-called “cutoff frequencies”, f1 and f2, where the gain is 3 dB lower (A2) than the maximum gain (A1).  The idea is that the amplifier gain is small for frequencies below f1 or above f2.  In reality, however, a drop of 3 dB is small as far as our sense of loudness is concerned.  The real reason a drop of only 3 dB was chosen is that this results in simpler mathematical calculations of cutoff frequencies. 

Figure 2. Typical gain plot for band-pass amplifier.

Part 4: Your own design (25 pts)

You can choose what you want to do for this part. The requirement for this part is to create a modify the circuit by using a different input (instead of the waveform generator) and/or having a different output (instead of the speaker). Anything goes here. Ideas include using the microphone from the kit, creating your own input source such as from an mp3 player by hacking an audio jack, using an LED on the output that lights up with your voice input for a specific input, etc. (This could lead into your final project , so pick something that interests you.) After you get the circuit working, make a short video and upload it to canvas or supply a link to the video.  

(10 pts of the 30 pts) for uploaded video

A few links for ideas:

· http://www.learningaboutelectronics.com/Articles/Microphone-amplifier-circuit.php (circuit idea for connecting microphone)

· https://www.circuitbasics.com/build-a-great-sounding-audio-amplifier-with-bass-boost-from-the-lm386/ 

o (https://www.youtube.com/watch?v=8DFc0hqnTF8 (hack an old audio jack)

· http://www.circuitdiagram.org/sound-activated-led-using-lm386-ic.html (led light)

发表评论

电子邮件地址不会被公开。 必填项已用*标注