Software Defined Radio GNU Radio and the USRP Overview What is Software Defined Radio? Advantages of Software Defined Radio Traditional versus SDR Receivers SDR and the USRP Using GNU Radio Introduction What is Software Defined Radio (SDR)? Getting code as close to the antenna as possible Replacing hardware with software for modulation/demodulation Advantages: Makes communications systems reconfigurable (adapting to new standards) Flexible (universal software device - not special purpose) Filters/Other Hardware Cognitive Radio 3 1
Traditional Receiver 10 KHz RF Amplifier 530 1700 980 f c x f LO -f c f LO +f c f LO Local Oscillator 10 KHz 10 KHz IF Amplifier 455 f LO =1435 KHz 10 KHz 455 5 530 1700 980 4 Traditional vs. SDR Receiver Receiver Front End Traditional / Hardware Receiver RF Amplifier x Local Oscillator IF Amplifier Current SDR Receiver Receiver Front End Software Future SDR Receiver? Software 5 SDR Receiver Using the USRP Daughterboard Motherboard Receiver Front End USB Controller PC similar to traditional front end with f IF = 0 Decimation, MUX, + Interface to PC GNU Radio software USRP: Universal Software Radio Peripheral 6
Quadrature Signal Representation The received signal, S(t), may be represented as follows: S(t) = I(t)cos(! f c t) + Q(t)sin(! f c t) f c = carrier frequency I(t) = in-phase component Q(t) = quadrature component Contain amplitude and phase information of baseband signal GNU Radio software uses I and Q components to demodulate signals USRP front end translates the signal to zero frequency and extracts I and Q 446 7 Extracting I(t) from S S(t) = I(t)cos(! f c t) + Q(t)sin(! f c t) Multiplying both sides by cos(πf c t): S(t)cos(! f c t) = I(t)cos (! f c t) + Q(t)sin(! f c t)cos(! f c t) [ ] + Q(t) [ sin(4! f c t) + sin(0) ] = I(t) 1 + cos(4! f ct) = 1 I(t) + 1 I(t)cos(4! f c t) + + 1 Q(t)sin(4! f c t) Applying this signal to a low pass filter, the output will be: 1 I(t) 8 Extracting Q(t) from S S(t) = I(t)cos(! f c t) + Q(t)sin(! f c t) Multiplying both sides by sin(πf c t): S(t)sin(! f c t) = I(t)cos(! f c t)sin(! f c t) + Q(t)sin (! f c t) [ ] + Q(t) [ 1" cos(4! f c t) ] = I(t) sin(4! f ct) " sin(0) = 1 I(t)sin(4! f c t) + 1 Q(t) " 1 Q(t)cos(4! f c t) Applying this signal to a low pass filter, the output will be: 1 Q(t) 9 3
USRP Receiver Front End x LPF I RF Amplifier 90 f c LO x LPF Q 10 Analog to Digital Converter () 1 bit A/D Converter ( 1 levels) volt peak-peak maximum input 64 Msamp/second t Sampling Interval: Quantization Levels: 1!t = = 0.0156µS 6 64 " 10!v = = 0.488mV 1 11 Decimation Original sampling rate is 64Msamp/sec Converts a portion of spectrum 3 MHz wide Generally we are interested is a narrower portion of the spectrum requiring a lower sampling rate USB cannot handle that high data rate Occurs in the of the USRP f 3MHz LPF 50KHz f Downsample divide by 18 50KHz f s = 64Msamp/sec f s = 64Msamp/sec f s = 500Ksamp/sec f 64M 500K = 18 1 4
SDR Receiver with USRP Motherboard Daughterboard I (Decimator, MUX, etc.) USB Controller PC Q GNU Radio Software 13 USRP Motherboard/Daughterboard 14 GNU Radio Software Community-based project started in 1998 GNU Radio application consists of sources (inputs), sinks (outputs) and transform blocks Transform blocks: math, filtering, modulation/demodulation, coding, etc. Sources: USRP, audio input, file input, signal generator, Sinks: USRP, audio output, file output, FFT, oscilloscope, Blocks written in C++ Python scripts used to connect blocks and form application 15 5
Design of a Receiver USRP GNU Radio Application USRP: Set frequency of local oscillator (receive frequency), gain of amplifier, decimation factor GNU Radio application: use Python to specify and connect blocks that perform demodulation and decoding 16 Example: 400-500 MHz NB Receiver Problem: Receive an audio signal (up to 4 KHz) transmitted at 446 MHz using narrowband (NB) with a transmission bandwidth USRP GNU Radio Application 400 500 446 f 4KHz 17 Design Procedure 1. Plan the block diagram of system components. Determine block parameters 3. Determine decimation rates 4. Write Python script to specify the blocks and connect them together 18 6
NB Receiver: Block Diagram/Parameters 400 500 446 3 -? -8 8? USRP PC Daughterboard f c = 446 MHz 64 Msamp/sec??? -?? 19 Determining the Decimation Factors D 1 3 D D 3 Total Decimation factor = 8000 = D 1 D D 3 64Msamp/sec 8Ksamp/sec 0 Decimation Factor, D 1 D 1 3 D D 3 Total Decimation factor = 8000 = D 1 D D 3 Maximize the decimation in Maximum decimation factor in = 56 Select D 1 = 50 (factor of 8000) Output sample rate = 64Ms/s / 50 = 56Ks/s 1 7
Specification 64Ms/s 50 3-18 56Ks/s D 18 D 3 H (db) 0-0.1-60 -16-9 -8 8 9 16 Maximum frequency = 56Ks/s / 3Ks/s D = 8 Reduce sample rate to 3 Ks/s 64Ms/s 50 3-16 -8 8 8 16 3Ks/s D 3-18 18 56Ks/s Maximum frequency = 4 KHz Reduce sample rate to 8 Ks/s 3Ks/s / 8Ks/s D 3 = 4 block extracts audio signal from waveform by operating on I and Q 3 Complete Application Design 64Ms/s 50 3-16 -8 8 8 16 3Ks/s 4 8Ks/s -18 18 56Ks/s Total decimation ratio = 50*8*4 = 8000 Problem: The audio card requires an input sample rate 44.1 Ks/s Solution: Use a Resampler to increase the output sample rate 4 8
Final Application Design 64Ms/s 56Ks/s 3Ks/s 3Ks/s 50 8 1 Resampler mult by 3 div by 48Ks/s Card requires a sample rate 44.1 Ks/sec. Use 48 Ks/sec. Modify to have a decimation factor of 1 (no change) Increase the sample rate to 48 Ks/sec with Resampler (x 3/) 5 Implementing the Design Create a Python script to specify and connect the various GNU radio blocks Blocks are already written in C++ USRP parameters are set within Python script # indicates that the line is a comment Refer to nbfm.py script 6 Setting the USRP Parameters The following code sets the USRP Parameters: 7 9
Design The following code specifies the channel filter and computes the coefficients H (db) 0-0.1-60 -16-9 -8 8 9 16 8 Creation The following code creates the channel filter using the coefficients computed: 9 The following code creates the demodulator. The demodulator block also includes a low pass filter. 30 10
Resampler The following code creates the resampler. The resampler decimates and/or interpolates the data to adjust the sample rate. 31 Connecting the Blocks The following code connects the blocks: Or, a single connect statement: 3 Final Thoughts Demonstration Storing/creating data Transmitters Installing GNU radio Questions Where do we go from here? 33 11