Lab Manual Rev 5 Lab 1 - SDR Basics - 0
Lab Manual Rev 5 Lab 1 - SDR Basics - 0
1 Introduction
The students at the University of New Mexico Electrical and Computer Engineering Department are
planning to use an integrated set of lectures and labs to better understand basic communications
systems. The lectures are based on the textbook by Ziemer and Tranter, Principles of
Communications - Systems, Modulation, and Noise. The labs are developed using the National
Instruments Universal Software Radio Peripheral (USRP). The choice of this radio provides 2
advantages from an instructional perspective: it minimizes the amount of lab equipment necessary
for performing the labs, and its range of flexibility to support spectrum sensing, cognitive radio and
alternate modulation schemes.
The labs are written with the idea that the students not only need to make measurements, but also
learn how to write their own Virtual Instruments (VIs) supporting the modulation schemes being
studied. The first lab will include a demo where the USRPs are used to transmit and receive. The
students will have a chance to setup the radios and gain experience with USRP interface
Input/Output. The review will build on this experience to familiarize them with the standard lab
interfaces used in the training. The review will culminate with having them modify and use the
Spectrum Monitoring example provided with the LabVIEW USRP toolkit.
The other labs will build around a common interface and will have the students write their own
modulation VIs. The students will then integrate their Modulation VIs into the standard interface
that was developed or discussed in the review labs. The integration process will help the students
become more advanced users as they need to plan and debug their application. The work involved in
the resulting series of labs will be of increasing levels of difficulty. This approach is to ensure that
the students do not spend excessive amounts of time on the labs and not learn the theory in class.
The initial level will be structured such that the students are given an almost working AM
modulation module and have to just debug it to get it to work. Essentially, using a working example,
they would need to figure out what is missing and add it in. The next lab will have more elements
missing and more discussion of what needs to be done. This will progress until the final lab where
they will be given a description of what needs to be done, and they compose the final VI to
accomplish the desire objective.
1.1 Syllabus
The following is an overview of the course and its labs. The Class Lecture Topics in the syllabus were
developed by Dr. Sudharman K. Jayaweera, and are summarized in the following table. The
supporting lab exercises and lectures are presented in the Lab Topics of the table. The main effort is
synchronizing the material in the lab with the material being introduced in class. In later labs, the
emphasis is based on reinforcing or making the mathematical abstractions discussed in lecture more
concrete. Our experience is that the Engineering students learn by actually making things work
(many students learn in different ways). This practical kind of knowledge is what we hope will make
good the students into thinking and productive individuals capable of handling new and diverse
assignments.
1
Printed on: 12/4/2015 © 2014, Anees Abrol and Eric Hamke
Introduction to Communication Systems November 1, 2014
Using NI USRP Lab Manual
2
Printed on: 12/4/2015 © 2014, Anees Abrol and Eric Hamke
Introduction to Communication Systems November 1, 2014
Using NI USRP Lab Manual
3
Printed on: 12/4/2015 © 2014, Anees Abrol and Eric Hamke
Introduction to Communication Systems November 1, 2014
Using NI USRP Lab Manual
2. Background
This section should briefly summarize material presented during lecture with additional material
needed to support making the observations needed to support the Objectives section’s tasks or
activities. Note that the observation techniques are introduced here but they are explained in more
detail in the Lab Procedure section.
Additional subsections deal with configuring the USRP. With a detailed description of creation of the
transmitter/receiver VI needed to perform the lab.
3. Pre-Lab
4
Printed on: 12/4/2015 © 2014, Anees Abrol and Eric Hamke
Introduction to Communication Systems November 1, 2014
Using NI USRP Lab Manual
This would include any preliminary work that you might expect the students to have accomplished
prior to the lab. The preliminary work should include any programming assignments needed to
support the lab. It is important that you stress that this needs to be completed prior to the lab since
no time has been allocated to do this in the lab.
Transmitter
A template for the transmitter will be provided. This template contains the four interface VIs
described in the Background section along with a “message generator” that is set to produce a
message signal. Your task is to add blocks as needed to produce the modulated signal needed for
the lab, and then to pass the modulated signal into the while loop to the Write Tx Data block. The
modulation index is to be user-settable in the range 0 ≤ µ ≤ 1, and a front-panel control will be
provided.
Receiver
A template for the receiver will also be provided. This template contains the six interface VIs
described in the Background section above along with a waveform graph on which to display your
demodulated output signal.
4. Lab Procedure
This section provides instructions for making specific observations needed to complete the tasks or
activities introduced in the Objectives section. These instructions need to be very specific, providing
details as to how to configure the VIs used in the observations, and also instructions for recording
observations such as getting a screen capture, saving data off to a file for post processing, and lab
notebook entries. The Observation step should have simple direct questions that when answered
will document the lab’s execution.
5. Lab Write-up
This section should include directions for preparing the Lab write-up, including a secondary set of
questions that ask the student:
1) To describe what he/she learned in terms of the tasks or activities introduced in the
Objectives section.
2) To explain what could have possibly gone wrong and the consequences of these problems.
3) How to improve the lab.
5
Printed on: 12/4/2015 © 2014, Anees Abrol and Eric Hamke
Introduction to Communication Systems November 1, 2014
Using NI USRP Lab Manual
In this particular lab, you will setup the USRPs and run the provided lab Visual Instruments (2.2.3.1).
It is important that you follow lab safety procedures to avoid damaging the equipment. The radios
are sensitive and can burn out if not used correctly.
2.2 Background
Overall, this lab is meant to introduce the basic functioning of the USRP, and LabVIEW as a tool to
design digital communication systems in this course.
Note: Your instructor will provide information about how to access LabVIEW at your University.
6
Printed on: 12/4/2015 © 2014, Anees Abrol and Eric Hamke
Introduction to Communication Systems November 1, 2014
Using NI USRP Lab Manual
Appendix B enumerates some common VIs and highlights how to access them.
For this introductory lab, you will use only existing VIs, tailored specifically to the course material.
The intention is to allow students to focus on the lab theory. These VIs have been rigorously tested
checked out and should not be a source of error when checking lab results. The VIs for this lab are
divided into two categories- Transmitters and Receivers- and have been included in Appendix B for
ease of reference.
1. Consistency - All code should follow the same coding style at all times.
2. Readability -
The code should be organized in a modular fashion that promotes reuse and
maintenance.
Connections (signals or lines) should be laid out with the least number of overlapping
lines, and a signal should appear to enter a block at only one point.
7
Printed on: 12/4/2015 © 2014, Anees Abrol and Eric Hamke
Introduction to Communication Systems November 1, 2014
Using NI USRP Lab Manual
Connections should appear to enter or leave only the blocks being used. A connection
should not be overlapped by a block that is not the starting point or ending point.
3. Documentation - Documentation should not be few and far between. Good documentation
includes not only free text labels (see the Decorations palette, which is part of the Structures
palette), but also descriptive variable, block, and sub-VI names.”
The design of a digital communication system is modular and sequential in nature. It therefore
makes sense to adopt a coding style which makes use of modularity and hierarchy. Since many
algorithms in digital communications can often be boiled down to a recipe (e.g., A then B then C), it
is critical that you use sub-VIs whenever possible.
2.3 Pre-Lab
Prior to beginning the in-class portion of this lab, you will be expected to install LabVIEW on your
laptop and familiarize yourself with its features using the information provided in Appendix A. The
following tutorials and reference material will help guide students through the process of learning
LabVIEW:
LabVIEW 101 [5];
LabVIEW Fundamentals from National Instruments [6];
Online LabVIEW tutorials from NI[3], [4].
New LabVIEW programmers should carefully review all of the material in [5] and [4]. Please
remember to refer to [6] and [4] often as they are excellent references for all basic LabVIEW
questions. Bring any questions or concerns regarding LabVIEW or these tutorials to your instructor’s
attention.
8
Printed on: 12/4/2015 © 2014, Anees Abrol and Eric Hamke
Introduction to Communication Systems November 1, 2014
Using NI USRP Lab Manual
If the IP address does not appear in the window then check your connections and ask the
Teaching Assistant (TA) to verify that the LAN card has been configured correctly.
The following VIs, transmitter (Tx) and receiver (Rx), will be used on each of the lab’s exercises.
2.5.2 Tx VI:
The “USRP_fm_sound_transmitter 2010.vi” (Tx VI) provided with the Lab1 material (also available at
https://decibel.ni.com/content/docs/DOC-25893) which implements an FM transmitter that will
transmit the contents of a wav file will be used as the Tx VI (Fig. 3.).
2.5.3 Rx VI:
Choose one from the two FM Demod VI examples provided with LabVIEW to be used as the Rx VI for
this lab by following the path: Start Menu All Programs National Instruments NI-USRP
Examples LabVIEW ModulationToolkitExamples.
9
Printed on: 12/4/2015 © 2014, Anees Abrol and Eric Hamke
Introduction to Communication Systems November 1, 2014
Using NI USRP Lab Manual
10
Printed on: 12/4/2015 © 2014, Anees Abrol and Eric Hamke
Introduction to Communication Systems November 1, 2014
Using NI USRP Lab Manual
TX1/RX1 RX2
2. Connect a set of speakers to the computer to listen to the audio file transmitted from the
TA’s station.
3. Open the Rx VI.
4. Set the ‘Carrier Frequency’ on front panel to match TA’s Tx frequency.
5. Set ‘Active Antenna’ on the front panel to the right input according to the actual USRP Rx
being used (connected to the antenna).
6. Save this modified VI.
11
Printed on: 12/4/2015 © 2014, Anees Abrol and Eric Hamke
Introduction to Communication Systems November 1, 2014
Using NI USRP Lab Manual
7. Run the Rx VI when the TA indicates that the transmitter is broadcasting. Once the TA starts
transmitting, the contents of the wav file should be audible on the computer’s speakers.
1. Connect the VERT400 Antenna to the RX1 (or RX2) terminal (Fig. 6) on one radio and TX1
terminal (Fig. 6) on the other. Remember to connect the provided attenuator between the
USRP’s Rx input and the antenna.
2. Connect a set of speakers to the computer.
3. Set the ‘Carrier frequency’ on the front panel to the frequency of a local radio station (e.g.
101.3 FM). Note: For this section to work you must have an USRP 292x series radio.
4. Set ‘Active Antenna’ on the front panel according to the actual USRP Rx input being used
(connected to the antenna).
5. Run the Rx VI to start listening to the tuned radio station.
6. Open the Tx VI.
7. Set the frequency on this VI’s front panel to the same frequency you are receiving.
8. Run the Tx VI with an appropriate wav file.
The transmitted wav file should be heard over the radio channel. This is because the signal from
the radio station is being overpowered by the stronger signal transmitted from the USRP over
the same frequency channel.
12
Printed on: 12/4/2015 © 2014, Anees Abrol and Eric Hamke
Introduction to Communication Systems November 1, 2014
Using NI USRP Lab Manual
1. If still attached, detach the VERT400 vertical antennas from the USRPs.
2. Connect one end of the loop-back cable to the RX1/TX1 (or RX2) terminal (Fig. 6) on one
radio and RX1/TX1 terminal (Fig. 6) on the other. Remember to connect the provided
attenuator between the USRP’s Rx input and the loop-back cable.
3. Connect a set of speakers to the computer.
4. Verify that both the transmitter and receiver are set to the same carrier frequency.
5. Set ‘Active Antenna’ on the front panel according to the actual USRP Rx input being used
(connected to the loopback cable).
6. Open and run the Rx VI.
7. Set the frequency on this VI’s front panel to the same frequency you are receiving.
8. Open and run the Tx VI with an appropriate wav file.
The transmitted wav file should be audible on the computer’s speakers.
13
Printed on: 12/4/2015 © 2014, Anees Abrol and Eric Hamke
Introduction to Communication Systems November 1, 2014
Using NI USRP Lab Manual
Performance Measures
Task Standards Sat/Unsat
Hardware Setup Working setup for all 3 configurations: Broadcast, P2P
wireless, and Loop-back cable.
Running VIs Successful transmission and reception of audio files
for all 3 configurations: Broadcast, Point to point
wireless, and Loopback-cable.
QOS in P2P wireless Quality of received signal heard over the radio channel in
configuration point to point wireless configuration.
Discussion
Did all configurations perform as expected?
Did you have any difficulties completing the lab?
Did your TA provide enough guidance?
Do you have any recommendations to improve the lab?
14
Printed on: 12/4/2015 © 2014, Anees Abrol and Eric Hamke
Introduction to Communication Systems November 1, 2014
Using NI USRP Lab Manual
2.8 References
[1] National Instruments, NI USRP-2920, retrieved August 23, 2014, from
http://sine.ni.com/nips/cds/view/p/lang/en/nid/209948.
[2] National Instruments, Device Specifications: NI USRP-2920, retrieved August 23, 2014, from
http://www.ni.com/pdf/manuals/375839a.pdf.
[3] National Instruments, Getting Started with NI LabVIEW Student Training, retrieved August 23, 2014, from
http://zone.ni.com/devzone/cda/tut/p/id/7466.
[4] National Instruments, How Can I Learn LabVIEW?, retrieved August 23, 2014, from
http://www.ni.com/getting-started/labview-basics/.
[5] National Instruments, LabVIEW 101, retrieved August 23, 2014, from http://www.ni.com/lv101.
[6] National Instruments, LabVIEW Fundamentals, retrieved August 23, 2014, from
http://www.ni.com/pdf/manuals/374029c.pdf.
15
Printed on: 12/4/2015 © 2014, Anees Abrol and Eric Hamke