Lab Report #10 Alex Styborski, Daniel Telesman, and Josh Kauffman Group 12 Abstract During lab 10, students carried out four different experiments, each one showing the spectrum of a different wave form. The first experiment consisted of examining the spectra of a square wave, a sine wave and a ramp wave, and each was produced though the signal generator. The second experiment focused on examining an Amplitude Modulated (AM) wave, also produced through the signal generator. The third experiment analyzed an audio signal from an mp3 player (such as an iPod). The students tried to find harmonics within this music signal. The fourth and final experiment was focused on examining the spectrum of a beating wave that was created on Quartus II and programmed into the DE2 board. Lab Report #10 2 4/12/13 Introduction The goal of this lab was to use the oscilloscope to observe both normal and modulated signals. The objectives included using the signal generator to create the waves, and then display and analyze these signals on the oscilloscope. In experiment three, an mp3 player was used instead of the signal generator. The lab also required the group to build and implement a circuit in Quartus II that produces a modulated signal. Using signal tap II program and the oscilloscope, the students then to observed the signal generated. This lab report includes a section that describes the experiment and results that were obtained. Also included are the discussions questions that discuss the characteristics of the linear ratios and modulated signals. Finally, the conclusion describes what the takeaways from this experiment are. Theory (eq 1) A1/A2 = 10(Δy/20) (eq 2.) F = P/ (2m / Fs) Main Body Lab 10 consists of four separate experiments. There are multiple videos associated with this lab; however only one is a new video. The others are from previous labs and are used as reminders. They are: Lab 2 – Hierarchy, Lab 4 – All videos, and Lab 5 – Synthesizer I and II. The new video is named “Measuring Spectrum and Generating AM signals,” and should be watched because it will be helpful for doing the experiments. The procedure for each of the experiments is as follows: Experiment 1 Experiment one includes observing the spectrum of sinusoidal, square and ramp waves generated by the signal generator on the oscilloscope. The group begins by producing a square wave at 1 kHz, 1 V peak-peak and a 50% duty cycle on the signal generator. The group must first ensure that both the signal generator and the oscilloscope are set to High Impedance. To do this on the signal generator, the following buttons are used: Utility >> Output Setup >> HighZ. For the Oscilloscope, press the “1” button >> Imped 1MΩ. In the case of this experiment, the cable connected to the signal generator may be attached to either the “Sync” output or the “Output” output. Next, the group wants to formulate the spectra of this wave. The video viewed earlier instructs the group on how to observe the FFT spectrum. The “Math” button on the oscilloscope brings up the spectrum wave as well as a menu which allows the group to customize the signal. The “Operator” button should be set to use FFT. Now a spectrum, tinted purple, should be displayed. The square wave may be removed from the screen (showing only the FFT spectrum) by pressing the “1” button. The horizontal scale is increased to better look at the spectrum by using the horizontal knob. In this experiment, the scale should be set to 5ms/div. The vertical scale must also be adjusted. To set the vertical scale, the group navigates to “More FFT” and then sets the scale to 20 db. The result can be seen in Figure 1. Lab Report #10 3 4/12/13 Figure 1: The spectrum of a square wave produced by the signal generator. Five harmonics are present. Various measurements are performed on the wave produced and can be found in the Results section of this lab. The group then uses the same process outlined above and observes the spectrums of a sine wave and of a ramp wave. Figures 2 and 3 show their spectrums. Lab Report #10 4 Figure 2: The spectrum of a ramp wave created by the signal generator. Only one harmonic can be seen. Figure 3: The spectrum of a sinusoid wave produced by the signal generator. Nine harmonics are present. 4/12/13 Lab Report #10 5 4/12/13 Experiment 2 Experiment two focuses on the spectrum of Amplitude Modulated (AM) waves that are generated by the signal generator. To start, the group must adjust the settings on the signal generator. The carrier frequency, fc, is set to 1040Hz. The peak to peak remains at 1V. Then using the MOD button to bring up the modulation parameters, the group sets the type to AM with an AM depth of 100% and a frequency of 40Hz. Finally the shape should be that of “sine”. By pressing “graph” on the signal generator, the group can observe the wave they are producing before it is displayed on the oscilloscope. In this experiment, the connection from the signal generator must be on “Output” and NOT “Sync”. Looking at the oscilloscope, a modulated wave should be produced. By selecting “Single”, the signal can be stabilized. To observe the spectrum, the same technique explained in experiment one is used. The horizontal scale is then set so there are three distinct peaks displayed around the carrier frequency. Figure 4 shows the spectrum. Measurements are then performed which can be located in the Results section of this lab. Figure 4: The spectrum for an AM wave. There are 3 distinct peaks that can be observed. Lab Report #10 6 4/12/13 Experiment 3 The third experiment focuses on the spectrum created using music from an mp3 as the signal. First, the audio output of the iPad/iPod is connected to channel 1 on the oscilloscope. Next, the same process as explained in experiment one is completed. The horizontal resolution is set to 3 kHz. To set this value, the vertical scale must be adjusted to a lower value. The musical spectrum can then be observed on the oscilloscope, as shown in Figure 5. Measurements are taken and shown in the Results section of this lab. Figure 5: The spectrum generated when an iPod was used as the signal source. Experiment 4 In the fourth experiment, the group constructs a circuit in Quartus II that will produce the beating of two sinusoids, which will be observed on the oscilloscope. A new Quartus II project is created in a new “Lab10” directory. The design of the circuit implements hierarchy, because two separate synthesizers are used. First, a new symbol block diagram is opened and the circuit of a synthesizer is constructed and saved as “Synthesizer” (this process is described in previous labs). Figure 6 shows the circuit of one synthesizer. The input pin for the constant is named “p[31..0]” and the input pin for the clock is named “clock”. The output pin, which will later be connected to an adder, is named “output[15..0]”. Lab Report #10 7 4/12/13 Figure 6: The design of a single synthesizer. This block diagram will be converted into a symbol file. Now the circuit is compiled (to make sure there are no errors) and a symbol file is created. Another new symbol block diagram named “top” is opened and it is here that the final design will be constructed. Before building the circuit, the files for the adc2dac block must be copied into the project folder from the Sophomore Experience directory then added to the project. The adc2dac symbol may now be created and added. The circuit uses the constant values of 939524 and 850046 for the two lpm_constant elements. Figure 7 shows the completed design. Now, after ensuring that the project named “top” is set as the top level entity, the group then adds the pin assignments and compiles the program. Before programming the circuit onto the FPGA chip, the group must first configure the CODEC (the procedure for this can be found in previous labs). After successful configuration, the FPGA is programmed. Figure 7: Final design of a circuit that generates two signals that beat against each other. Lab Report #10 8 4/12/13 After successfully programing the FPGA, the oscilloscope is connected to “line out” of the DE2 board. The signal is moving at a very low frequency, so the oscilloscope must be zoomed out until a nice wave can be seen. The horizontal scale and the vertical scale are manipulated so that two distinct peaks can be seen. The spectrum is shown in Figure 8. Calculations of the frequencies can be found in Results section of this lab. Figure 8: The spectrum of the wave produced by the circuit programmed onto the FPGA chip. Results The results obtained from the lab will be separated into four parts for the four experiments in this lab. The group uses the methods in the lab video to find many of the values. For example, the method of adjusting the cursers of the X and Y values to acquire the frequencies, decibels and displacements. The questions are first stated then the method/explanation along with the values follows. Experiment 1 What is the frequency value of the 1st harmonic? By looking at figure 1, there are several peaks in the spectrum. The first peak represents the first harmonic. To find its value, use the X cursor, and line it up with the peak point of the wave. The frequency of the first harmonic is 1 kHz. Lab Report #10 9 4/12/13 Are odd harmonics present in the spectrum? If so, are even harmonics strong compared to the strongest odd harmonics? The spectrum displays the 1st, 3rd, 5rd, 7rd and 9th harmonics and therefore these peaks represent only the odd frequencies. There are no clearly observable even harmonics. What are the frequencies of the harmonics present in the spectrum? The frequencies are: 1st – 1 kHz, 3rd – 3 kHz, 5th – 5 kHz, 7th – 7 kHz and 9th – 9 kHz. Determine the linear ratio of the peak heights between the 1st harmonic and the third harmonic. Repeat this process for the peaks of the 1st and 5th harmonics. Are these results consistent with the theoretical result for the spectrum of a square wave? To find the linear ratio between peaks, the Y cursers are used to find the displacement. Then, eq. 1 is applied with that value. (eq 1) A1/A2 = 10(Δy/20) Between the 1st and 3rd harmonics the displacement is 9.375, and between the 1st and 5th harmonics the displacement is 13.125. Using eq. 1 the linear ratio of the peaks are 2.943 and 4.532, respectively. Theoretically the magnitudes of these peaks should drop off as 1/k yielding linear ratios of 3 and 5. While our experimental results did not obtain these exact results, they were fairly close. Experiment 2 Measure the frequency positions of the 3 peaks. Is this consistent with the theoretical results of an AM sinusoid signal? Using the method of lining up the X cursers with the peaks, the resulting frequencies are 1 kHz, 1.04 kHz and 1.08 kHz. These values are consistent with the theoretical values. Experiment 3 Can you observe harmonics in the signal? What harmonics are these? There are harmonics, but they are not discernible. Using any peak near zero (Peak 1) and any other dominant frequency near 3000Hz, measure the linear ratio of heights between Peak 1 and Peak 2. By using the Y cursors, the peak values can be found. After lining up the cursers, the displacement should be displayed = 11.9. By again using eq 1, the ratio can be found. A1/A2 = 10(Δy/20) A1/A2 = 10(11.9/20) A1/A2 = 3.94 Lab Report #10 10 4/12/13 Experiment 4 Calculate the frequencies being produced by the two synthesizers based on the constants that are being inputted to the synthesizer. The sampling frequency is 48 kHz. To find these frequencies, use eq. 2. The constant (P) values are 939524 for the first constant and 850046 for the second. M = 32. (eq 2.) F = P/ (2m / Fs) The frequencies then are 10.5 Hz for the first constant and 9.5 Hz for the second. The frequencies observed on the oscilloscope (Figure 8) are 10.28Hz and 9.3 Hz, which are fairly close to the calculated values. Discussion and Suggestions 1. Describe the spectra from Experiment 1. The spectra show the coefficients of the Fourier series vs. frequency for all the waves in decibel representation generated within the lab. The frequencies range from 0 Hz to Fs (sampling frequency) divided by two. 2. Explain the difference between decibel representation and linear representation. The y axis of the decibel scale is determined using a logarithmic scale while the linear scale goes up on a linear scale. The graphs, while representing the same information, appear different do the difference in axis. A signal less than one in a linear representation is much larger in magnitude and on a decibel scale is negatively oriented. Signals larger than one are less spread out in the decibel representation and are smaller in magnitude. 3. In experiment 3, what does the linear ratio of Peak1 and Peak2 tell you about the bandwidth of your music signal? Is it larger or smaller than 3 kHz? The ratios of Peak 1 and Peak 2 are both very large in this experiment, so the bandwidth of this signal is less than 3 kHz and close to the first peak. The difference between the two peaks was about 25 decibels which greatly exceeds the 3 decibel difference that labels the signal as weak. Since the signal is strong around Peak 1, the bandwidth should be close to the frequency of Peak 1. 4. What is the difference between a typical AM signal and a beating signal? The main difference between these two signals is that an AM signal will never have a magnitude of 0. This is so because the DC value added to the signal is >= to the amplitude of the produced wave. In the lab, the AM depth of a modulated wave refers to a constant added to the modulated cosine wave to ensure the top sine wave will never be negative Lab Report #10 11 4/12/13 Conclusion In this lab, students started to shift their focus to signal processing. By analyzing various signals including Square waves, Ramp waves, Sine waves, AM waves and Beating waves, many of the topics being covered in lecture were clarified. In addition to starting signal processing, students also got to use the skills they have acquired in Quartus II in order to complete the fourth experiment of this lab. Overall, the lab effectively brought together everything that the students have learned so far this year. Acknowledgements Alex Styborski, Daniel Telesman, and Josh Kauffman all were present during the lab period and contributed to this lab report.