0% found this document useful (0 votes)
13 views29 pages

CE LAB MANUAL FINAL

The document is a laboratory manual for Communication Engineering at LBS College of Engineering, outlining experiments on FM generation and demodulation, BPSK modulation, PCM performance, pulse shaping, and eye diagram analysis. Each experiment includes aims, required components, theoretical background, design considerations, procedures, and results. The manual serves as a practical guide for students to understand and implement various communication techniques using specific circuits and MATLAB programs.

Uploaded by

kgautham134
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views29 pages

CE LAB MANUAL FINAL

The document is a laboratory manual for Communication Engineering at LBS College of Engineering, outlining experiments on FM generation and demodulation, BPSK modulation, PCM performance, pulse shaping, and eye diagram analysis. Each experiment includes aims, required components, theoretical background, design considerations, procedures, and results. The manual serves as a practical guide for students to understand and implement various communication techniques using specific circuits and MATLAB programs.

Uploaded by

kgautham134
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 29

ECL 332.

COMMUNICATION ENGINEERING
LAB

2019 SCHEME
LABORATORY MANUAL

PREPARED BY REVIEWED
BY

APPROVED BY

DEPARTMENT OF ELECTRONICS AND COMMUNICATIONENGINEERING

LBS COLLEGE OG ENGINEERING, KASARAGOD

KASARAGOD- 671542
PART A
EXPERIMENT NO.1
FM GENERATION AND DEMODULATION USING PLL
AIM
To design and set up a frequency modulator and demodulator circuit using PLL IC 565
COMPONENTS REQUIRED
IC 565, resistors, capacitors, signal generator, DC supply
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. A Phase-locked
loop(PLL) has a voltage-controlled oscillator(VCO).The VCO signal and an input signal are
sent to a phase comparator which generates an error voltage part to any difference in
frequency between two signals. The error voltage adjusts the VCO frequency to match that of
the input signal. Thus, the PLL can track an input signal or only the VCO function can be
used. Thus, the frequency generated by the VCO of PLL is varied by the input signal applied.
For the demodulation, another 565 IC is used. The centre frequency of the VCO of the
demodulator is made the same as that of the modulator. The variation of the input frequency
from the centre frequency is converted into the variation of the voltage by the phase detector
of the demodulator.
DESIGN
Let V+=10 v and V-=-10 v
Let the centre frequency of the FM be fo=1.2/(4 R1C1)=2.5kHz
Take C1=0.01µF .Then,R1=12 KΩ
The value of R1 satisfies the required condition 2k<R2 <20k
Take C3=0.01µF and C2=10µF.
PROCEDURE
1.Set up the FM generator circuit and feed 5 VPP,1 kHz sine wave input and observe the
output.
2. Set up the demodulator circuit and feed the FM signal to it. Observe the demodulated
output.
CIRCUIT DIAGRAM

LBS COLLEGE OF ENGINEERING,KASARAGOD


WAVEFORMS

RESULT
The circuit for the FM modulation and demodulation has been set up and output obtained.

Experiment No.2
Generation and Detection of BPSK
AIM:
To design and set up a Binary Phase Shift Keying(BPSK) circuit.
COMPONENTS REQUIRED:
Resistors, ICs CD 4016,741 and bread board
THEORY
In the BPSK system, out of phase signals are transmitted corresponding to the binary input.
When modulation input signal is at logic 1, a finite number of cycles of a sinusoidal signals
are transmitted and when the input signal is at logic 0, phase of thesinusoidal signal is
changed. Op-amp functioning as inverting amplifier provides 180° phase shift and unity gain.
BPSK signal has constant amplitude. Therefore the noise can be removed easily.
CIRCUIT DIAGRAM

LBS COLLEGE OF ENGINEERING,KASARAGOD


DESIGN
Gain of inverting amplifier,A=-Rf/Ri
Let the gain be -1 so that the ratio Rf/Ri=1
Take Rf=Ri=4.7kΩ
PROCEDURE
1. Test all the components and probes.
2. Set up the circuits on the bread board as shown in figure.
3. Feed 2Vpp, 1 KHz sine wave as carrier input and 10 Vpp, 200Hz square wave signal as
the message input.
4. Observe the BPSK output on CRO and plot the waveforms.
5. Feed this BPSK modulated signal to the inverting input of the demodulator. Also feed the
unmodulated carrier signal ( 2 Vpp, 1 Khz ) tothe non-inverting input.
6. Observe waveform on DSO, Adjust potentiometer to obtain the correct output( If needed).
7. Plot waveforms.

WAVEFORMS

LBS COLLEGE OF ENGINEERING,KASARAGOD


RESULT

The circuit for the BPSK modulation and demodulation has been set up and output obtained.

PART B
EXPERIMENT NO.1
PERFORMANCE OF WAVEFORM CODING USING PCM
AIM

1. Generate a sinusoidal waveform with a DC offset so that it takes onlypositive amplitude


value.
2. Sample and quantize the signal using an uniform quantizer with number ofrepresentation
levels L. Vary L. Represent each value using decimal tobinary encoder.
3. Compute the signal-to-noise ratio in dB.
4. Plot the SNR versus number of bits per symbol. Observe that the SNRincreases linearly.
THEORY
Pulse-code modulation (PCM) is a method used to digitally represent sampled analog signals.
It is the standard form of digital audio in computers, compact discs, digital telephony and
other digital audio applications. In a PCM stream, the amplitude of the analog signal is
sampled regularly at uniform intervals, and each sample is quantized to the nearest value
within a range of digital steps.

Pulse code modulation is a process of converting ananalog signal into digital. The voice or
any data input is first sampled using a sampler (which is a simple switch) and then quantized.
Quantization is the process of converting a given signal amplitude to an equivalent binary
number with fixed number of bits. This quantization can be either midtread or mid-raise and

LBS COLLEGE OF ENGINEERING,KASARAGOD


it can be uniform or non-uniform based on the requirements. For example in speech signals,
the higher amplitudes will be less frequent than the low amplitudes. So higher amplitudes are
given less step size than the lower amplitudes and thus quantization is performed non-
uniformly. After quantization the signal is digital and the bits are passed through a parallel to
serial converter and then launched into the channel serially.
At the demodulator the received bits are first converted into parallel frames and each frame is
de-quantized to an equivalent analog value. This analog value is thus equivalent to a sampler
output. This is the demodulated signal.In the kit this is implemented differently. The analog
signal is passed through ADC (Analog to Digital Converter) and then the digital codeword is
passed through aparallel to serial converter block. This is modulated PCM.This is taken by
the Serial toParallel converter and then through a DAC to get the demodulated signal. The
clock is given to all these blocks for synchronization. The input signal can be either DC or
AC according to the kit. The waveforms can be observed on a CRO for DC without
problem.AC also can be observed but with poor resolution.

MATLAB PROGRAM
clc;
close all;
clear all;
n=input('Enter for n-bit PCM system : '); %Encodebook Bit Length
fs=input('Enter Sampling Frequency : '); %Sampling Frequency
L = 2^n; %Number of Quantisation Levels
%% Here we pllot the Analog Signal and its Sampled form
Vmax = 8;
x = 0:pi/fs:4*pi; %Construction of Signal
ActualSignl=(Vmax*sin(x)); %Actual input
subplot(3,1,1);
plot(x,ActualSignl);
title('Analog Signal');
subplot(3,1,2); %Sampled Version
stem(x,ActualSignl);grid on; title('Sampled Sinal');
%% Now perform the Quantization Process
Vmin=-Vmax; %Since the Signal is sine
StepSize=(Vmax-Vmin)/L; % Diference between each quantisation level
QuantizationLevels=Vmin:StepSize:Vmax; % Quantisation Levels - For comparison
codebook=Vmin-(StepSize/2):StepSize:Vmax+(StepSize/2); % Quantisation Values -
As Final Output of qunatiz
[ind,q]=quantiz(ActualSignl,QuantizationLevels,codebook); % Quantization process
NonZeroInd = find(ind ~= 0);
ind(NonZeroInd) = ind(NonZeroInd) - 1;
% MATLAB gives indexing from 1 to N.But we need indexing from 0, to convert it
into binary codebook
BelowVminInd = find(q == Vmin-(StepSize/2));
q(BelowVminInd) = Vmin+(StepSize/2);
%This is for correction, as signal values cannot go beyond Vmin

LBS COLLEGE OF ENGINEERING,KASARAGOD


%But quantiz may suggest it, since it return the Values lower than Actual
%Signal Value
subplot(3,1,3);
stem(q);
grid on; % Display the Quantize values
title('Quantized Signal');
%% Having Quantised the values, we perform the Encoding Process
figure
TransmittedSig = de2bi(ind,'left-msb'); % Encode the Quantisation Level
SerialCode =
reshape(TransmittedSig',[1,size(TransmittedSig,1)*size(TransmittedSig,2)]);
subplot(2,1,1);
grid on;
stairs(SerialCode); % Display the SerialCode Bit Stream
axis([0 100 -2 3]);
title('Transmitted Signal');
%% Now we perform the Demodulation Of PCM signal
RecievedCode=reshape(SerialCode,n,length(SerialCode)/n); %Again Convert the
SerialCode into Frames of 1 Byte
index = bi2de(RecievedCode','left-msb'); %Binary to Decimal Conversion
q = (StepSize*index); %Convert into Voltage Values
q = q + (Vmin+(StepSize/2)); % Above step gives a DC shfted version of Actual
siganl
%Thus it is necessary to bring it to zero level
subplot(2,1,2);
grid on;
plot(q); % Plot Demodulated signal
title('Demodulated Signal');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Bitrate=n*fs
QNoise=((StepSize)^2)/12
SNRdB=(1.76+(6*n))
%XXXXXXXX SNR of PCM modulation Technique XXXXXXXXX
num_bit=50;%number of bit
SNRdB=0;
for(n=1:num_bit)
SNRdB=(1.76+(6*n));% SNR in dB
%SNR=10.^(SNRdB/10);
semilogy(SNRdB,n,'o','linewidth',2.5),grid on,holdon;
title(' Plot of SNR versus n for PCM');
xlabel('SNR');
ylabel('n');
end
%XXXXXXXXXXXXXXXXXXXX End of program XXXXXXXXXXXXXXXXX
RESULT
Signal to NoiseRatio(SNR) =19.8Db

LBS COLLEGE OF ENGINEERING,KASARAGOD


LBS COLLEGE OF ENGINEERING,KASARAGOD
n

EXPERIMENT No.2
Pulse Shaping and Matched Filtering

AIM
1. Generate a string of message bits.
2. Use root raised cosine pulse p(t) as the shaping pulse, and generate the corresponding
baseband signal with a fixed bit duration Tb. 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 is the process of changing the waveform of transmitted pulses. Its purpose is
to make the transmitted signal better suited to the channel by limiting the
effective bandwidth of the transmission. By filtering the transmitted pulses this way,
the intersymbol interference caused by the channel can be kept in control. The signal's
spectrum is determined by the modulation scheme and data rate used by the transmitter, but
can be modified with a pulse shaping filter. Pulse shaping makes the spectrum smooth.
Sender side pulse shaping is often combined with a receiver side matched filter to achieve
optimum tolerance for noise in the system. In this case the pulse shaping is equally
distributed between the sender and receiver filters.
Root Raised Cosine Filter (RRC)

LBS COLLEGE OF ENGINEERING,KASARAGOD


● The rolloff factor β is a measure of the excess bandwidth of the filter, i.e., the bandwidth
occupied beyond the Nyquist bandwidth of 1/2T, where 1/T is symbol rate.
● As rolloff increases eye in the eye diagram opens up. This means that if there were no
bandwidth restrictions it would be easier on the receiver if one used a large rolloff. (However,
for bandwidth efficiency rolloff should be smaller.)
● Smaller rolloff gives narrower bandwidth. However, its side lobes increases so attenuation
in stop band is reduced.
PULSE SHAPING USING RRC FILTER
The modulator generates one symbol for each pair of data bits. The symbols generated by the
modulator is up sampled and pulse shaped (filtered) to comply with the channel bandwidth
restrictions. Typically, the pulse shaping is the last stage of transmitter.RRC filter filters out
the signal (i.e., equalizes to give a nearly zero Intersymbol Interference, ISI, if Tx is also
using RRC filter pulse shaping). The output is sampled at the optimum points (i.e., down-
sampled) to give one sample per constellation symbol. Demodulator finds out which quadrant
the received sample falls and based on that decision generates a pair of bits.Matching TX and
RX filters achieves optimum Bit Error Rate (BER) performance.

PROGRAM

% % Program for pass a signal through a square-root, raised cosine filter.


% % Pulse Shaping and Matched Filtering
clc;
close all;
clear all;
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
% Generate the square-root, raised cosine filter
coefficients.
rctFilt = rcosine(10,60,'sqrt',rolloff);
fvtool(rctFilt,'Analysis','impulse')
% Create a vector of bipolar data.

LBS COLLEGE OF ENGINEERING,KASARAGOD


BP_Data = 2*randi([0 1], 50, 1) - 1;
% Upsample and filter the data for pulse shaping.
UP_s = upfirdn(BP_Data, rctFilt, sps,1);
% Using the number of bits per symbol (k) and the number
of samples per symbol (sps),
% convert the ratio of energy per bit to noise power
spectral density (EbNo)
% to an SNR value for use by the awgn function.
EbNo = 50;
snr = EbNo + 10*log10(k) - 10*log10(sps);
filtlen = 10; % Filter length in symbols
rxSignal = awgn(UP_s,snr,'measured');% filtering the
signal through an AWGN channel.
rxSignal = rxSignal + randn(size(rxSignal))*.01;% Add
noise.
rctmatchfilt=conj(rctFilt); %p(f)=conjugate of p(f)
fvtool(rctmatchfilt,'Analysis','impulse')
rxFiltSignal = upfirdn(rxSignal,rctmatchfilt,1,sps);
% Downsample and Matched filtering
rxFiltSignal = rxFiltSignal(filtlen + 1:end - filtlen); %
Account for delay
% Plotting the function
figure;
stem(BP_Data,'filled')
hold on
plot(rxFiltSignal,'r')
xlabel('Time'); ylabel('Amplitude');
legend('Transmitted Data','Received Data')
figure;
plot(rxSignal)
legend('Filtered signal through AWGN')

RESULT
Amplitude

LBS COLLEGE OF ENGINEERING,KASARAGOD


Amplitude

LBS COLLEGE OF ENGINEERING,KASARAGOD


EXPERIMENT NO.3
EYE DIAGRAM
AIM
1. Generate a string of message bits.
2. Use raised cosine pulse p(t) as the shaping pulse, and generate the corresponding baseband
signal with a fixed bit duration Tb. 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

An effective way to study the effects of ISI is the Eye Pattern. The name Eye Pattern was
given from its resemblance to the human eye for binary waves. The interior region of the eye
pattern is called the eye opening. Jitter is the short-term variation of the instant of digital
signal, from its ideal position, which may lead to data errors.When the effect of ISI increases,
traces from the upper portion to the lower portion of the eye opening increases and the eye
gets completely closed, if ISI is very high.
An eye pattern provides the following information about a particular system.
 Actual eye patterns are used to estimate the bit error rate and the signal-to-noise ratio.
 The width of the eye opening defines the time interval over which the received wave can
be sampled without error from ISI.
 The instant of time when the eye opening is wide, will be the preferred time for sampling.
 The rate of the closure of the eye, according to the sampling time, determines how
sensitive the system is to the timing error.
 The height of the eye opening, at a specified sampling time, defines the margin over
noise.

 The rolloff factor is a measure of the excess bandwidth of the filter, i.e., the bandwidth
occupied beyond the Nyquist bandwidth of 1/2T, where 1/T is symbol rate
● As rolloff increases eye in the eye diagram opens up. This means that if there were no
bandwidth restrictions it would be easier on the receiver if one used a large rolloff. (However,
for bandwidth efficiency rolloff should be smaller.)
● Smaller rolloff gives narrower bandwidth. However, its side lobes increases so attenuation
in stop band is reduced.

PROGRAM
clc
clear all
close all
fs=20;%sampling rate
fd=1;%doppler shift
pd=500;%Total number of message bits
x=randint(pd,1,2);
a=length(x);
delay=3;
%rolloff factor 0.2

LBS COLLEGE OF ENGINEERING,KASARAGOD


rcv1=rcosflt(x,fd,fs,'fir/normal',0.2,delay);
%rolloff factor 0.4
rcv2=rcosflt(x,fd,fs,'fir/normal',0.4,delay);
%rolloff factor 0.6
rcv3=rcosflt(x,fd,fs,'fir/normal',0.6,delay);
%rolloff factor 0.8
rcv4=rcosflt(x,fd,fs,'fir/normal',0.8,delay);
n=fs/fd;
eyediagram(rcv1,n)%for plotting eye diagram for rolloff
factor 0.2
eyediagram(rcv2,n)%for plotting eye diagram for rolloff
factor 0.4
eyediagram(rcv3,n)%for plotting eye diagram for rolloff
factor 0.6
eyediagram(rcv4,n)%for plotting eye diagram for rolloff
factor 0.8
RESULT
Amplitude

Amplitude

Roll of factor=0.2 Roll of factor=0.4


Amplitude

Amplitude

Roll of factor=0.6 Roll of factor=0.8


Closing of eye shows the effect of increase in ISI and opening of eye shows the reduction of
ISI.

LBS COLLEGE OF ENGINEERING,KASARAGOD


EXPERIMENT NO.4
ERROR PERFORMANCE OF BPSK
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 (BPSK) is a type of digital modulation technique in which we are
sending one bit per symbol i.e., ‘0’ or a ‘1’. Hence, the bit rate and symbol rate are the same.
Depending upon the message bit, we can have a phase shift of 0o or 180o with respect to a
reference carrier as shown in the figure above.
For example, we can have the following transmitted band-pass symbols:

Or

Where ‘E’ is the symbol energy, ‘T’ is the symbol time period, f is the frequency of the
carrier.
There are only two in-phase components and no quadrature component.
PROGRAM
clc
clear all
close all
N=10000;% number of bits
msg=randi([0 1],1,N);% Generation of message bits
EbNodb=1:1:7;
R=1;% Uncoded signal is given so the rate is 1
fori=1:1:7
EbNo=10^(EbNodb(i)/10);
sigma=sqrt(1/(2*R*EbNo));% calculation of varience
s=2*msg-1;%Bits to symbol conversion
r=s+sigma*randn(1,N);% AWGN noise addition
msgcap=(r>0);% Detection process
error=0;
for j=1:N
error=error+sum(abs(msg(j)-msgcap(j)));
end

LBS COLLEGE OF ENGINEERING,KASARAGOD


err(i)=error./N;% Calculation of Practical bit error rate
BERthery(i)=0.5*erfc(sqrt(EbNo));% Calculation of
Theoritical bit error rate
end
semilogy(EbNodb,err,'-.*g');
hold on
grid on
semilogy(EbNodb,BERthery,'r');
xlabel('Eb/No')
ylabel('BER')
title('BER Performance of BPSK')
legend('Practical BER','Theoritical BER')

RESULT
BER

EXPERIMENT NO.5
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 (QPSK) is a form of Phase Shift Keying in which two bits are
modulated at once, selecting one of four possible carrier phase shifts (0, 90, 180, or 270 degrees).

LBS COLLEGE OF ENGINEERING,KASARAGOD


Instead of the conversion of digital bits into a series of digital stream, it converts them into bit
pairs. This decreases the data bit rate to half, which allows space for the other
users.ThusQPSK allows the signal to carry twice as much information as ordinary PSK using the
same bandwidth. QPSK is used for satellite transmission of MPEG2 video, cable modems,
videoconferencing, cellular phone systems, and other forms of digital communication over an RF
carrier.
MATLAB PROGRAM
clear all;%Clear all variables
close all;%Close all figures
L=1e6;
EbNodB=0:2:10;
EbNo=10.^(EbNodB/10);
for n=1:length(EbNodB)
data_inphase=randint(1,L); %In-phase data generation
data_quadrature=randint(1,L);
si=2*data_inphase-1;%In-phase symbol generation
sq=2*data_quadrature-1;%Quadrature symbol generation
s=si+j*sq;%Adding the two parallel symbol streams
w=(1/sqrt(2*EbNo(n)))*(randn(1,L)+j*randn(1,L));%Random
noise generation
r=s+w;%Received signal
si_=sign(real(r));%In-phase demodulation
sq_=sign(imag(r));%Quadrature demodulation
ber1=(L-sum(si==si_))/L;%In-phase BER calculation
ber2=(L-sum(sq==sq_))/L;%Quadrature BER calculation
ber(n)=mean([ber1 ber2]);%Overall BER
end
BER_theo = (1/2)*erfc(sqrt(EbNo)); % Theoretical BER
semilogy(EbNodB,ber,'-.*g');
hold on
grid on
semilogy(EbNodB,BER_theo,'r');
xlabel('Eb/No')
ylabel('BER')
title('BER Performance of QPSK')
legend('Practical BER','Theoritical BER')

RESULT

LBS COLLEGE OF ENGINEERING,KASARAGOD


BER

PART C
EXPERIMENT NO.1
FAMILIARIZATION WITH SOFTWARE DEFINED RADIO (HARDWARE AND
CONTROL SOFTWARE)
AIM
1. Familiarize with an SDR hardware for reception and transmission of RF signal.
2. Familiarize how it can be interfaced with computer.
3. Familiarize with GNU Radio that can be used to process the signals received through the
SDRhardware.
4. 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.
HARDWARES REQUIRED
RTL2832U Software Defined Radio(RTL-SDR),RF coaxial SMA cable, telescopic
antenna,Computer
SOFTWARES REQUIRED
GNU Radio Companion,gqrx

THEORY

LBS COLLEGE OF ENGINEERING,KASARAGOD


Familiarization of RTL SDR hardware interfacing with computer
On an Ubuntu system, Open a terminal window using: Applications > Accessories >
Terminal. At the prompt type the commands sudo apt install gqrx-sdrto install gqrx
software and sudo apt install gnuradioto install GNU Radio Companion software.

Once you finish the installation,typelsusbcommand which lists all usb devices
connected.Now connect the SDR hardware to the usb port and then again type
lsusbcommand in terminal which lists the RTL2838 SDR device also.

LBS COLLEGE OF ENGINEERING,KASARAGOD


Now type gqrxand a popup window will appear to configure the I/O device.

Finally below window will appear in which you can type the frequency of a station from the
available FM frequencies to heara particular FM station.

LBS COLLEGE OF ENGINEERING,KASARAGOD


Familiarization of GNU Radio Companion
GNU Radio Companion (GRC) is a graphical user interface that allows you to build GNU
Radio flow graphs.
1. Open a terminal window using: Applications > Accessories > Terminal. At the
prompt type: gnuradio-companion.
2. untitled GRC window similar to the one below should open.

3. Double click on the Options block. This block sets some general parameters for the
flow graph. Change the id to lesson1, Type in a project title (such as lesson_demo1)
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.

4. 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.
5. Open the Waveform generators category and double click on the Signal Source. Note
that aSignal Source block will now appear in the main window. Double click on the
block and theproperties window will open. Adjust the settings to match those as
shown in the figurebelow and close the window. This Signal Source is now set to

LBS COLLEGE OF ENGINEERING,KASARAGOD


output a real valued 1KHzsinusoid with an amplitude of .5. Change the output type to
float

6. 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.
Change the type to float. This sink will act as an oscilloscope. If you want multiple
channel, increase the number of inputs to 2. Explore various parameter such as labels
7. 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.

8. 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. Confirm that the frequency and amplitude match the
value that you expect.
Experiment with the controls on the scope plot.

LBS COLLEGE OF ENGINEERING,KASARAGOD


9. Go back to QT GUI sink properties and switch on control panel under config Re run
the flow graph.

10. Move the cursor over the curve you can see the actual sample values. Recall that the
Variable block set the sampling rate to 32000 samples/second or 32 samples/ms. Note
that there are in fact 32 samples within one cycle of the wave.

11. Add QT GUI frequency sink . Change the Type to Float and show control panel and
leave the remaining parameters at their default values.Connect this to the output of the
Signal Source by clicking on the out port of the SignalSource 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 thefrequency of the input at
1KHz. Close the output windows.

LBS COLLEGE OF ENGINEERING,KASARAGOD


12. 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
13. Construct the flow graphs shown below to add and multiply two sinusoids of
frequencies 1000Hz and 800 Hz.Observe the output waveform and frequency
spectrum

14. 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. Recall that the Multiply
block outputs a 200Hz and a 1.8KHz sinusoid. We want to create a filter that will pass

LBS COLLEGE OF ENGINEERING,KASARAGOD


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. You should observe that only the 200Hz
component passes through the filter.

15. Open a file browser in Ubuntu . Go to the directory that contains the GRC file that
you have been working on. If you are unsure as to where this is, the path to this file is
shown in the bottom portion of the GRC window. In addition to saving a “.grc” file
with your flow graph, note that there is also a file titled “demo1py”. Double click on
this block. You will be given the option to Run or Display this file. Select Display.
This is the Python file that is generated by GRC. It is this file that is being run when
you execute the flow graph. You can modify this file and run it from the terminal
window. This allows you to use features that are not included in GRC. Keep in mind
that every time you run your flow graph in GRC, it will overwrite the Python script
that is generated. So, if you make changes directly in the Python script that you want
to keep, save it under another name.
EXPERIMENT NO.2
FM RECEPTION
AIM
1. Receive digitized FM signal (for the clearest channel in the lab) using the SDR board.
2. Set up an LPF and FM receiver using GNU Radio.
3. Use appropriate sink in GNU Radio to display the spectrum of signal.
4. Resample the voice to make it suitable for playing on computer speaker
THEORY
Assume that your carrier frequency is fc an modulating signal frequency is
fm
FM can be generated by changing the phase of carrier.

FM TRANSMITTER

LBS COLLEGE OF ENGINEERING,KASARAGOD


To add a QT GUI range widget to the flow graph,double click on the block
and set the parameters as shown below.

Now you can vary the frequency of the first Signal Source using the slider.Similarly we can
add range chooser for the other signal source(carrier) and for modulation index β. We can
control fm,fc and Beta with them. Complex to real extracts the real part.

LBS COLLEGE OF ENGINEERING,KASARAGOD


Carefully look at the colors of various outputs. The complex ones are shown in blue and real
ones are shown as saffron. The output of the above flow graph is shown below.

FM RECEPTION

LBS COLLEGE OF ENGINEERING,KASARAGOD


FM RECEPTION USING RTL SDR

The RTL SDR source will provide I and Q signals from the FM station. We can directly
recover the message using a conjugate multiplier and delay as shown above. Complex to arg
takes in a complex stream and outputs each complex value's Arg(arctan).The output is a

LBS COLLEGE OF ENGINEERING,KASARAGOD


float.Thesampling rateof RTL SDR is 2MHz.A rational re samplerconverts the samples to
500KHz . The demodulated output is again re sampled to suit the audio sink which works at
48KHz.

FM DEMODULATION WITHOUT RTL SDR

Here used a file source in place RTL SDR block.This file source contains already recorded
I/Q data.

LBS COLLEGE OF ENGINEERING,KASARAGOD

You might also like