You are on page 1of 75

An Introduction to Software Defined Radio With

LabVIEW and NI USRP

ni.com
Hands-on Course Objectives
• Find an FM radio station using the USRP as spectrum analyzer
• Introduction to the LabVIEW environment
Exercise • Configuring the USRP software defined radio
1 • Exploring live radio spectrum

• Demodulate & listen to live FM radio


• LabVIEW programming fundamentals
Exercise • Integrating digital signal processing functions
2 • Using .m file script inside LabVIEW

• Explore a digital communications system


• Open and run a digital communications reference design
Exercise • Identify the part of a more advanced LabVIEW block diagram
3 • Overview of the modulation & demodulation process

ni.com
What is LabVIEW?

• LabVIEW is a graphical programming environment used


by millions of engineers and scientists to develop
sophisticated measurement, test, and control systems

• LabVIEW can integrate with wide variety of hardware


devices, including the NI USRP

ni.com
The National Instruments Vision
“To do for test and measurement
what the spreadsheet did for financial analysis.”

Virtual Instrumentation

ni.com
NI RF Test Platform
Cellular, Wireless, & GPS
Optimized APIs Test Toolkits
(802.11 a/b/g/n , GSM, EDGE,
WCDMA, RFID, WiMAX, GPS, etc.)

Soft Front Panels


Reference Architectures

Multicore VSAs & VSGs FPGA I/O & Amplifiers & Switching Power
Processing
ni.com Co-processing Attenuators Meters
The Next 30 Years:
Expanding LabVIEW into System Design

Design Verification Product Verification

Research/Mod Design/Simul Verification/Va Manufacturing


eling ation lidation

ni.com
Introduction to SDR
Find an FM radio station using the USRP as spectrum analyzer
Introduction to the LabVIEW environment
Configuring the USRP software defined radio
Exploring live radio spectrum

ni.com
From Concept to Prototype … Rapidly!

Graphical System Design Platform

Design Simulate Prototype

• LabVIEW Graphical System Design offers one tool, integrated flow


• Shorter learning curve
• Easier system integration
• Reduce the time to hardware … rapid prototyping!
ni.com
Getting Started in LabVIEW

ni.com
LabVIEW Programs are Called Virtual Instruments (VIs)
LabVIEW VIs contain three main components:
1. Front Panel 2. Block Diagram 3. Icon/Connector Pane

ni.com
Front Panel & Controls Palette
Numeric
Control

Controls Palette - contains the controls


and indicators you use to create the
front panel
ni.com
Block Diagram & Functions Palette
Math
Function

Front panel objects appear as


terminals on the block diagram
Contains the VIs, functions,
and constants you use to
create the block diagram
ni.com
Dataflow Programming

• Block diagram execution


– Dependent on the flow of
data
– Block diagram does NOT
execute left to right
• Node executes when data
is available to ALL input
terminals
• Nodes supply data to all
output terminals when
done

ni.com
LabVIEW Help Utilities – Context Help
Hover over function blocks for just-in-time help

• Help»Show Context Help


• Shortcut Keys: <Ctrl-H>

ni.com
LabVIEW Help Utilities – LabVIEW Help

• Select Help»LabVIEW Help

• Use the Detailed help link or


button in the Context Help
window

• Right-click an object and select


Help from the shortcut menu

ni.com
What is a Software Defined Radio?

Software-Defined Radio (SDR) refers to the


technology wherein software modules running on
a generic hardware platform are used to
implement radio functions …..

ni.com
NI USRP – Software Defined Radio Signal Processing
and Synthesis
Tunable RF Transceiver
 NI LabVIEW to develop
Front Ends
and explore algorithms
 Frequency Range
50 MHz – 2.2 GHz (NI-2920)  NI Modulation Toolkit and
2.4 GHz & 5.5 GHz (NI-2921) LabVIEW add-ons to
400 MHz – 4.4 GHz (NI-2922) simulate or process live
signals

Applications
 FM Radio  Safety Radio 1 Gigabit Ethernet to PC
 TV  OFDM  Plug-and-play capability
 GPS  Passive Radar  Up to 25 MS/s baseband IQ
 GSM  Dynamic Spectrum Access streaming
 ZigBee

ni.com
NI USRP Software Defined Radio

Software
RF Transceiver Baseband IQ
Processing

ni.com
SDR Components

• Digital to Analog
Tx • RF Upconversion • Modulation

• RF Downconversion • Demodulation
RX
• Analog to Digital • Signal Processing

ni.com
NI USRP-2920 Hardware Diagram 1. Device
Name
5. Gain

6. # Samples/
4. Antenna Buffer

2. IQ Rate

Analog RF Transceiver
3. Carrier Fixed Function FPGA PC
Frequency

ni.com
USRP Configuring in 6 Parameters

1. Device Name – IP address of one or multiple USRP

2. IQ Rate – Quadrature sampling rate, equivalent to bandwidth

3. Carrier Frequency – Frequency of interest

4. Antenna – Select which antenna port to receive from

5. Gain – Amplification of signal before digitizing the signal

6. Fetch size – how many samples to acquire each fetch

ni.com
NI USRP RF Receive Parameters

IQ Rate ~ Bandwidth

1 MHz
Power (dB)

50 MHz 94.7 MHz Frequency

ni.com
NI USRP RF Receive Parameters

Carrier Frequency

1 MHz
Power (dB)

50 MHz 94.7 MHz Frequency

ni.com
NI USRP RF Receive Parameters

Gain
1 MHz
Power (dB)

50 MHz 94.7 MHz Frequency

ni.com
NI USRP RF Receive Parameters

number of samples
Time Domain
1
* number _ samples  fetch _ time
IQ _ rate

Frequency Domain
IQ _ rate
 resolution _ bandwidth
number _ samples

ni.com
NI-USRP Driver Software

Initialize Configure Start Read IQ Stop Close

ni.com
Exercise 1 Find a Radio Station

ni.com
Demodulating Live FM
Demodulate & listen to live FM radio
LabVIEW programming fundamentals
Integrating digital signal processing functions
Using .m file script inside LabVIEW

ni.com
Dataflow Programming

• Block diagram execution


– Dependent on the flow of
data
– Block diagram does NOT
execute left to right
• Node executes when data
is available to ALL input
terminals
• Nodes supply data to all
output terminals when
done

ni.com
Common Data Types Found in LabVIEW

ni.com
Reviewing the Block Diagram

Wire:
Waveform
Datatype

Wire:
Error Cluster

ni.com
Waveform Data Type

• The waveform data type is used by LabVIEW to


display and store periodic signal measurements.

t0 – Initial time of waveform

dt – Sample period

Y – Array of data samples

Baseband IQ : Y is an array of complex numbers representing I and Q samples

ni.com
Arrays

• An array consists of elements and dimensions


• Elements: data that make up the array
• Dimension: the length, height, or depth of an array

• Consider using arrays when you work with


a collection of similar data and when you
perform repetitive computations

ni.com
33
Introduction to Clusters
• Data structure that groups data together
• Data may be of different types
• Analogous to struct in ANSI C
• Elements must be either all controls or all indicators
• Thought of as wires bundled into a cable

• Uses:
• Grouping variables
• Error handling
• Modulation toolkit

ni.com
Loops While Loop

• While Loop
• Terminal counts iterations
• Always runs at least once
• Runs until stop condition is
met
• For Loop
For Loop
– Terminal counts iterations
– Runs according to input N of
count terminal

ni.com
FM Radio Spectrum

ni.com
Demodulating Broadcast FM Radio

FM radio can be demodulated in 3 steps:


1. Detect carrier phase (Arc Tan of baseband IQ sample)

2. Unwrap the phase (remove discontinuities)

3. Compute the derivative (change in phase ≈ frequency)

Demodulated
Baseband IQ
FM

Detect Unwrap Differentiate


phase phase phase

ni.com
Exercise 2A Demodulate and Listen to FM Radio

ni.com
Demodulated Broadcast FM

Mono Stereo Audio


Audio Left - Right
Left + Right
19 kHz
Stereo
Pilot Direct Band Audos Subcarrier
RBDS

0 57 kHz
30 15 23 38 53 58.35 67.65 76.65 92 99
Hz kHz kHz kHz kHz kHz kHz kHz kHz kHz

ni.com
LabVIEW Models of Computation
Dataflow C | HDL Code Textual Math Multi-Rate DSP Simulation Statechart

LabVIEW LabVIEW LabVIEW LabVIEW

``

Desktop Real-Time FPGA MPU/MCU

Personal Computers PXI Systems CompactRIO Single-Board RIO Custom Design

ni.com
Math with the LabVIEW MathScript Node
• Implement equations and algorithms textually
• Input and output variables created at the border
• Generally compatible with popular .m file script language
• Terminate statements with a semicolon to disable
immediate output

(Functions»Programming»
Structures»MathScript)

Prototype your equations in the interactive LabVIEW MathScript Window.

ni.com
Frequency Demodulation Algorithm

Detect Unwrap Differentiate


phase phase phase

ni.com
Exercise 2B Use a MathScript RT node

ni.com
Communications Design in LabVIEW
Modulation Toolkit

• Analog and Digital modulation formats


• AM, FM, PM
• ASK, FSK, MSK, GMSK, PAM, PSK, QAM
• Custom
• Visualization
• 2D and 3D Eye, Trellis, Constellation
• Modulation Analysis
• BER, MER, EVM, burst timing,
frequency deviation, ρ (rho)
• Impairments
• Additive White Gaussian Noise (AWGN)
• DC offset, Quadrature skew, IQ gain
imbalance, phase noise
• Equalization, Channel Coding, Channel
Models

ni.com
Exercise 2C Use Use Prebuilt IP

ni.com
Digital Communications
Explore a digital communications system
Open and run a digital communications reference design
Identify the part of a more advanced LabVIEW block diagram
Overview of the modulation & demodulation process

ni.com
ni.com
Source Coding
Downconversion

Channel Coding

Demodulation

Modulation
Channel Decoding
Communications Channel

Upconversion
Digital Communication System

Source Decoding
Digital Communication System
NI Modulation Toolkit

NI Modulation Toolkit

ni.com
Digital Communication System
NI Modulation Toolkit

NI USRP

NI Modulation Toolkit

NI USRP

ni.com
Communications Design in LabVIEW
Modulation Toolkit

• Analog and Digital modulation formats


• AM, FM, PM
• ASK, FSK, MSK, GMSK, PAM, PSK, QAM
• Custom
• Visualization
• 2D and 3D Eye, Trellis, Constellation
• Modulation Analysis
• BER, MER, EVM, burst timing,
frequency deviation, ρ (rho)
• Impairments
• Additive White Gaussian Noise (AWGN)
• DC offset, Quadrature skew, IQ gain
imbalance, phase noise
• Equalization, Channel Coding, Channel
Models

ni.com
Advanced Digital Communications Topics

ni.com
Packet-based Communication Link System Setup
RF Signal
Center Frequency: 915MHz
Modulation Format: PSK packets
Bit Rate: 400kbps

NI USRP-2920 NI USRP-2920
Transmitter Receiver

• USRP control (Tx & Rx)


• Modulate Tx signal
• Demodulate Rx signal
• Reconstruct message

ni.com
Packet-based Communication with LabVIEW

ni.com
Packet Structure

GUARD SYNC PCKT


BAND SEQ NUM DATA PAD

Field Length Description


[bits]
Guard Band 30 Allow initialization of Rx PLL, filters, etc

Sync Sequence 20 Frame and Symbol Synchronization


Packet Number 8 Range: 0-255 Used for reordering of
packets and detection of missing packets

Data 64 - 256 Variable length data field. Length


detected dynamically at Rx end
Pad 20 Allows for filter edge effects.

ni.com
Transmitter Block Diagram

ni.com
The Received Signal

ni.com
Receiver Block Diagram

ni.com
Receiver: Pipelined Shift Register Architecture

Acquire

Energy Detector
& Packet Slicer

Resample and
Demodulate

Packet Sync &


Decode

Reconstruct
Data
Convert Bits
to ASCII

ni.com
Receiver: Pipelined Shift Register Architecture

ni.com
Exercise 3 Packet Based Transceiver

ni.com
NI SDR User Solutions
Wireless Comms Education
Record and Playback
Cognitive Radio
Physical Layer Prototyping
Compensating for RF nonlinearities with DSP
8x8 MIMO
Direction Finding

ni.com
Digital Communications Bundle
Bundle Contents Target Courses
• Two NI USRP-2920 + Toolkits • Communication Systems
• MIMO Cable • Digital & Wireless
• Digital Comm Lab Manual Communications
• Software Defined Radio (SDR)

Key Benefits
• Affordable
• Accessible
• NI Supported
• TX & RX Real RF Signals
• Scales to Research

ni.com
RF Record & Playback
• Record and play back up to 20 MHz of bandwidth
• Repeatable testing of algorithms / devices on realistic dataset
• Supplement a PXI lab with low-cost playback at your desk
Record
Playback

ni.com
NI USRP Research Case Study:
Cognitive Radio & Whitespace
Large Scale Cognitive Radio Testbed
• Prototyping cognitive radio in LabVIEW
• Spectral sensing with blind detection
• Database driven geo-location with GPS
• Deployed in Munich, Germany

“LabVIEW software and the NI USRP hardware are key


components of this research project, allowing the team
to rapidly prototype and successfully deploy the first
cognitive radio test bed of this kind.” Dr. Paulo
Marques, COGEU Aveiro, Portugal

ni.com
NI USRP Research Case Study:
Physical Layer Prototyping
Dr. Murat Torlak

• Continuously monitoring Demodulate Descramble


multiple wifi channels
• Demodulation and
descrambling of 802.11b
beacon signals
• Identification of hotspots,
tracking relative power
levels

802.11b SSID Decoding


Frequency
Demodulation Interpret the
Carrier Offset
& frame for
Detection Estimation &
Descrambling SSID
Correction

ni.com
NI USRP Research Case Study: Dr. Robert Heath
Director WNCG
NI USRP 8x8 MIMO Testbed Ref in
University of Texas at Austin

External
• Adaptable from 2x2 to 8x8 Clock PPS in Transmit
USRP USRP
• Algorithm design in MathScript RT TX 1 MIMO
Cable
TX 2

• 128 subcarrier OFDM, 4 QAM, spatial USRP


TX 3 MIMO Cable
USRP
TX 4
Network
diversity Cable
USRP USRP
• Independently clocked, phase TX 5 MIMO
Cable
TX 6

coherent Tx & Rx Host


Compute
USRP USRP
TX 7 MIMO TX 8
r Cable
Gigabit
Ethernet
Network Switch
Cable
Receive
USRP USRP
Rx 1 MIMO Rx 2
Cable

USRP USRP
Rx 3 MIMO Cable Rx 4
Network
Cable
USRP USRP
Rx 5 MIMO Rx 6
Cable

USRP USRP
Rx 7 MIMO Rx 8
Cable
External
Clock
ni.com
6x6 MIMO Testbed

ni.com
NI USRP Research Case Study: Prof. Athanassios Manikas
Comm & Array Processing Chair
Position Detection & Localization Imperial College, London

• Testing MUSIC direction finding


algorithm
• Rapid prototyping in LabVIEW with
MathScript RT External USRP
Clock RX 1
• Synchronized up to12 USRP devices
Ref in PPS
• Reference provides continuous phase in
USRP
alignment compensation RX 2

Direction Finding (uniform linear array)


Network
USRP
Cable RX 3

Host USRP
Computer
RX 4

Gigabit
Ethernet USRP
Network
Cable
Switch TX Calibration
Signal

ni.com
Research: Downloadable Reference Designs

8x8 MIMO-OFDM GPS Simulation


ni.com/usrp
Tx

RF Direction Finding &


RF Record & Playback Localization

ni.com
NI Platforms for RF/Communications

Graphical System Design Platform

NI RF
USRP for Generator, RF NI RF 6 GHz
LabVIEW Analyzer NI FlexRIO P2P VST

Host FPGA
Embedded, PC RIO

ni.com
SDR S/W Development Challenge
Tools Targets
Math (.m file script) Host Control (C, C++, .NET)
Simulation (Hybrid) DSP (Fxd pt C, Assembly)
User Interface (HTML) H/W Driver (C, Assembly)
Multicore
FPGA (VHDL, Verilog) System Debug FPGAs
Processors

• SDR development requires multiple S/W tools


• Parallel processing increases system complexity
• S/W tools don’t address system design

Long learning curves


Increased costs
Limited reuse
Need for “specialists”
Increased time-to-result

ni.com
Parallel Programming with LabVIEW

Task Parallelism Data Parallelism Pipelining

Multicore
Processors FPGAs

ni.com
FlexRIO based SDR Prototyping:
End-to-end Realtime LTE-like Wireless HD Video Link
• Completed in 4 weeks (6 man-months)
• MPEG-4, 720p video streaming and playback over UDP at 1.5 Mbps
• 7.68MS/s IQ Rate, modeled after LTE framing
• Tx/Rx physical layer in LabVIEW FPGA with FlexRIO and 5791 RF Transceiver
• DSP prototyping in LabVIEW DSP Design Module with high-performance IP
developed in LabVIEW FPGA IP Builder

LabVIEW DSP Design Module

NI 5791 (RF FAM) PXIe-7695R (FlexRIO)


ni.com
Summary
•LabVIEW offers a graphical approach, shortening the
design process, and tight hardware/software integration
that allows for seamless transition from design to test

•NI provides a full spectrum of RF / Communications


solutions: RF Test, Research and Education

•LabVIEW and NI USRP is an accessible, easy-to-use


software defined radio platform

ni.com
Next Steps

• Learn more about NI SDR and RF platforms


• Visit ni.com/sdr
• Download references from the Code sharing community”

• Learn more about LabVIEW


• Complete LabVIEW tips and tricks (Exercise 4)
• Visit LabVIEW 101 for videos and more
• Join the ni.com discussion forums

ni.com

You might also like