Example Code

Wideband Spectrum Monitoring with NI USRP

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Hardware

  • RF|Wireless

    Software

  • LabVIEW

Code and Documents

Attachment

Description

 

From a high level, spectrum monitoring involves examining the frequency content of a spectral band as a function of time. At a lower level, the requirements and complexity of spectrum monitoring applications range from straightforward to quite involved. On the straightforward side, you may need to perform only a quick visual inspection of a running, averaged spectrum over a specific band. More involved applications build on this idea, possibly keeping a history of the spectrum and performing analysis either in real-time or offline.

 

NI USRP hardware offers up to 20 MHz real-time bandwidth and up to 40 MHz real-time bandwidth in a reduced dynamic range mode. Because the NI USRP-2920 relies on the host computer for processing, the real-time bandwidth that it can continuously sustain depends on a variety of factors:

 

  • Maximum real-time rate sustainable by the NI USRP-2920
  • Computational capability of the host PC
  • Amount of memory on the host PC
  • Efficiency of the LabVIEW application and other software associated with the NI USRP-2920
  • Background processes running on the host PC (for example, background virus scanner)
  • Network traffic on the Gigabit Ethernet network hosting the NI USRP-2920
  • Efficiency of the host PC network adaptor

Because many of these factors are situation-dependent, the maximum sustainable real-time bandwidth is also situation dependent.

 

For applications that require bandwidth monitoring greater than the real-time bandwidth acquisition capability of the NI USRP radio transceiver, you can construct an aggregate spectrum. This example shows you how to acquire portions of the spectrum and build an aggregate spectrum piece by piece over time.

 

The example block diagram shows an aggregate spectrum built up band by band. The acquisition VI marked as step 4 is surrounded by two For Loops. With each iteration of the outer loop, the VI retunes the NI USRP radio transceiver to a new sub-band frequency for a new set of acquisitions at that frequency. The inner loop calls the acquisition VI multiple times to acquire a set of acquisitions to calculate an averaged spectrum.

 

migration-bot_0-1605300621519.png

 

 

migration-bot_1-1605300621531.png

 

How to Use

Software Requirements

  • LabVIEW 2011 or compatible

  • NI USRP 1.1 or compatible

Hardware Requirements

NI USRP 292x RF Transceiver



  1. Download and unzip WB Spectrum Example VIs.zip.

  2. Open Simplified WB Averaged Spectrum.vi.

  3. Input the USRP IP Address of your device and configure the Rx parameters.

  4. Run the VI and observe the FFT Power Spectrum.

Additional Information

Other spectral monitoring examples can be found in the NI-USRP shipping examples located in the Start Menu >> National Instruments >> NI USRP Examples.

Related Links

Sam Shearman

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
YYYs
Member
Member
on

I get the following error message:

Property Nodes (arg 5) in subsetupRxHWParameters.vi->subSetParameters(HL).vi->Simplified WB Spectrum Sense (Averaged).vi <ERR>

The specified attribute ID is not recognized.

There is no content in link for the description.

sshearman
Member
Member
on

The example requires the ni-usrp driver Ver 1.1 or higher. Ver 1.1 includes some new properties that werent part of Ver 1.0. The new driver will be released in less than a month and is avail now as a prerelease.

--Sam

Sam Shearman

Senior Product Mgr, National Instruments

Cell: (512) 576-6170

Sent from my iPhone.

Sam Shearman
NeoGHOST1
Member
Member
on

Hi,

there is a little mistake in the program:

if you try to average with: RMS average, Linear, Number of averages = 2,

the mistake will be visible in the spectrum,

for example in the wideband spectrum with only one strong narow carrier, instead of one line you can see two lines.

The second line, moved to upper frequencies exactly by the half of "df" is the mistake.

The "ghost" carrier, which should not be there is made by averaging moved by one iteration.

In the smallest loop in the main VI, there is shift register, but the iteration number "i" should be shifted by shift register too.

Problem solved.

lvproblem.jpg

Thanks for nice example.

Regards.

Neo

VSB Technical University Ostrava.

Czech republic

ErikL
NI Employee (retired)
on

Hello Neo -

These suggestions are very helpful.  Please post your updated code to this

page in the community.  We would very much like to learn how you are using

the USRP and LabVIEW in your research.

Best Regards,

Erik

John_Peng
Member
Member
on

I'm getting a change in the gain as the program steps through the frequencies. Below shows the IQ waveform samples at their original scale:

spectrumSmall.JPG

After stepping through the first few frequency ranges, there is a jump in the gain. Notice the jump in the amplitude. The underlying signal is just noise.

spectrumBig.JPG

Upping the sampling rate so that the entire frequency range is covered in one step shows that the spectrum is clean:

spectrumNoProb.JPG

The following shows the modifications I made to monitor the input waveform:

modifications.JPG

Any help would be appreciated.

-John

University of Virginia

John_Peng
Member
Member
on

I found a new problem with the spectrum monitoring software. Here is a sweep of the FM spectrum with a strong signal at 97.5 MHz with a sampling rate of 200 kHz:

200k.jpg

Here is the same spectrum swept with a sampling rate of 1MHz:

1M.jpg

The 97.5 channel appears at a higher frequency as you increase the sampling rate.

-John

sshearman
Member
Member
on

Hi John,

I've just posted a revised version of the example (see the zip file dated 9/6/2012) that addresses theproblem of a frequency shift being a function of sampling rate. As you rightly pointed out, the sampling rate (bandwidth) should b independant of the location of the peaks and other components of the spectrum. The gain change is another issue that I'm still working on for this example.

--Sam

Sam Shearman
airflyflame
Member
Member
on

Hi everybody,

When I run the example "Simplified WB Spectrum Sense (Averaged)", some errors are reported: niUSRP Open Rx Session.vi<ERR>A runtime or configuration error occurred.  Code: 1440 Details: RuntimeError:  Please update the firmware and FPGA images for your device. See the application notes for USRP2/N-Series for instructions. Expected protocol compatibility number [7 to 11], but got 12: The firmware build is not compatible with the host code build. I use the USRP N200 and Labview 2012. The installed USRP driver is niUSRP 110.  Is there anybody can tell me the reason? thanks a lot!

Igorina
Member
Member
on

I have downloaded the 952012 version of this code and am getting the same error as YYYs:

Property Node (arg 5) in subsetupRxHWParameters.vi->subSetParameters(HL).vi->Simplified WB Spectrum Sense (Averaged).vi <ERR>

The specified attribute ID is not recognized.

Any help would be appreciated 🙂

ErikL
NI Employee (retired)
on

Hello -

Are you using the NI USRP 1.2 version of the driver?

http://joule.ni.com/nidu/cds/view/p/id/3696/lang/en

Erik

Jaya1981
Member
Member
on

Hi Sherman,

I could not find the updated version (see the zip file dated 9/6/2012). I can only see the old version. Can you please reattach it.

Thanks

ErikL
NI Employee (retired)
on

The code posted contains the latest updates made to the example in september of 2012.  Feel free to make improvements and post your own enhanced code!

Vojtech_D.
Member
Member
on

Hi airflyflame,

The reason for your error is that you are using the wrong FPGA bit file. Load the one, which is provided with the NI driver and you'll be fine.

I have the same issue, but I cannot use the provided FPGA bit file, because I have my own FPGA bit file, which is a self-developed extension to the Ettus FPGA source code, which has protocol compatibility number 12. As long as I worked with earlier versions of the FPGA source code, the NI driver was functional too. Could NI tell us, when you are going to update the Labview driver to be compatible with the latest Ettus FPGA bit file?

Vojtech

CJLEE
Member
Member
on

Hi, I have a question.  What parameter (time in Rx Average power) ? Acq duration is averaging time????

gauraangKhurana
Member
Member
on

Hi, Thanks for the example.

I am new to USRP and Labview, I need to do exactly the same thing you are doing in this code. I need to find out the signal strengths of higher frequencies.

Being from Computer Science background I have no idea about transforms and averaging etc.

I am getting an error while running the code, Can you please help me with it.

Error :  -1074118626     niUSRP Initiate.vi<ERR>The local oscillator did not lock within the allotted time.

PLEASE HELP ME

I changed the Acq Duration to 10m otherwise the code won't start and I would get the same error in the beginning.

Capture.PNG

National_Burritos
NI Employee (retired)
on

Hi @gauraangKhurana

Did you ever get through your error?

Thanks!

Rahul

Rahul B.
ashahid
Member
Member
on

Error :  -1074118626     niUSRP Initiate.vi<ERR>The local oscillator did not lock within the allotted time.

 

I an doing wideband spectrum monitoring. USRP 2920 is sweeping across 50 MHz to 01 GHz. I get this error mostly in 1st sweep and sometimes after sweeping the whole band 02 times.

Any help would be valuable.

Kandregula007
Member
Member
on

Hi sshearman you have done good work uploading the example code for wide band spectrum analysis. As per the comments above which are quite old i couldn't find your updated example code. Could you please update the code and any updates on gain?