Lab 1: Analog Modulations October 20, 2017 This lab contains two parts: for the first part you will perform simulation entirely in MATLAB, for the second part you will use a hardware device to interface with MATLAB and receive radio signals. Part 1. Load the following sample audio file from MATLAB audio = audioread( handel.ogg ); This audio signal has been sampled at 44, 100 Hz and has a duration of 8.9249 seconds. 1. Use the interp command to increase the sampling rate by 8 and display its spectrum using the following commands: audio_inp = interp(audio,8); SpecAnlyzr1 = dsp.spectrumanalyzer( SampleRate,fs, PlotAsTwoSidedSpectrum,false); SpecAnlyzr1(audio_inp) 2. Use the interpolated audio signal to modulate a sinusoidal carrier at f c = 100 KHz using SSB modulation (suppressed carrier). Display the spectra of the message and modulated signals, and measure the transmission bandwidth. Calculate the average power (in db) of the modulated signal. You can use the following command to calculate the average signal power: L = length(audio_mod); Avg_sig_pow = 10*log10((norm(audio_mod))^2/L) 3. Add some white Gaussian noise to the modulated signal. Create a noise vector of the same length as the modulated signal using the following command: noise = wgn(l,1,p_n); where P N represents the noise power in dbw. You can choose P N comparable to the modulated signal power to begin with. 4. Demodulate the signal with noise. Display the output spectrum and listen to the demodulated signal. Vary the noise power and comment on the result. What is the noise power level that does not affect the output much? What is the noise power level that the output music is barely recognizable? What is the noise power level that you wouldn t want to listen to the music anymore? 1
5. Repeat parts 2 4 for FM modulation using a modulation index β = 4. Note the frequency deviation in FM modulation command (fmmod) can be calculated as f = β.w, where W is the message bandwidth (15 khz in this case). 6. Next change β to two different values, one much larger and one much smaller (for example β = 10 and β = 2). For each new beta, use the same noise levels as before and listen to the demodulated FM signal. Comment on the clarity of the music. This exercise should demonstrate that you can adjust FM bandwidth for better noise performance. Specifically you can trade off more bandwidth (higher β) to get better performance in FM at the same noise level. This ability is not present in AM. 7. Crank up the noise gradually in FM and listen to the output (until the output music is no longer recognizable). Do you observe any special effect when noise is increased gradually in FM? Repeat this exercise with SSB, what do you observe? FM receivers are nonlinear and exhibit a threshold effect, which means when noise is above a certain threshold, the receiver stops functioning correctly and just outputs noise. This effect is not present in linear receivers such as a coherent detector where the output just gradually degrades as noise increases. 8. Include in your report the answer to each of the steps above. Also include the comparison between SSB and FM modulations at different β factors and noise levels in the following aspects: Transmission bandwidth Transmit power (power of the modulated signal) Noise performance: which system performs better at the same noise level, and which is more robust to noise? Note: You need to support all your comparison with results from your simulations, including figures and calculation. 2
Part 2. Software-Defined Radio (SDR) SDR is a radio system in which communication components (mixers, filters, modulators, demodulators, etc.) are implemented by means of software instead of real hardware. In other words, SDR utilizes software to perform signal processing tasks that are traditionally done in hardware. In this lab, we will use an RTL- SDR, a software defined radio device from NooElec (NESDR Mini 2+), to receive FM signals. You can read more information about this device at the following link: http://www.nooelec.com/store/sdr/sdr-receivers/nesdr-mini-2-plus.html For this lab, you need to sign out a NESDR package from the TA (one package per student). Each package includes a NESDR dongle and an antenna. You can use the package for the duration of the lab and return it at together with the lab report. Note that it is important to keep the package in good condition and return it at the end for future uses. Your grade will not be released until the package is safely returned. FM Broadcast Receiver Spectrum Analyzer (Rcv. Signal) Spectrum Analyzer (Demod. Signal) Baseband File Reader FM Broadcast Captured Signal 0 1 Lost Late x <x> <Lost> FM Broadcast FM Broadcast Demodulator Baseband Audio Device Writer 1e6 104.1 Center Frequency (MHz) fc Data RTL-SDR Receiver lost RTL-SDR Receiver late x Lost Late Signal Source Selector <Late> Lost Samples Audio output.wav To Multimedia File Info Signal Source Latency Copyright 2013-2016 The MathWorks, Inc. Figure 1: FM Receiver Simulink Model 3
1. Setup: You have the choice to perform this lab in the lab room H229, or to do it on your own computer. (a) To perform in the lab: Go to a lab computer in H229, and run Matlab2016b program. Check the Add-On Manager to make sure the Communications System Toolbox Support Package for RTL-SDR radio is installed on the MATLAB and ready to use. To open the Add-On Manager, go to the Home tab, and select Add-Ons > Manage Add-Ons. (b) To perform on your computer: Make sure you have installed Matlab2016b or a later version. If you currently using an earlier Matlab version, please update it to the latest version via Tufts software download (the lab may not function properly on earlier MATLAB versions): https://it.tufts.edu/sw-matlab Run MATLAB and go to Home > Add-Ons > Manage Add-Ons, find the Communications System Toolbox Support Package for RTL-SDR radio and install it. After the package installation is done, a new window will pop up and ask you to set up your RTL- SDR device. Plug in the device to a USB port on the computer and follow the instruction to set up the dongle. 2. Connect the SDR device with its antenna using the provided cable and use the command sdrinfo to check the connectivity of the device. 3. Open the FM receiver Simulink model FMReceiverSimulinkExample (a screenshot of the model is shown in Fig. 1) and take the following steps: Save as the model with a different file name. Add two spectrum analyzers to capture the spectra of the received signal and demodulated signals. Go to Library Browser > DSP System Toolbox > Sinks and drag & drop the Spectrum Analyzer block. Use the Signal Source Selector block to choose the RTL-SDR Receiver as your signal source. Set the frequency of the radio station. You are free to choose your own frequency, some options for clear signal reception are: 104.1 MHz, 106.7 MHz, and 92.9 MHz. 4
4. Run the model, listen to the FM output and comment on the clarity. The spectrum analyzers will display the instantaneous spectra of the received signal and the demodulated signal. In Spectrum Analyzer window, open the Trace Options panel from the menu bar and set the Average parameter to 100 in order to see the average spectra of the signals. Open the Channel Measurements panel from the menu bar and set the following parameters: Measurement type: Occupied BW Span: 40 khz Occupied BW (%): 99 The Occupied BW is the bandwidth containing the specified percentage of the total power of the spectrum. Check the documentation for Spectrum Analyzer on Mathworks website for more details. Measure the bandwidth of the received signal (transmission bandwidth) and the bandwidth of the demodulated signal. Comment on the difference. Can you infer the modulation index from these two bandwidths? 5. Repeat the exercise for a different FM frequency. Report. For the report, choose two different FM stations and perform the following tasks: (a) Print out the received FM signal power spectrum, clearly label the frequencies. (b) Measure the average power in the received signal and find the occupied bandwidth for 99% of the power. (c) Print out the demodulated signal power spectrum, clearly label the frequencies. (d) Measure the average power in the demodulated signal and find the occupied bandwidth for 99% of the power. (e) Compute the modulation index from the measured bandwidth (using Carson s formula). (f) Comment on the clarity of the demodulated signals. 5