You are on page 1of 23

1

ELEC 450 summer 2012


LAB EXPERIMENT 4

PRACTICAL QPSK SYSTEM

1. Objective

- Learn about all the necessary stages in a practical QPSK system (transmitter, channel, receiver)
that addresses practical issues in wireless communications, such as carrier frequency and phase
offset, timing offset and frame synchronization.
- Learn about the bit error rate performance of a QPSK as a function of frequency offset, delay and
signal to noise ratio.
- Learn about the bit error rate performance of a QPSK wireless link as a function of distance using
the link budget.


1.1. Lab overview and table of contents

The first part of the lab experiment begins with experiments using Simulink only, the USRP software
defined radio units are not used. The experiments run a complete QPSK system with transmitter,
simulated channel model (with noise, frequency offset and delay) and receiver implemented in Simulink.

The second part uses two USRPs (from adjacent lab stations) to create a complete QPSK system with
Simulink transmitter, real RF radio channel with antennas, and Simulink receiver.


QPSK Transmitter and Receiver
Copyri ght 2011 The MathWorks, Inc.
Transmi tter Recei ver
Doubl e-cl i ck
To Open Scopes
At Run Ti me
Model
Parameters
Info
Doubl e-cl i ck
To Cl ose Scopes
BER Di spl ay
AWGN Channel wi th
Frequency Offset &
Vari abl e Ti me Del ay
2

1.2. Preparation questions

1. For a QPSK receiver, obtain numerical values for the theoretical bit error rate as a function of
Eb/No from 0 to 15 dB (i.e. plot a curve or make a table). For a bit error rate of
4
10

what is
Eb/No?
2. Find the maximum free space range (distance) that can be covered for a wireless QPSK data link
with data rate 40 Kbits/sec, bit error rate
4
10

, transmit power one microwatt, antennas with


zero gain. Assume the bandwidth is equal to the bit rate and the receiver noise figure is 5 dB.
Link budget formulas are in the Appendix.

1.3. Lab table of contents

2. Baseband data transmission
2.1. Digital messages
2.2. Pulse shaping
3. Quadrature Phase Shift Keying
3.1. QPSK transmitter theory
3.2. Transmitting QPSK in Matlab Simulink
3.2.1. Baseband QPSK signal
3.2.2. Real QPSK signal within Simulink
3.2.3. Complex QPSK signal within Simulink
3.2.4. Real QPSK signal at radio frequency (RF)
3.3. QPSK receiver
3.3.1. Receiver for complex baseband QPSK signal within Simulink without USRP
3.3.2. Receiver for real QPSK signal within Simulink without USRP
3.3.3. Receiver for reak QPSK signal at RF using USRP
3.3.4. Practical QPSK receiver design challenges
4. Lab instructions
4.1. Setup at each lab station
4.2. Lab instructions overview
4.3. QPSK system experiments using Simulink only, USRP not used
4.3.1. Familiarization with the Simulink QPSK model
4.3.2. Running the experiment, obtaining BER performance
4.3.3. Running the experiment, observing when the system breaks
4.4. QPSK system experiments using 2 USRPs and antennas
4.4.1. Experimental setup with 2 USRPs and antennas
4.4.2. Familiarization with USRP transmitter and receiver blocks
4.4.3. Running the experiment
4.5. Review questions
Appendix


3

2. Baseband data transmission

2.1 Digital messages

The figure below shows how a digital message is constructed for a practical QPSK system.


The unipolar Barker code is a 13-bit sequence
barker=[+1 +1 +1 +1 +1 -1 -1 +1 +1 -1 +1 -1 +1]
that has excellent autocorrelation properties, i.e. the matlab command
plot(xcorr(barker,barker)) shows a single peak of 13 and sidelobes of 1 or 0.

The Barker code is used as a unique word for frame synchronization, i.e to determine where the
information bits begin and identify the byte boundaries.


2.2 Pulse shaping


( ) m t is a digital message as shown in the figure below.

Each data frame contai ns 26 bi ts header (For Sync Purpose) and 174 bi ts data bi ts,
fi rst 105 bi ts contai n "Hel l o worl d ###" message. Scrambl er i s there to i mprove data
transi ti on densi ty and frequency offset esti mati on.
1
Out
Scrambl er
Repeat
2x
Message
Source
1
Matri x
Concatenate
Uni pol ar
Barker Code
4



In the figure above, ( ) p t is chosen to be a so-called square pulse, where we can write
for 0 and 0 o ( ) 1 therwise t p t T < < = . We send one such pulse for each data bit, a positive pulse
( ) p t for logic 1 and a negative pulse for logic 0. In the figure, the message is shown in the interval
0 8 t T < < and the data bits are 11100101.

For the period 0 t T < < ,
0
( 1 ) ( ) p m A t t = = + and the data is logic 1. For the next period 2 T t T < < ,
1
( ( ) ) 1 p t m t A T = + = , and the data is logic 1. In the example figure above, the message is shown in
the interval 0 8 t T < < and the information bits are 11100101

We can write
0 1 2
( ) ( ) ( ) ( 2 ) ... ( )
k
k
m t A p t A p t T A p t T p t k A T = + + + =


where the real constants 1
k
A = depending on whether a logic 1 or a logic 0 was sent.
In the figure above,
0 1 2 3 4 5 6 7
1, 1, 1, 1, 1, 1, 1, 1 A A A A A A A A = + = + = + = = = + = = +

When ( ) p t

is chosen to be a square pulse in the time domain as shown in the figure above, then the
spectrum ( ) P f is a sinc function that occupies significant bandwidth. When the sharp edges of a
square pulse ( ) p t are rounded or smoothed by a filter, then the bandwidth is reduced, but the pulse
extends beyond the time interval 0 t T < <
.

Ideally, we wish ( ) P f

to be strictly band-limited (to avoid interference with the adjacent channel in the frequency domain)
but without any inter-symbol interference (ISI) (to avoid interference with the adjacent symbol in the
time domain)

One solution is to use a pulse with a raised cosine (RC) spectrum ( ) P f that has a time domain pulse


2 2 2
( / ) ( /
( )
)
/ 1 4 /
sin t T cos t T
t T
p
T
t
t
t t|
t |
=


5

In the figure below, ( ) ( ) x t p t =
The parameter | is the excess bandwidth (i.e. the bandwidth in excess of the absolute possible
minimum bandwidth).



If the receiver filter is matched to the transmitter filter, then the overall raised cosine spectral
characteristic is split evenly between the transmitting filter and the receiving filter. In this case we
choose the pulse spectrum to be
( ) P f with time domain pulse shape

2 2
[ (1 ) / ] 4 ( / ) [ (1 ) / ]
( )
( / )[1 16 ( / ) ]
sin t T t T cos t T
t T t T
p t
t | | t |
t |
+

=
+


In a practical system, we use this square root raised cosine pulse shape instead of a square pulse.


3 Quadrature Phase Shift Keying (QPSK)

3.1 QPSK transmitter theory

Recall that we can send separate messages
1 2
( ), ( ) m t m t on the I and Q channels, i.e.
1 2
( ), ) ) ) ( ( ( t q t m m t i t = =
We can choose
1 2
an ( d ( ) ) m m t t to be separate digital messages or two parts of the same digital
message with the same kind of waveform as shown in section 2.1. above. When we use both the I
and Q channels, the modulation is called Quadrature Phase Shift Keying (QPSK).

6

To write an expression for QPSK, a digital message can be written as a complex envelope

0 1 2
( ) ( ) ( ) ( ) ( 2 ) .
k
k
s t p t kT C p t C p t T C C p t T = = + + +


where
( ) ( ) ( ) s t i t jq t = + is a complex message waveform,
k
j
k k k k
C a A jB e
|
= = + is the digital data,
where and cos sin
k k k k k k
a B a A | | = =
There are 4 possible values of
k
C depending on whether a logic 00, 01, 10 or 11 was sent.
The signal constellation for QPSK consists of the 4 points located at 1
k
C j =
In polar form
k
j
k k k k
C a A jB e
|
= = + , so that with 1 and 1
k k
B A = = ,
(2 1)
2 and
4
k k
a
n t
|

= = are the 4 possible phases of a QPSK signal.



From the expression for ( ) s t , and assuming a square root raised cosine pulse ( ) p t we see that at time
0 t = ,
0
0 0 0
( )
j
s t A jB e a
|
= = + is a complex constant. For the next period at time t T = ,
1
1 1 1
( )
j
s t A jB e a
|
= = + , etc. In general, for the time period t kT =

( )
k
j
k k k
s t A jB e a
|
= = + is a fixed
amplitude and phase.

0 1 2
( ) ( ) ( ) ( ) ( 2 ) .
k
k
i t p t kT A p t A p A t T A p t T = = + + +


and
0 1 2
( ) ( ) ( ) ( ) ( 2 ) .
k
k
q t p t kT B p t B p B t T B p t T = = + + +


For QPSK, we choose 1 and 1
k k
B A = = , so that 1
k
C j = .


3.2. Transmiting QPSK in Matlab Simulink

3.2.1. Baseband QPSK signal

The complex signal ( ) ( )
k
k
s t p t T C k =

is the complex baseband QPSK waveform, and is


generated in Simulink via the model shown below. The QPSK modulator block accepts bits and
groups them in pairs to determine the value of
k
C
.
The RC transmit filter generates the square root raised cosine pulses
( ) p t kT


7




3.2.2. Real QPSK signal
To create a real QPSK signal within Simulink at intermediate frequency
1
f using these equations, we (1)
generate the complex baseband signal ( ) ( ) ( ) s t i t jq t = + and (2) upconvert it to the desired carrier
frequency with a standard IQ transmitter to yield
1 1
( ( ) ( ) ) 2 cos2 s f t q t sin t f t i t t t =


The spectrum of ( ) s t will be centered at
1
f and has both positive and negative frequency
components. This signal is not used in this lab experiment.

3.2.3. Complex QPSK signal
To create an complex QPSK signal in Simulink at intermediate frequency
2
f using these equations,
we (1) create the complex baseband signal ( ) ( ) ( ) s t i t jq t = + and (2) upconvert it to the desired
carrier frequency by multiplying by
2
2 j f t
e
t
. The results is another complex signal
2
2 2 2 2
2
2
2 2
( ) [ ( ) ( )]
( )sin 2 [ ( ) cos ( 2 ) ( )sin 2 ]
( ) ( )
cos 2
j f t
s t i t jq t e
f t q t f t j q t f t i t f t
i t jq
i
t
t
t
t t t t =
= +
+ +
= +

We can create a second QPSK signal in Simulink at a different intermediate frequency
3
f in the same
way to yield
3 3 3
( ) ( ) ( ) s t i t jq t = +
We can create a composite signal consisting of several QPSK signals at
2 3
, f f etc. This signal is not
used in this lab experiment.

3.2.4 Real QPSK signal at radio frequency (RF)

Transmitter
1
Tx Output
Square root
Rai sed Cosi ne
Transmi t Fi l ter
QPSK
QPSK
Modul ator
Baseband
Bi ts Generati on
FFT
After RC
Tx Fi l ter
8



The upconversion of a QPSK signal to a radio frequency (RF) wave at
c
f is the function of the USRP sink
block (standard IQ transmitter) with inputs and ( ( ) ) i t q t .The USRP transmitter accepts a complex
baseband signal ( ) s t from section 3.2.1. and multiplies it by
2
c
j f t
e
t

and takes the real part to generate
a real RF signal ( ) s t centered at and
c c
f f .

For some software radios it is recommended to use the complex signal
2
( ) s t at intermediate frequency
2
f from section 3.2.3 to avoid using the complex baseband signal ( ) ( ) ( ) s t i t jq t = +

that may have
some DC content.
2
( ) s t can be up-converted to RF by the USRP transmitter to generate a real RF signal
( ) s t centered at
2 2
+ and
c c
f f f f .


3.3. QPSK receiver

We can simulate the QPSK receiver within Simulink without using the USRP source block.


3.3.1. Receiver for complex baseband QPSK signal within Simulink without USRP

The complex baseband QPSK signal from section 3.2.1 is already in the complex baseband format
( ( ) ) i t jq t +
required for the USRP receiver.
Upsampl e by 4
QPSK Transmitter with USRP(TM) Hardware
Open the compani on sdruqpskrx model
Note: Before runni ng the QPSK model s, fi rst run the compani on model s for frequency offset cal i brati on.
Open the compani on sdrufreqcal i brx model Open the compani on sdrufreqcal i btx model
Copyri ght 2011 The MathWorks, Inc.
SDRu
Transmi tter
192.168.10.2
Data
USRP Transmi tter
Square root
Rai sed Cosi ne
Transmi t Fi l ter
QPSK
QPSK
Modul ator
Baseband
Info
Bi ts Generati on
9


3.3.2. Receiver for real QPSK signal within Simulink without USRP

To receive the real QPSK signal
1 1
( ( ) ( ) ) 2 cos2 s f t q t sin t f t i t t t =

from section 3.2.2, we use a
standard IQ receiver set up for
1
f with complex output ( ( ) ) i t jq t +
This IQ receiver can be implemented with real cosines and sines and low pass filters. The real QPSK
signal from section 3.2.2. is not used in this lab experiment.

3.3.3 QPSK signal at radio frequency (RF) with USRP

Oversampl ed by 2
Receiver
1
BER
Ti mi ng
Recovery
DataOut
DataVal i d
Square root
Rai sed Cosi ne
Recei ve Fi l ter
To
Sampl e
Frame Conversi on
Fi ne Frequency
Compensati on
In BER Data Decodi ng
Coarse Frequency
Compensati on
Buffer
Automati c Gai n
Control
After RC
Rx Fi l ter1
FFT
After RC
Rx Fi l ter
After Fi ne Frequency
Compensati on
After Coarse Frequency
Compensati on
1
dataIn
QPSK Receiver with USRP(TM) Hardware
Open the compani on sdruqpsktx model
Note: Before runni ng the QPSK model s, fi rst run the compani on model s for frequency offset cal i brati on.
Open the compani on sdrufreqcal i brx model Open the compani on sdrufreqcal i btx model
Copyri ght 2011 The MathWorks, Inc.
SDRu
Recei ver
192.168.10.2
Data
Data Len
USRP Recei ver
dataIn QPSK Recei ver
Model
Parameters
Info
10


To receive the QPSK signal at RF from section 3.2.3, the USRP source block is used to downconvert the
real RF signal to complex baseband ( ( ) ) i t jq t +


The USRP works with the real QPSK signal at RF carrier frequency
c
f

( ( ) ( ) s 2 )co 2
c c
f t q t si s f t t i n t t t =

To receive a QPSK signal at RF, we use the USRP source block. The USRP receiver multiplies the real
valued radio frequency (RF) signal ( ) s t by
2
d
j f t
e
t
to generate ( ( ) ) i t jq t + , where the USRP
downconversion frequency (local oscillator)
d c
f f is very close to but not exactly the same as the
received carrier frequency
c
f This is called complex downmixing and is equivalent to the standard IQ
receiver, where in the figure below and ( ) R ( ) Im ( e{ )} ) ( q i t x t x t t = = and
d
f is the frequency of the
USRP source block.
The USRP receiver block has a complex output with real and imaginary components and ( ( ) ) i t q t ,
thus the USRP receiver block with frequency set to
c
f will have outputs

( ) ( )cos i t a t | = ,
( ) ( )sin q t a t | = , where
2 ( )
d c
f f t | t = +



Oversampl ed by 2
Receiver
Ti mi ng
Recovery
DataOut
DataVal i d
Square root
Rai sed Cosi ne
Recei ve Fi l ter
To
Frame
Fi ne Frequency
Compensati on
In Data Decodi ng
Coarse Frequency
Compensati on
Automati c Gai n
Control
Enabl e
1
dataIn
11

The complex signal output from the USRP source block ( ( ) ) i t jq t + is bandlimited to the sampling
rate of the USRP receiver block. The USRP receiver block output can be recorded to a file and used
again at a later time. This file source will have the same sampling rate and bandwidth as the USRP
receiver block used to record it.

With a sampling rate of 256KHz and complex samples, the bandwidth will be 256 KHz (because the
complex signal spectrum is not symmetric and does not have redundant mirror-image positive and
negative frequencies)

We can tune in (receive) any of the QPSK signals in this bandwidth by shifting the spectrum of the
USRP source output. We shift by e.g
2
f KHz by multiplying the USRP source output (complex signal)
( ( ) ) i t jq t + by
2
2 2
2
cos sin 2 2
j f t
f t j f t e
t
t t

= , so that the QPSK signal that first appeared at


2
f
Hz (see section 3.2.3) now appears at zero Hz.

For the QSPK system in this lab, there is only one QSPK signal at baseband (see section 3.2.1), so
there is no need to tune in a signal. However, we would need to do this if we used the QPSK
signal from section 3.2.2 or 3.2.3.

With a square root raised cosine matched filter, the received data ( ) i t at sampling times t kT = +
is 1
k
A = and the received data ( ) q t is 1
k
B = , where is adjusted to sample at the peak of the
raised cosine pulse ( ) p t at the output of the matched filter. In the complex domain, the received
data ( ( ) ) i t jq t + at sampling times t kT = + is 1
k
C j =

3.3.4 Practical QPSK receiver design challenges

The challenge in a practical receiver is to compensate for the frequency offset
d c
f f and to find
the correct sampling times t kT = +
to obtain the data
1
k
C j =
,
followed by frame
synchronization so that the data can be decoded into the message bits.

The Simulink receiver does these tasks in stages:
FFT-based coarse frequency compensation,
PLL-based fine frequency compensation,
timing recovery with fixed-rate resampling and bit stuffing/skipping,
frame synchronization, and
phase ambiguity resolution.



12


The details of each block in the receiver are shown in the Appendix. A detailed understanding of
exactly how these blocks work is not required to run the lab experiment

4. Lab setup and instructions

In all experimental sections, record your observations at each step as appropriate, with sketches or
(annotated) screenshots as needed. In particular, respond to each step labeled TASK FOR LAB
REPORT. To take a screen shot, click Accessories Take Screenshot Current Window.

4.1 Setup at each lab station.

1. The small grey box is the USRP software defined radio. The USRP has a receiver (Rx) input, a
transmitter (Tx) output and an Ethernet connection to the computer.
a. The USRP digitally up-converts an I-Q signal sent via Ethernet from the computer to an
analog RF signal at the Tx output connector (SMA type) (section 3.2.4).
b. The USRP Tx output (analog RF signal) may be connected to a 30 dB attenuator,
followed by coaxial cable to a quarter-wave monopole antenna to be radiated.
c. Another antenna that will pick up analog RF signals may be connected to the USRP Rx
input connector (SMA type)
d. The USRP digitally down-converts the analog RF signal at the Rx input connector into I
and Q format and sends it via Ethernet to the computer (section 3.3.3).
e. The computer is running Linux (Scientific) with Matlab Simulink software installed and
dual monitors.
f. The username and password are both student (without quotes).
g. The Matlab Simulink software is launched by single-clicking the icon at the top left.
h. Upon launching Matlab, navigate to Desktop/Matlab. There are two folders,
commdemos for the Simulink-only experiment, and commusrp for the radio
experiment using the USRP.

4.2 Overview of lab instructions

The first part of the lab experiment begins with experiments using Simulink only, the USRP is not used.
Oversampl ed by 2
Receiver
1
BER
Ti mi ng
Recovery
DataOut
DataVal i d
Square root
Rai sed Cosi ne
Recei ve Fi l ter
To
Sampl e
Frame Conversi on
Fi ne Frequency
Compensati on
In BER Data Decodi ng
Coarse Frequency
Compensati on
Buffer
Automati c Gai n
Control
After RC
Rx Fi l ter1
FFT
After RC
Rx Fi l ter
After Fi ne Frequency
Compensati on
After Coarse Frequency
Compensati on
1
dataIn
13

The experiments run a complete QPSK system with transmitter, simulated channel model and receiver
implemented in Simulink.

The second part uses two USRPs (from adjacent lab stations) to create a complete QPSK system with
Simulink transmitter, real RF radio channel with antennas, and Simulink receiver. The distance between
antennas is varied to observe over what distance the link works and at what distance the link fails.

4.3. QPSK system experiments using Simulink only, USRP not used.

4.3.1. Familiarization with the Simulink QPSK system model

1. From within the Matlab command window, navigate to Desktop/Matlab/commdemos and open
the file commqpsktxrx.mdl The model block diagram will appear




2. The model simulates a complete QPSK system that sends a message stream hello world xxx
where xxx are digits 000-099. As mentioned in Section 2.1, the messages are sent in frames 174
bits long with 26 bits for frame synchronization.
3. The system performance (link quality) is measured in two ways:
a. by the live BER display while the simulation is running, and
b. the number of errors in the hello world xxx text display in the Matlab command
window when the simulation is stopped.
4. Double click the info block (green) to open the documentation for commqpsktxrx.mdl,
including detailed description of each component. It is strongly recommended to read this
documentation.
5. Double click the Transmitter block to see the components inside that block (same as figure in
section 3.2.1). Double clicking on any block will reveal the components of that block, or a dialog
box with parameters for that block.
6. Double click the AWGN channel . block to see the components of the channel model. The
model includes phase/frequency offset, variable delay and AWGN.

QPSK Transmitter and Receiver
Copyri ght 2011 The MathWorks, Inc.
Transmi tter Recei ver
Doubl e-cl i ck
To Open Scopes
At Run Ti me
Model
Parameters
Info
Doubl e-cl i ck
To Cl ose Scopes
BER Di spl ay
AWGN Channel wi th
Frequency Offset &
Vari abl e Ti me Del ay
14






7. Double click the receiver block. Observe the location of the 3 constellation displays (Matlab
calls them Discrete-Time Scatter Plot Scope).
8. Double click the timing recovery block. Observe the location of the Discrete-Time Scatter Plot
Scope titled after timing recovery

4.3.2. Running the experiment, obtaining BER performance

9. Double click the model parameters (yellow) block. From the setting types dropdown menu,
select channel impairment settings. There are 3 types of impairments, AWGN (Eb/No),
frequency offset and delay. Set the Eb/No to 20 dB and frequency offset to 2 Hz and click OK to
apply and close the dialog box.
10. In the model parameters block, there are 4 delay parameters that determine how much and
how quickly the delay changes. Set the delay parameters as follows: delay type triangle, delay
step 0.05 samples/frame, minimum delay 0 samples, maximum delay 1 sample. Clock OK to
apply and close the dialog box.
11. Run the model simulation>start. Observe that multiple windows open displaying various
signal constellations, frequency spectra and graphs.
12. Observe the spectrum display after RC Tx filter.
13. TASK FOR LAB REPORT: From this display, what is the approximate data rate? See the X(f) plot
in section 2.2 for a hint.
14. Observe the 4 constellation plots at different stages of the receiver. The first constellation
labeled after RC Rx Filter shows a slowly rotating constellation due to the 2 Hz frequency
offset. Only the last constellation plot labeled after timing recovery shows the correct
constellation. Thus for a practical channel with frequency and timing offsets, the coarse and
fine frequency compensation, and timing recovery stages are needed to obtain the correct
constellation.
15. Stop the simulation simulation>stop and observe the hello world xxx display in the Matlab
Convert Del ay from
sampl es to symbol s
1
Out
z
-f
In
Del ay
Vari abl e
Fracti onal Del ay
Phase/
Frequency
Offset
-K-
Gai n
2
Del ay Sel ect
Del ay Generator
FFT
After Channel
Ti me
Actual Del ay
AWGN
1
In
15

command window.
16. Experiment with different values of Eb/No and frequency offset and observe the constellation
displays and the BER display. The BER display (on the receiver model block diagram) shows the
bit error rate, total number of errors and total number of bits sent.
17. TASK FOR LAB REPORT: Record your visual observations of the constellations for two different
values of Eb/No and frequency offset.
18. Experiment with different values of Eb/No and observe the relationship between the BER and
the number of errors in the text message and answer the questions in step 19.
19. TASK FOR LAB REPORT: At what Eb/No and BER is the text message essentially error-free? At
what Eb/No and BER is the message text mostly garbled (no recognizable text)? What is the dB
difference in Eb/No between an essentially error free message and a mostly garbled message?
20. TASK FOR LAB REPORT: Prepare a table of BER versus Eb/No and frequency offset as follows,
and comment on the difference in BER performance between theory and practice.

Eb/No(dB) /
freq offset(Hz)
QPSK theoretical
BER, 0 Hz offset
Simulation result
0 Hz offset
Simulation result
5 KHz offset
Simulation result
12 KHz offset
3
5
7
10
15


4.3.3. Running the experiment, observing when the system breaks

21.
Recall that the challenge in a practical receiver is to compensate for the frequency offset
d c
f f and to find the correct sampling times t kT = +
to obtain the data
1
k
C j =
,
followed by frame synchronization so that the data can be decoded into the message bits.
The
system will break (stop functioning correctly, i.e. the BER will be close to 0.5) if one or more of
the frequency compensation and/or timing recovery fails and/or frame synchronization fails.

22. Frequency compensation failure: with Eb/No= 20 dB at which the BER is close to zero, increase
the frequency offset until the system breaks (i.e. the frequency compensation fails).
23. TASK FOR LAB REPORT: What is the maximum frequency offset before the system breaks?
24. Timing recovery failure: with Eb/No=20 dB and frequency offset 0 Hz, change the 4 delay
parameters until the system breaks (i.e. the timing recovery fails).
25. TASK FOR LAB REPORT: Identify a combination of the 4 delay parameters at which the system
breaks. The combination of delay parameters is not unique.
26. Frame synchronization failure: For a well-designed system, the frame synchronization should not
fail at an Eb/No that yields usable data, i.e. the frame synchronization unique word (Barker
code) should be long enough so that it is reliably recognized even with a high BER. For a poorly
designed system, the frame synchronization could fail at an Eb/No that is sufficient to obtain
useful data, and that data would be unnecessarily lost. In such a system, the BER versus Eb/No
16

curve would suddenly jump up to near 0.5 when the Eb/No falls below the threshold at which
frame synchronization fails.
27. TASK FOR LAB REPORT: Test the system at low Eb/No and decide whether or not frame
synchronization is failing at an Eb/No that is sufficient to obtain useful data. State the reasons
for your answer.

4.4. QPSK system experiments using 2 USRPs and antennas

4.4.1. Experimental setup with 2 USRPs and antennas

28. Work together with the lab group next to you.
29. At one lab station, connect the USRP Tx output to a 30 dB attenuator followed by a one meter
(or more) length of coaxial cable and a monopole antenna set to be a quarter wavelength long
at 915 Mhz.
30. At the other lab station, connect the USRP Rx input to a length of coaxial cable and a monopole
antenna.
31. Place the antennas on the bench less than 20 cm apart.

4.4.2. Familiarization with Simulink USRP transmitter and receiver blocks.

32. In the Matlab command window, navigate to Desktop/Matlab/commusrp/usrpdemos and open
sdruqpsktx.mdl
33. The QPSK transmitter block generates the complex baseband QSPK signal with square root
raised cosine pulses, and feeds the complex signal to the Simulink USRP transmitter block that
upconverts the signal to RF carrier frequency
c
f as described in section 3.2.4. Click the blue
info block and read the details.
34. Click on the USRP transmitter block to set the parameters. Set the gain to 0 dB (this corresponds
to 0 dBm or 1 milliwatt) and set the frequency to either 910 or 920 MHz (to avoid interfering
with the link set up by the other 2 lab groups.

35. Open sdruqpskrx.mdl
Upsampl e by 4
QPSK Transmitter with USRP(TM) Hardware
Open the compani on sdruqpskrx model
Note: Before runni ng the QPSK model s, fi rst run the compani on model s for frequency offset cal i brati on.
Open the compani on sdrufreqcal i brx model Open the compani on sdrufreqcal i btx model
Copyri ght 2011 The MathWorks, Inc.
SDRu
Transmi tter
192.168.10.2
Data
USRP Transmi tter
Square root
Rai sed Cosi ne
Transmi t Fi l ter
QPSK
QPSK
Modul ator
Baseband
Info
Bi ts Generati on
17


36. The QPSK receiver block takes the RF signal and downconverts it to complex baseband as
described in section 3.3.3. Click the blue info block and read the details.
37. Click on the USRP receiver block to set the parameters. Set the gain to 0 dB.

4.4.3. Running the experiment

38. Start the transmitter sdruqpsktx.mdl from one lab station using simulation>start
39. Start the receiver sdrupqpskrx.mdl from the other lab station using simulation>start
40. Let the simulation run for about 5 seconds.
41. Stop the receiver using simulation>stop
42. Observe the hello world xxx output in the Matlab command window.
43. Move the antennas further apart and repeat steps 39-42.
44. Find the largest distance over which the link works reliably (almost no errors in message text)
45. Find the smallest distance over which the link fails consistently (almost no recognizable message
text)
46. What is the ratio of these two distances?
47. Recall the answer to step 19 and recall the free space path loss formula in dB
0
32.4 20log ( ) 20log ( ) f GHz L d m = + + When the distance ratio is 2 to 1, then the path loss
increases by 6 dB, i.e. 20 log (2/1)= 6.
48. TASK FOR LAB REPORT: Explain your observations in steps 39-46, i.e. is the distance ratio in step
46 reasonable given the formula in step 47 and the theoretical BER for QPSK in step 20? Sketch
the curve of BER vs Eb/No to aid your explanation. Hint: with all link budget parameters
constant, increasing the path loss by 6 dB will reduce the Eb/No by an identical amount. Using
the link budget equations, write an equations for Eb/No as a function of distance d.
49. TASK FOR LAB REPORT: Using the link budget formulas in the Appendix, estimate the noise
figure of the receiver. Hint: all link budget parameters are known except the noise figure,
QPSK Receiver with USRP(TM) Hardware
Open the compani on sdruqpsktx model
Note: Before runni ng the QPSK model s, fi rst run the compani on model s for frequency offset cal i brati on.
Open the compani on sdrufreqcal i brx model Open the compani on sdrufreqcal i btx model
Copyri ght 2011 The MathWorks, Inc.
SDRu
Recei ver
192.168.10.2
Data
Data Len
USRP Recei ver
dataIn QPSK Recei ver
Model
Parameters
Info
18

assuming the link margin M=1 (0 dB). Write an equation for F as a function of all other link
budget parameters.
50. Change the USRP receiver gain
1
G from 0 to 20 dB and repeat steps 39-49. Explain the results.
Why is the noise figure lower? Hint: The USRP has a low noise preamplifier first stage, followed
by a higher noise second stage of amplification before the A/D. Recall the expression for the
noise figure of cascaded gain stages,
2
1
1
1 F
F
G
F

+ = where
1
F is the noise figure and
1
G is the
gain of the first stage of the USRP (the USRP dialog box adjusts the gain of the first stage only).


4.5 Review questions

1. Name the stages required in a practical communications link to compensate for frequency
offsets and delays that are not known in advance. Explain qualitatively how each stage works.
2. (optional) Reconcile the parameters of a stage with the robustness of that stage (i.e. the
frequency offset or delay at which the system breaks.


APPENDIX

A.1 Link budget formulas for terrestrial link (not in dB)

, 0
/
r o t t r
PGG P L =

2
0
4
L
d t

| |
=
|
\ .


, 0
( / )
r n
kT S P N WF =

0
b
E S R
N N W
=

,
,
1
r o
r n
P
M
P
= >

Link budget formulas in dB
19


, 0
0
, 0
0
0
, ,
32.4 20log ( ) 20log ( )
( / )
228.6
10log 290
20
0
4
r o t t r
r n
r o r n
P G G L
f GHz d m
k T S N W F
k
T
k T
L
P P M
P
P
=
= + +
= + + +
=
=
+ =
=

+ +
+
>



A.2 SIMULINK MODELS OF RECEIVER STAGES FOR
FREQUENCY COMPENSATION, TIMING RECOVERY AND FRAME SYNCHRONIZATION


Coarse frequency compensation


Find frequency offset using FFT
1
Out
-1
Gai n
In Freq Of f set
Fi nd Frequency
Offset
Ti me
Esti mated Frequency
Offset
Phase/
Frequency
Offset
In
Frq
Compensate
for Frequency Offset
1
In
20
























Thi s subsystem does the fol l owi ng:
1. Creates a tone at M*Foffset, where M i s the modul ati on order of the si gnal
2. Fi nds the i ndex of the maxi mum ampl i tude across the frequency band
3. Converts the i ndex to the frequency offset accordi ng to
Foffset = IndexofMaxAmpl i tude * FrameSi ze / (FFTLength * M * FrameSampl eTi me)
1
Freq
Offset
W:0, Ts:[-1, 0]
Wel ch
Peri odogram
N
Tf
FFTSig
FreqOf f set
fi ndfreqoffset
Fi nd Frequency
Offset
u
v
u^v
Compl ex Power
-C-
Al phabet
si ze
1
In
21

Fine frequency compensation

Timing recovery


To determi ne the phase error detector gai n K
p
, See Equati on 7.30 of "Di gi tal
Communi cati ons - A Di screte-Ti me Approach" by Mi chael Ri ce.
Baseband i mpl ementati on of the QPSK Phase PLL l i sted i n Fi gure 7.2.4 of
"Di gi tal Communi cati ons - A Di screte-Ti me Approach" by Mi chael Ri ce. See
Appendi x C.2 of the same book for the detai l s of PLL desi gn.
1
Out
Unbuffer
I
n
e
PED
PED
e
u
Loop Fi l ter
-1j
Gai n
Esti mated Phase
Di fference
z
-1
DDS
In
Ph
Compl ex
Phase Shi ft
1
In
Baseband i mpl ementati on of the Symbol Ti mi ng Synchroni zati on l i sted i n Chapter 8.4
of "Di gi tal Communi cati ons- A Di screte-Ti me Approach" by Mi chael Ri ce. See
Appendi x C.2 of the same book for the detai l s of PLL desi gn.
MATLAB Impl ementati on
of Scal ar-based Ti mi ng Recovery
2
DataVal i d
1
Out
strobe
Ti mi ng Recovery
PLL
In
DataOut
Cl k
Number of
Val i d Sampl es
Data
Clk
DataOut
DataValid
Modi fi ed Buffer
[strobe]
Goto
[strobe]
From
In Out
Enabl ed Wi re
Clk numValid
numVal i dCal c
Cal cul ate Number of
Val i d Sampl es
Buffer
After Ti mi ng Recovery
1
In
22

Timing recovery PLL



Data decoding


Sampl e-based processi ng i s adopted because
1. Strobe si gnal i s requi red to generate for EVERY sampl e for processi ng and output
sampl i ng, del ayed strobe si gnal woul d affect the accuracy of bi t stri ppi ng/stuffi ng
2. The BER performance degrades si gni fi cantl y even wi th frame si ze 2 and 4
Baseband i mpl ementati on of the Symbol Ti mi ng Synchroni zati on l i sted i n Chapter 8.4
of "Di gi tal Communi cati ons- A Di screte-Ti me Approach" by Mi chael Ri ce. See Appendi x
C.2 of the same book for the detai l s of PLL desi gn.
To determi ne phase error detector gai n K
p
, See Equati on 8.42 &
Fi gure 8.4.7 of "Di gi tal Communi cati ons - A Di screte-Ti me Approach"
by Mi chael Ri ce.
2
Cl kOut
1
DataOut
In
strobe
e
TED
Ti mi ng Error
Detector
Ti me
Normal i zed
Ti mi ng Error
Delta
Underf low
mu
NCO_ctrl
NCO Control
Loop Fi l ter
In
mu
Out
i nterp_fi l ter
Interpol ati on Fi l ter
Z
-1
Integer Del ay2
Z
-1
Integer Del ay1
1
DataIn
Buffer one frame data i n case that conti guous
data scatter across two adj acent frames
Thi s subsystem cal cul ates the del ay of the channel , al i gn the data wi th
the detected frame head, resol ves the possi bl e phase ambi gui ty i ssue
duri ng the fi ne frequency compensati on and demodul ates the data.
Rx si gnal i s del ayed by (RxBufferedFrames+1) frames.
The val ue 1 comes from one frame buffered at Data
Bufferi ng subsystem wi th i n the current subsystem
1
BER
recei ved
Si gnal To
Workspace
BarkerRef
Data
Phase
Phase Offset
Esti mator
Phase
Data
Out
Phase Ambi gui ty
Correcti on
& Demodul ati on
Error Rate
Cal cul ati on
Tx
Rx
Descrambl i ng
Z
-1
Del ay1
Z
-1
Del ay
Barker Ref erence
Data
Delay
Compute
Del ay
Buffer
Bi ts Generati on
Barker Code
Symbol Generati on
Delay
RxData
Data
al i gndata
Al i gn Data
Tri gger
1
In
23

Phase ambiguity resolution


1. Find the maximum free space range (distance) that can be covered for a wireless QPSK data link
with data rate 40 Kbits/sec, bit error rate
4
10

, transmit power one microwatt, antennas with


zero gain. Assume the bandwidth is equal to the bit rate and the receiver noise figure is 5 dB.
Link budget formulas are in the Appendix.

Solution

Pro=Pt+Gt+Gr-L0=-60+0+0-L0
L0=32.4+20 log f(GHz) + 20 log d(m)=32.4+0+20log(d)
Pro=-60-32.4-20log(d)
Prn=k+T+(Eb/No)+W+F=-204+15+46+5=-138 dBW
M=Pro-Prn=0=-92.4-20log(d)+138
20log(d)=138-92.4=45.6
Log(d)=45.6/20=2.28
D=190 meters



Phase Ambi gui ty Resol uti on
and Demodul ati on
1
Out
QPSK
QPSK
Demodul ator
Baseband
-1
Gai n
In
Ph
Compl ex
Phase Shi ft
Compl ex Phase
Shi ft
2
Data
1
Phase

You might also like