Communication Lab Experiments
Communication Lab Experiments
SEMESTER VI
DEPARTMENT OF ELECTRONICS AND COMMUNICATION
ENGINEERING
1
TABLE OF CONTENTS
EX.NO EXPERIMENTS PG.NO
PART-A
1 FM generation and demodulation using PLL 3
2 Generation and Detection of BPSK 6
3 Generation and Detection of Delta modulated signals 9
PART-B
1 Error Performance of BPSK 12
2 Error Performance of QPSK 16
3 Performance of Waveform Coding Using PCM 20
4 Pulse Shaping and Matched Filtering 24
5 Eye Diagram 28
PART-C
6 Familiarization with Software Defined Radio 30
7 FM Reception 35
8 Familiarization with GNU Radio 38
2
1. FM generation and demodulation using PLL
AIM: To generate frequency modulated signal and to demodulate the Frequency Modulated
signal using PLL.
THEORY:
In FM, frequency of the carrier signal is varied in accordance with the instantaneous amplitude
of the modulating signal. PLL is widely used for FM generation. The frequency generated by the VCO
of the PLL is varied by the input signal applied. The resistor R1 and capacitor C1 decides the carrier
frequency of the FM. AF input is capacitively coupled to pin 7 of the IC using R3-Cc network.
For the demodulation of the FM signal, the center frequency of the VCO of the demodulator
is made the same as that of the modulator. The variation of the input frequency from the center
frequency is converted into the variation of the voltage by the phase comparator of the demodulator.
FM input is coupled to the pin 2 using R3-Cc network as shown in figure.2
Major advantage of FM demodulator using PLL is linearity. Linearity is governed by the
voltage to frequency characteristics of the VCO within the PLL. As the frequency deviation of the
incoming signal swings over a small portion of the PLL bandwidth, and the characteristics of the VCO
can be made relatively linear, the distortion levels from PLL demodulators are normally very low.
CIRCUIT DIAGRAM:
3
Figure 2. FM Demodulation using IC565
DESIGN
Let V+ =10 V and V- = -10
Let the center frequency of the FM be fo=(1.2/4*R1*C1) =2.5 kHz
Take C1=0.01μF Then we get R1=12 kΩ
The value of R1 satisfies the required condition 2 kΩ < R1 < 20 kΩ, as per data sheet. Take
Cc=10 μF and R3=12 kΩ to couple the input to the IC.
For demodulator circuit, since center frequency is same as that of modulator, frequency
determining components are the same.
Take same set of coupling capacitor and resistor.
Take R2=1 kΩ, C2=10 μF and C3=0.01 μF
PROCEDURE
1. Set up the FM generator circuit and apply 5 Vpp, 1KHz sinewave input and observe the
output.
2. Note maximum and minimum frequencies, fmax and fmin of FM output. Calculate frequency
deviation ∆f= fmax – fmin. Calculate the modulation index mi = ∆f/fm where fm is modulating
signal frequency.
3. Set up FM demodulator and apply the FM signal to it. Observe the demodulated output.
4
SAMPLE WAVEFORMS
RESULT:
5
2 Binary Phase Shift Keying
AIM
To design and set up a BPSK modulator
THEORY
In binary phase shift keying, the binary symbols 1 and 0 modulate the phase of the carrier. Let the
carrier signal for transmitting the binary symbol ‘1’ be s 1(t)=Acos(2лfct). For the transmission of
symbol ‘0’, phase of the carrier is shifted by an amount of 180° (p radians). So s2 (t) = -A cos(2лfct)
= A cos(2лfct + л). From the above equations, BPSK signal can be defined as s(t) = b(t) Acos(2лfct),
where b(t) = +1 to transmit symbol ‘1’ and b(t) = –1 to transmit symbol ‘0’.
Modulator: This circuit mainly consists of a unity gain op-amp inverting amplifier and two
switches. Inverting amplifier provides 180° phase-shift to carrier signal s(t). The binary symbols are
applied to the control inputs of two switches. An op-amp inverting Zero Crossing Detector (ZCD)
enables to apply symbol ‘1’ at the control input of one switch while ‘0’ at the control input of the
other switch. BPSK signal has constant amplitude as in the case of BFSK signal. Therefore, the noise
can be removed easily.
6
CIRCUIT DIAGRAM
DESIGN
Demodulator: Use 1 kΩ resistor as RF and Ri to get unity gains for the adder circuit. Carrier frequency is
10 kHz and data input frequency are 1kHz.
1
We know, ƒ=2𝜋𝑅𝐶 =1 kHz
If C=0.01μF, then R= 15 kΩ
Use a 10kΩ pot for setting the threshold voltage for the comparator.
7
WAVEFORMS:
-
PROCEDURE:
1. Setup the circuit part by part and verify their function.
2. Connect the parts together and observe the output waveform on CRO.
RESULT:
8
3 DELTA MODULATION AND DEMODULATION
AIM
To design, setup and study a Delta Modulator and Demodulator circuit.
THEORY
Delta Modulation (DM) is a differential PCM scheme in which the difference signal is encoded into
a single bit. This single bit is transmitted per sample to indicate whether the signal is larger or smaller
than the previous sample. The difference between the input and the approximation is quantized into
two levels ±∆ corresponding to positive or negative difference respectively. Here in the circuit the
modulating signal m(t) and its quantized approximation mˆ(t) are applied to the comparator.
Comparator provides a high-level output when m(t) > mˆ(t) and provides low level output when m(t)
< mˆ(t). The output of the comparator is fed to a sample and hold circuit made by a D flip flop. Pulses
at the output of D flip flop is made bipolar by an op-amp comparator. IC 741 is used as the
comparator whose output becomes +5 V when the voltage at its pin 3 is greater than +0.5 V. The
demodulator consists of an integrator and a low pass filter
CIRCUIT DIAGRAM
9
Figure 2: Delta demodulator
DESIGN
Let the input signal amplitude be 5V and frequency be 200 Hz.
i.e., m(t) = 5sin400πt
Maximum slope of m(t) = 2πfA = 2π2000 X 5 = 2000 π
To avoid slope overload error, slope of 𝑚
̅(𝑡) should be more than that of m(t).
𝑉𝑐𝑐/𝑅𝐶 > 𝐸𝑚 𝜔𝑚
Selecting Vcc =15V and C = 0.01 µF, we get 𝑅 < 228𝐾. Take R = 100K.
𝑉𝑐𝑐𝑅2
Therefore = 1.35 V.
𝑅1 +𝑅2
Take R2 =1K. Then R1 = 10K.
Let the clock frequency be 2KHz.
WAVEFORMS:
Figure3: Waveforms
10
PROCEDURE
1. Setup the circuit after verifying the components.
2. Feed a unipolar 5V, 200 Hz sine wave to the input using offset knob of function generator. Set the
clock frequency at 2KHz.
3. Observe the DM output and Vo simultaneously on CRO.
RESULT
11
Part B
1: Error Performance of Binary Phase Shift Keying
AIM
1. Generate a string of message bits.
2. Encode using BPSK with energy per bit Eb and represent it using points in a signal-space.
3. Simulate transmission of the BPSK modulated signal via an AWGN channel with variance N0/2.
4. Detect using an ML decoder and plot the probability of error as a function of SNR per bit Eb/N0.
THEORY
Binary Phase Shift Keying
In a coherent binary PSK system, the pair of signals S1(t) and S2 (t) used to represent binary symbols
1 & 0 are defined by
S1 (t) = √2Eb/τb Cos 2πfct
S2 (t) =√2Eb/Tb (2πfct+π) = - √ 2Eb/Tb Cos 2πfct where 0 ≤ t< Tb and
Eb = Transmitted signed energy for bit
The carrier frequency fc =n/Tb for some fixed integer n.
In BPSK, there is only one basis function of unit energy.
Øb (t) = √2/Tb cos 2fπct 0≤ t< Tb
S1 (t) = √Eb Ø1 (t) 0≤ t ≤Tb
S2 (t) = √Eb Ø1 (t) 0≤ t< Tb
The signal space is 1dimensional (N=1) having two message points (M = 2)
BSPK Receiver:
The received BPSK signal is applied to a correlator which is also supplied with a locally generated
reference signal Ø1 (t). The correlated output is compared with a threshold of zero volts. If x1> 0, the
receiver decides in favour of symbol 1. If x1< 0, it decides in favour of symbol 0.
ALGORITHM
1. Generate a sequence of random bits of ones and zeros of certain length (Nsym typically set in the
order of 10000)
2. Using the constellation points, map the bits to modulated symbols (For example, bit ‘0’ is
mapped to amplitude value A, and bit ‘1’ is mapped to amplitude value -A)
3. Compute the total power in the sequence of modulated symbols and add noise for the
given EbN0 (SNR) value. The noise added symbols are the received symbols at the receiver.
12
4. Use thresholding technique, to detect the bits in the receiver. Based on the constellation
diagram above, the detector at the receiver has to decide whether the receiver bit is above or
below the threshold 0.
5. Compare the detected bits against the transmitted bits and compute the bit error rate (BER).
6. Plot the simulated BER against the SNR values and compare it with the theoretical BER curve
for BPSK over AWGN
MATLAB CODE
% Demonstration of Eb/N0 Vs BER for BPSK modulation scheme
clear;
clc;
%---------Input Fields------------------------
N=10000000; %Number of input bits
EbN0dB = -6:2:10; % Eb/N0 range in dB for simulation
%---------------------------------------------
data=randn(1,N)>=0; %Generating a uniformly distributed random 1s and 0s
bpskModulated = 2*data-1; %Mapping 0->-1 and 1->1
M=2; %Number of Constellation points M=2^k for BPSK k=1
Rm=log2(M); %Rm=log2(M) for BPSK M=2
Rc=1; %Rc = code rate for a coded system. Since no coding is used Rc=1
BER = zeros(1,length(EbN0dB)); %Place holder for BER values for each Eb/N0
index=1;
for k=EbN0dB,
%-------------------------------------------
%Channel Noise for various Eb/N0
%-------------------------------------------
%Adding noise with variance according to the required Eb/N0
EbN0 = 10.^(k/10); %Converting Eb/N0 dB value to linear scale
noiseSigma = sqrt(1./(2*Rm*Rc*EbN0)); %Standard deviation for AWGN Noise
noise = noiseSigma*randn(1,length(bpskModulated));
received = bpskModulated + noise;
%-------------------------------------------
%Threshold Detector
estimatedBits=(received>=0);
%------------------------------------------
13
%Bit Error rate Calculation
BER(index) = sum(xor(data,estimatedBits))/length(data);
index=index+1;
end
%Plot commands follows
plotHandle=plot(EbN0dB,log10(BER),'r--');
set(plotHandle,'LineWidth',1.5);
title('SNR per bit (Eb/N0) Vs BER Curve for BPSK Modulation Scheme');
xlabel('SNR per bit (Eb/N0) in dB');
ylabel('Bit Error Rate (BER) in dB');
grid on;
hold on;
theoreticalBER = 0.5*erfc(sqrt(10.^(EbN0dB/10)));
plotHandle=plot(EbN0dB,log10(theoreticalBER),'k*');
set(plotHandle,'LineWidth',1.5);
legend('Simulated','Theoretical');
grid on;
SAMPLE GRAPH
14
PYTHON CODE
#---------Input Fields------------------------
nSym = 10**5 # Number of symbols to transmit
EbN0dBs = np.arange(start=-4,stop = 13, step = 2) # Eb/N0 range in dB for simulation
BER_sim = np.zeros(len(EbN0dBs)) # simulated Bit error rates
#------------ Transmitter---------------
inputSyms = np.random.randint(low=0, high = M, size=nSym) #Random 1's and 0's as input to
BPSK modulator
s = constellation[inputSyms] #modulated symbols
BER_theory = 0.5*erfc(np.sqrt(10**(EbN0dBs/10)))
fig, ax = plt.subplots(nrows=1,ncols = 1)
ax.semilogy(EbN0dBs,BER_sim,color='r',marker='o',linestyle='',label='BPSK Sim')
ax.semilogy(EbN0dBs,BER_theory,marker='',linestyle='-',label='BPSK Theory')
ax.set_xlabel('$E_b/N_0(dB)$');ax.set_ylabel('BER ($P_b$)')
ax.set_title('Probability of Bit Error for BPSK over AWGN channel')
ax.set_xlim(-5,13);ax.grid(True);
ax.legend();plt.show()
15
2: Error Performance of QPSK
AIM
1. Generate a string of message bits.
2. Encode using QPSK with energy per symbol Es and represent it using points in a signal-space.
3. Simulate transmission of the QPSK modulated signal via an AWGN channel with variance N0/2
in both I-channel and Q-channel.
4. Detect using an ML decoder and plot the probability of error as a function of SNR per bit Eb/N0
where Es = 2Eb.
THEORY
Quadrature Phase Shift Keying
Phase of the carrier takes on one of four equally spaced values such as π/4, 3π/4,
5π/4,7π/4.
Si(t) = √2E/ Tb cos {2 πƒct + (2i – 1) π/4} , 0≤ t ≤ Tb
0 , elsewhere
Where i = 1,2,3,4, & E= Tx signal energy per symbol
Tb = symbol duration
Each of the possible value of phase corresponds to a pair of bits called dibits.
Thus the gray encoded set of dibits: 10,00,01,11
Si (t) = √2E/ Tb cos [(2i – 1)π/4] cos (2πfct) - √2E/ Tb sin [(2i –1) π/4)]
sin (2πfct) ,0≤ t ≤Tb 0 , else where
There are two orthonormal basis functions
Ø1 (t) = √2/ Tb cos 2πƒct, 0≤ t ≤Tb
Ø2 (t) = √2/ Tb sin 2πƒct, 0≤ t ≤Tb
There are four message points
QPSK Transmitter
16
The i/p binary sequence b(t) is represented in polar from with symbols 1 & 0 represented as +√E/2
and -√E/2 .This binary wave is demultiplexed into two separate binary waves consisting of odd &
even numbered I/P bits denoted by b1(t) & b2 (t). b1 (t) & b2(t) are used to modulate a pair of
quadrature carrier or orthogonal Basis function Ø1 (t) & Ø2 (t). The result is two PSK waves’ .These
two binary PSK waves are added to produce the desired QPSK signal .
QPSK Receiver
QPSK receiver consists of a pair of correlators with common I/P & supplied with Locally generated
Signal Ø1 (t) & Ø2 (t). The correlator O/P, x1, & x2 are each compared with a threshold of zero
volts.If x1 > 0, decision is made in favour of symbol ‘1’ for upper channel and if x1 > 0, decision is
made in favour of symbol 0. Parallelly Y x2 >0, decision is made in favour of symbol 1 for lower
channel & if x2 <0, decision is made in favour of symbol 0. These two channels are combined in a
multiplexer to get the original binary output.
ALGORITHM
QPSK Modulation
1. Generate two carrier signals (Ø1 (t) = √2/Tb cos 2πƒct and Ø2 (t) = √2/Tb cos2πƒct)
2. Generate the base band data signal .
3. Binary wave is divided into odd(b1(t)) and even(b2(t)) numbered input bits.
4. Multiply the odd numbered data signal (b1(t)) and carrier signal 1 in one channel .
5. Multiply the even numbered data signal b2 (t)and carrier signal 2in another channel
6. Sum the output resultant signals of step 4 and 5.
7. The resultant signal is a QPSK signal
8. Plot the carrier, data and QPSK signal.
QPSK Demodulation
1. Multiply the received QPSK signal with the carrier signal Ø1 (t) = √2/Tb cos 2πƒct in
one channel and integrate the resultant signal(x1)
2. Multiply the received QPSK signal with the carrier signal Ø2 (t) =√2/Tb cos 2πƒ ct in
another channel and integrate the resultant signal(x2)
3. If x1 is greater than zero then choose 1 and if it is less than 0 choose 0.
4. If x1 is greater than zero then choose 1 and if it is less than 0 choose 0
5. Multiply the resultant signal from step 3 and 4.
6. Plot the demodulated signal.
17
MATLAB CODE
% QPSK MODULATION AND BER ESTIMATION IN AWGN CHANNEL
clc; clear all; close all;
N=1e6; % Number of bits transmited
SNRdB= 0:1:20; % SNR for simulation
SNRlin=10.^(SNRdB/10);
BER = zeros(1,length(SNRlin));% simulated BER
SER = zeros(1,length(SNRlin));% simulated SER
b1 = rand(1,N) > 0.5;
b2 = rand(1,N) > 0.5;
% QPSK symbol mapping
I = (2*b1) - 1;
Q = (2*b2) - 1;
S = I + 1j*Q;
N0 = 1./SNRlin; % Variance
for k = 1:length(SNRdB)
end
BER_theo = 2*qfunc(sqrt(2*SNRlin)); % Theoretical BER
SER_theo = 2*qfunc(sqrt(2*SNRlin)) - (qfunc(sqrt(2*SNRlin))).^2; % Theoretical SER
figure(1);
semilogy(SNRdB, BER_theo,'r-')
hold on
semilogy(SNRdB, BER,'k*')
xlabel('SNR[dB]')
ylabel('Bit Error Rate');
legend('Theoretical', 'Simulated');
title(['Probability of Bit Error for QPSK Modulation']);
grid on;
hold off;
18
figure(2);
semilogy(SNRdB, SER_theo,'r-')
hold on
semilogy(SNRdB, SER,'k*')
xlabel('SNR[dB]')
ylabel('Symbol Error Rate');
legend('Theoretical', 'Simulated');
title(['Probability of symbol Error for QPSK Modulation']);
grid on;
hold off;
SAMPLE GRAPH
19
3 Performance of Waveform Coding Using PCM
AIM
1. Generate a sinusoidal waveform with a DC offset so that it takes only positive amplitude value.
2. Sample and quantize the signal using an uniform quantizer with number of representation levels
L. Vary L. Represent each value using decimal to binary encoder.
3. Compute the signal-to-noise ratio in dB.
4. Plot the SNR versus number of bits per symbol. Observe that the SNR increases linearly.
THEORY
In Pulse code modulation (PCM) only certain discrete values are allowed for the modulating
signals. The modulating signal is sampled, as in other forms of pulse modulation. But any sample
falling within a specified range of values is assigned a discrete value. Each value is assigned a pattern
of pulses and the signal transmitted by means of this code. The electronic circuit that produces the
coded pulse train from the modulating waveform is termed a coder or encoder. A suitable decoder
must be used at the receiver in order to extract the original information from the transmitted pulse
train.
ALGORITHM:
1. Generate a sinusoidal signal with a DC offset of 2.
2. Sample the generated signal.
3. Pass the sampled signal through a quantizer with quantization level=8
4. Encode the signal.
5. Calculate the quantization error and SNR.
6. Vary L and plot the SNR versus number of bits per symbol.
MATLAB CODE
% Generate a sinusoidal waveform with a DC offset so that it takes only positive amplitude value
clear;% clearing the variables
close all;% closing any opened figures
% Plotting the offset sinusoidal signal time = 0:.0005:.05;
freq_msg=100; %wave form frequency dc_ofst=2; % signal offset
signal=sin(2*pi*freq_msg*time)+dc_ofst; %Generating the signal
% plotting the signal figure;plot(time,signal)
xlabel('time') ylabel('Amplitude') title('Signal')
% Binary coding
for i=1:length(index) bincode_sig{i}=dec2bin(round(index(i)),7);
end
disp('binary encoded signal') disp(bincode_sig')
% SNR ratio calculation
noise=quants-samp_signal; % calculating noise
figure;plot(samp_time,noise,'.-') % plotting figure title('Noise')
r=snr(index,noise);% SNR
snr1=['SNR:',num2str(r)]; disp(snr1)
21
% function for ploting Quant_level vs SNR function [ r ] =
IMPL_Quant( l )
% Plotting the offset sinusoidal signal time = 0:.0005:.05;
freq_msg=100; %wave form frequency dc_ofst=2; %
signal offset
signal=sin(2*pi*freq_msg*time)+dc_ofst; %Generating the signal
22
% Uniform Quantizer
L=l; %No of Quantization levels smin=round(min(signal));
smax=round(max(signal));
Quant_levl=linspace(smin,smax,L); % Length 8, to represent
9 intervals
codebook = linspace(0.7,smax,L+1); % Length 9, one entry for each interval
[index,quants] = quantiz(samp_signal,Quant_levl,codebook);
% Quantize.
% Binary coding
for i=1:length(quants) bincode_sig{i}=dec2bin(round(quants(i)),3);
end
end
23
4.PULSE SHAPING AND MATCHED FILTERING
AIM:
1. Generate a string of message bits.
2. Use root rasied cosine pulse p(t) as the shapig pulse, and generate the corresponding baseband signal with
a fixed bit duration Tb. You may use roll-off factor as α = 0.4.
3. Simulate transmission of baseband signal via an AWGN channel
4. Apply matched filter with frequency response Pr(f ) = P ∗(f ) to the received signal.
5. Sample the signal at mTb and compare it against the message sequence.
THEORY:
Pulse Shaping
In communications, digital signals need to be mapped to an analog waveform in order to be transmitted over
the channel. The mapping process is accomplished in two steps: (i) Mapping from source bits to complex
symbols (also known as constellation points) (ii) Mapping from complex symbols to analog pulse
trains(which is used here).
In our pulse shaping scheme, we introduce a set of complex-valued symbols as the input. These symbols are
mapped from a bit stream via digital modulation. The bit stream may represent any data format (e.g., text,
image, voice, video, etc). These complex-valued symbols are passed through the pulse shaping filter. A
representation of this process is shown in Fig.1 below.
Pulse shaping filter must be chosen carefully not to introduce inter-symbol interference. Here we
will be using raised cosine filter for pulse shaping.
Raised-cosine pulse: This is a pulse widely used in practice. The pulse shape and the excess
bandwidth can be controlled by changing the roll-off factor (0≤α≤1, where 0 means no excess
bandwidth, and 1 means maximum excess bandwidth). The frequency responses of raised-cosine
pulses with different roll-off factors are shown in Fig. 2 below:
24
goal if both filters have a transfer function that is equal to the square root of that of the raised cosine
filter. Such a filter is therefore called a root raised cosine (RRC). The combination of both RRC
filters then becomes a raised cosine and thus fulfils the Nyquist criterion. Furthermore, since the
filters are real-valued and symmetric, the RRC is its own matched filter. The impulse response of
the RRC filter is given as
Matched Filtering
The receiver’s RF front-end receives analog pulse trains. The information bits need to be recovered
from these pulse trains. This is accomplished in two steps: (i) Mapping from analog pulse trains to
constellation points. (ii) Mapping from complex symbols to bits, which is Detection.
The received analog signals are matched filtered to create the output complex waveform. Then the
samples are detected. A representation of this process is shown in Fig.3 below.
ALGORITHM:
MATLAB CODE
% Program for pass a signal through a square-root, raised cosine filter.
% Pulse Shaping and Matched Filtering
close all;
clear;
rolloff = 0.4; % Rolloff factor
span = 10; % Filter span in symbols
sps = 7; % Samples per symbol
M = 16; % Modulation order
k = log2(M); % Bits per symbol
25
% Generate the square-root, raised cosine filter coefficients.
rctFilt = rcosdesign(rolloff, span, sps,'normal');
fvtool(rctFilt,'Analysis','impulse')
% Add noise.
rxSignal = rxSignal + randn(size(rxSignal))*.01;
26
27
5.EYE DIAGRAM
AIM:
1. Generate a string of message bits.
2. Use rasied cosine pulse p(t) as the shapig pulse, and generate the corresponding baseband
signal with a fixed bit duration Tb. You may use roll-off factor as α = 0.4.
3. Use various roll off factors and plot the eye diagram in each case for the received signal. Make
a comparison study among them.
THEORY:
ALGORITHM:
MATLAB CODE
% Add noise.
rxSignal = rxSignal + randn(size(rxSignal))*.01;
eyediagram(BP_Data,2);legend('Transmitted signal')
eyediagram(rxSignal,2);legend('Recieved signal')
eyediagram(rxFiltSignal,2);legend('Filtered signal')
29
30
PART C
FAMILIARIZATION WITH SOFTWARE DEFINED RADIO (HARDWARE
AND CONTROL SOFTWARE)
AIM:
1.To Familiarize with an SDR hardware for reception and transmission of RFsignal.
2.To Familiarize how it can be interfaced with computer.
3.To Familiarize with GNU Radio (or similar software’s like Simulink/ Lab-View) that can be used
to process the signals received through the SDRhardware.
4.To Familiarize available blocks in GNU Radio. Study how signals can begenerated and spectrum
(or power spectral density) of signals can beanalyzed. Study how filtering can be performed.
31
Block Diagram of SDR Dongle
32
FM RECEPTION
Aim:
To receive digitized FM signal (for the clearest channel in the lab) using the SDR board.
SDR# (SDRSharp) Set Up
4. Plug in SDR dongle. In the folder where you extracted the sdrsharp files find the file
called zadig.exe. Right click this file and select "Run as administrator".
5. In Zadig, go to "Options->List All Devices" and make sure this option is checked.
33
6. Select "Bulk-In, Interface (Interface 0)" from the drop down list.
7. We need to install the WinUSB driver, so also ensure that WinUSB is selected in the box after
the arrow next to where it says Driver (this is the default selection). The box to the left of the
green arrow is not important, and it may show (NONE) or (RTL...). This left hand box
indicates the currently installed driver, and the box to the right the driver that will be installed
after clicking Replace/Install Driver.
8. Click Replace Driver. On some PC's you might get a warning that the publisher cannot be
verified, but just accept it by clicking on "Install this driver software anyway". This will install
the drivers necessary to run the dongle as a software defined radio.
34
9. Open SDRSharp.exe and set the "Source" drop down box to 'RTL-SDR USB'. This "Source"
tab is on the lower left menu bar by default.
10. Press the Play button (the right facing triangle in the top left of the program).RTL-SDR
software radio should now be set up and ready to use.
11. Also adjust the RF gain settings by pressing the Configure button up the top next to the Play
button. By default the RF gain is set at zero. A gain of zero will probably receive nothing but
very strong broadcast FM - increase the gain until you start seeing other signals.
35
12. Press Start or alternatively press F2. This will start the SDR.
13. To set the RTL-SDR sample rate, gain and frequency correction click on the ExtIO button
.
14. To tune to a station, change the Local Oscillator frequency to a frequency near the
frequency you are interested in. Then tune to the desired frequency either by clicking in
the RF spectrum, or using the Tune numbers.
15. You can zoom in and out of the spectrum by using the Zoom slider which is to the left of
the word zoom.
17. After clicking on the FM mode button, the FM bandwidth can be manually modified with
the FM-BW slider.
36
18. To listen to a typical wideband broadcast FM station, you will need to change the audio
sampling rate to 192000 Hz. Do this by clicking on the Bandwidth button or alternatively
by pressing F6 and then selecting the output sampling rate as 192000 Hz.
37
Familiarize with GNU Radio
Aim:
To familiarize available blocks in GNU Radio. Study how signals can be generated and spectrum (or
power spectral density) of signals can be analysed. Study how filtering can be performed.
GNU Radio
GNU Radio is a free & open-source software development toolkit that provides signal processing
blocks to implement software radios. It can be used with readily-available low-cost external RF
hardware to create software-defined radios, or without hardware in a simulation-like environment. It
is widely used in research, industry, academia, government, and hobbyist environments to support
both wireless communications research and real-world radio systems.
1. Open a terminal window using: Applications > Accessories > Terminal. At the prompt type:
gnuradio-companion.
38
Double click on the Options block. This block sets some general parameters for the flow graph. Type
in a project title (such as tutorial) and author. Set Generate Options to QT GUI, Output language to
Python. Then close the properties window. The other block that is present is the Variable block. It is
used to set the sample rate.
2. On the right side of the window is a list of the blocks that are available. By expanding any of
the categories (click on triangle to the left) you can see the blocks available. Explore each of
the categories so that you have an idea of what is available.
3. Open the Waveform generators category and double click on the Signal Source. Note that a
Signal Source block will now appear in the main window. Double click on the block and the
properties window will open. Adjust the settings to match those as shown in the figure below
and close the window. This Signal Source is now set to output a real valued 1KHzsinusoid
with an amplitude of .5. Change the output type to float.
39
4. In order to view this wave we need one of the graphical sinks. Choose
Core→Instrumentation→ QT →QT GUI Time sink and then double click on it
5. Change the type to float. This sink will act as an oscilloscope. If you want multiple
channel, increase the number of inputs to 2.
40
6. In order to connect these two blocks, click once on the “out” port of the Signal Source, and
then once on the “in” port of the Scope Sink. The following flow graph should be displayed.
7. In order to observe the operation of this simple system we must generate the flow
graph and then execute it. Click first on the “Generate the flow graph” icon. A box will come
up in which you enter the name of the file. Name this file: tutorial1.grc and save. Click the
“Execute the flow graph” icon. A scope plot should open displaying several cycles of the
sinusoid.
41
8. Go back to QT GUI sink properties and switch on control panel under config Re run the flow
graph
9. Add QT GUI frequency sink . Change the Type to Float and show control panel and leave the
remaining parameters at their default values.
10. Connect this to the output of the Signal Source by clicking on the out port of the Signal Source
and then the in port of the QT GUI Sink. Generate and execute the flow graph. You should
observe the scope as before along with an FFT plot correctly showing the frequency of the
input at 1KHz. Close the output windows.
11. Now bring in an Audio sink. Create the flow graph shown below. The Audio Sink is found
in Core->Audio -> Audio Sinks category. Generate and execute the flow graph. Along with
graphical display of the signal you can hear the 1KHz tone.
42
12. Construct the flow graph shown below. Set the sample rate to 32000. The two Signal Sources
should have frequencies of 1000 and 800, respectively. The Add block is found in the Math
Operators category.
13. Generate and execute the flow graph. On the Scope plot you should observe a waveform
corresponding to the sum of two sinusoids. On the FFT plot you should see components at
both 800 and 1000 Hz.
43
15. Modify the flow graph to include a Low Pass Filter block as shown in the figure below. This
block is found in the Core→ Filters category. Multiply block outputs a 200Hz and a 1.8KHz
sinusoid. We want to create a filter that will pass the 200Hz and block the 1.8KHz component.
Set the low pass filter to have a cutoff frequency of 1KHz and a transition width of 200 Hz.
Use a Rectangular Window. Generate and execute the flow graph. Only the 200Hz component
passes through the filter.
44
RTL-SDR for RF Signal Capture on GNU Radio
45
46