ECE 4117 Experiment 2 Amplitude Modulation ECE 4117 – Telecommunications Laboratory Fall 2012 Purpose In this lab, the concept of Amplitude Modulation (AM) is investigated. Implementation of AM is primarily done through the use of GNU Radio and the USRP. Both transmission and receiving is investigated. Introduction In communication, modulation is the process of varying one or more properties of a highfrequency periodic waveform, called the carrier signal, with a modulating signal which typically contains information to be transmitted, called the baseband. A modulator is used to modify a carrier signal’s parameter (frequency, amplitude, phase, etc.) in accordance to the baseband signal. Figure 1: Block diagram of modulating a signal Modulation is necessary in the transmission of data, such as an audio signal, over a long range. Baseband signals are inherently limited in range because their frequency range is typically in a lower range and their power makes the signal unsuitable for radio transmission. Modulation gives several advantages, such as reducing the size of transmitting antenna, better usages of limited bandwidth, and much more. There are three types of basic modulation (analog), amplitude (AM), frequency (FM), and phase modulation. The latter two are similar and belong to the class of modulation known as angle modulation. For this lab, we will only cover AM. Amplitude Modulation (AM) is a method to modulating the carrier signal, where the amplitude of the carrier signal is varied in line with the variations in intensity of the baseline (information) wave. Thus, the overall amplitude or envelope of the carrier is modulated to carry the audio signal. Below, we see the layout of a signal and the modulated carrier signal. 1 ECE 4117 Figure 2: Audio Signal and Amplitude Modulated Carrier Signal A GRC file will be included for this lab, where the process of amplitude modulation and demodulation is demonstrated. In this lab, you will build a transmitter and receiver layout within GNU radio for AM radio, based on the GRC file provided. The USRP will then be used to transmit information from one computer to another using GNU radio. GRC File For this example, refer to am_tx_rx.grc The purpose of this file is to mimic and show the process of transmitting and receiving an AM radio signal. The file takes a WAV file and modulates it. Then it sends it to the receiving side where it is demodulated and played through a scope and the computer’s speakers. A more thorough explanation is provided below. First, the WAV file is added to a constant value of 1, this shifts the signal by one. This shift is needed in order to achieve classic amplitude modulation, where the carrier is available in the final product. This signal is now 1+m(t), where m(t) is the baseband signal. The sampling rate throughout the layout is 44.1 KHz, based on the initial rate from the WAV file. 2 ECE 4117 Next, the signal’s data type is converted to complex format. The data does not change, but the data can now be used in complex operations. The signal is now multiplied with constant value of 0.1. This is done to shrink the data to fit the -1 to 1 amplitude requirements of the USRP. It is not necessary in this example. The signal is multiplied again with a high frequency cosine signal. This is the carrier signal. This signal’s frequency is the frequency at which the USRP or any radio would broadcast a signal. This is the final step in Transmission and the signal would then be transmitted through the air. The signal arrives at the receiving side and gets multiplied by another cosine signal. This acts as a frequency shift or tuner, in order to center carrier signal at 0 Hz. Since the carrier signal is at 10 KHz, the frequency of the frequency shift is negative, -10 KHz. 3 ECE 4117 If the signal was among an array of other signals, a filter would be needed to select a signal and filter out the rest. This is called a channel filter. Since a tuner is used to bring the wanted carrier signal to 0 Hz, a low pass filter can be used to filter out any unwanted signals. The cutoff frequency at 5 KHz is standard and is in line with the available bandwidth with standard AM radio (10 KHz). The final step is the demodulation of the signal. This is done by detecting the envelope or magnitude of the modulated signal. The block complex to mag does this. It detects the magnitude of the complex signal and outputs it in float form. This signal is now 1+m(t). The constant multiple block can be used to control how loud the signal is by changing the amplitude. Finally, the output can be listened to through the computer speaker and observed through the scope sink. 4 ECE 4117 Procedure 1. Run and analyze the GRC file provided. Check to see if the output sound matches the input wav file. Do the following and take screenshots. a. Place an FFT sink at the following locations: after the Float To Complex block, after the first multiply block, after the second multiply block, and at the output. b. Place a scope sink at the following locations: After the first add block, after the first multiply block, after the second multiply block and at the output. You can only run two graphs at one time in GNU radio, so you will have to do several runs to obtain the results. 2. Build a separate GRC file based on the receiving side of the am_tx_rx file. This separate file will be used to receive a signal using the USRP. The input will be a USRP2 source and the output will be a scope sink and an audio sink. Make the following changes to the layout: a. Make the frequency shift have the ability to shift on demand by placing a variable slider. By using the slider, you have defined a variable identified by its ID. Using the ID in the frequency field of the signal source enables you to vary the frequency using the slider. This will enable you to define a variable that can be shifted from the graph GUI after the layout is executed. Set the 5 b. c. d. e. ECE 4117 default value at 0, the steps at 1000, and minimum and maximum value at 20K to 20K. Check the incoming signals frequency range and make sure that none of the wanted signal is being cutoff. If it is, adjust the low pass filter accordingly. Make the volume variable by placing another variable slider. Try different values to achieve a good range of volume. Try a default at .5, and making the range from 0 to 1. Multiply if needed. Place an FFT sink after the multiply block so as to see the spectrum of the incoming signal. The USRP outputs at a sample rate of 100MHz. In order to hear the USRP signal, the signal needs to be resampled to a slower rate. Two blocks, the rational resampler and the fractional interpolator can be used to reduce the sample rate (refer to GNU radio docs for more details on both blocks). Both are located under the filter menu. Also, several blocks such as the low pass filter and the USRP source/sink have decimation and interpolation options built in. The key is to have a large enough sample rate to see what is necessary in the FFT sink, therefore having a sample rate at around 256K would be ideal at the FFT stage. After this, the sample rate can be dropped to a rate the speakers of the computer can pick up (44.1 or 48 KHz). Make sure all of the blocks are set to the proper sampling rate in their branch. 3. After building the receiving layout, test the layout. This layout can be tested by implementing a file source instead of the USRP source and using the file named test_am_usrp.dat. It will work like the USRP in that in it is actually a recording from the USRP. It contains a spectrum of AM radio signal, where it is centered at 780 KHz. This file can be implemented in place of the USRP source. The only difference is that the file’s sample rate is 256 KHz, so adjust the sample rates accordingly. Take a picture of your layout, and derive scope and FFT graphs from one of the broadcasts. 4. Build another GRC file layout based on the transmission side of the am_tx_rx file. This separate file will be used to transmit signal using the USRP. The input will be a signal source and the output will be a USRP2 sink. The output needs to have a sampling rate of 100 MHz. Therefore, you need to use resampling blocks to raise the sample rate. Also, remove the second signal source as the USRP2 does the modulation within itself. Just remove the multiply block and the Carrier signal block. 5. Using two computers and two USRPs, send a sine wave signal from one computer to the next. Get as close as possible to the original waveform. Noise will be a factor in the receiving of the waveform, therefore try physically moving the USRPs closer. 6 ECE 4117 Take a picture of outgoing and incoming modulated and demodulated waveforms. If the signal is too dirty, try replacing the receiving side scope with a file sink. This produces a binary data file. Using this data, you can check the information on Matlab. A reference sheet will be able for this method online. 6. Write a report on the concepts of AM, the transmission and receiving of information, and the procedures done in the experiment. Make sure to include the following: a. Write in detail about the basics of AM. Also include some of the other modulation schemes within AM. b. Write up an analysis of the am_tx_rx file. Explain why the blocks are there and what purpose they serve. Explain some of the concepts in greater detail. Make sure to include the waveform screenshots. c. Write about GNU radio and the USRP TX/RX. Compare to these to schemes of TX/RX within the book. d. Describe your personal experience on broadcasting your waveform from both created files. Be sure to include all data obtained. 7