Building Your First Waterfall & Frequency Plot

The purpose of this tutorial is to confirm your host setup, and use your Per Vices Crimson TNG as a signal source and receiver to pass data to a waterfall & frequency plot.

In this tutorial, we will cover:

You can also find the completed waterfall & frequency plot GNU Radio script here.

Prerequisites: Ensuring Background Knowledge

This tutorial assumes you have already set up your Crimson TNG and configured your network. If you have not done so, you can reference the following how tutorials:

  1. Information on how to physically set up your unit can be found at Per Vices How To 1.
  2. Information on how to configure your network can be found Per Vices How to 2.

These must be properly set up to test your device.

Part 1: Preparation for Making Program

1.1 Setting up Loop Back

CAUTION: Ensure the use of SMA connector with 30dB attenuation to ensure safe operation of the Crimson TNG

The signal test you will make is for when Tx ports communicating directly to the Rx ports, so you must connect them to each other with the SMA connector. This will test the functionality of transmitting and receiving in one program. Connect Tx-A to Rx-A, like pictured below.

Figure 1: implementing external SMA loop back from Rx-A to Tx-A using an SMA connector with 30dB attenuator

This set up is known as “loop back”. Later in the tutorial, you may want to add more to test multiple ports at once.

1.2 Getting Familiar with GNU Radio Software

GNU Radio is a software that uses drag and drop programming, allowing users to easily prototype their software defined radio systems (SDRs). GNU Radio utilizes a Graphical User Interface (GUI) for your programs, which enables you to control the visuals of your program in an easy manner. To complete the Waterfall and Frequency Plot, it is recommended you go through the GNU Radio’s tutorials to ensure comfort with the program as this tutorial utilizes the software.

Complete Introducing GNU Radio and Flow graph Fundamentals at the following link.

This wiki is up kept by the GNU Radio creators and is a great source if you ever need a stronger understanding of GNU Radio’s functions.

Part 2: Creating Your First Waterfall and Frequency Plot using GNU Radio

You will now start actually creating the flowchart program to test your Crimson TNG. The waterfall & frequency plot will require the following two flow block diagrams: a signal generator sink and a waterfall & frequency sink.

2.1. Launching GNU Radio

Launch the GNU Radio software to begin the creation of your first waterfall and frequency plot. GNU Radio uses drag and drop programming, allowing users to easily prototype their software defined radio systems (SDRs). Each block in this software represents a signal processing function, so your finished program will be a flowchart of functions that connects to the external Crimson TNG hardware.

GNU Radio utilizes a Graphical User Interface (GUI) for your workspace and your programs. Any block that has “GUI” in the title is referring to a function that will add a visual representation to your pop-up window, or GUI, when the code is run.

When you open up a new project in GNU Radio, you will have two blocks: an Options and a Variable block.

Figure 2: Default Blocks

Double-click on the Options block, and do the following:

Figure 3: Properties of Options

Similarly, double-click on the Variable block and change the following:

Figure 4: Properties of Variables

At this point it would be wise to save this file. You can it CTRL-S or click on file>save on the top left of the window. The name you choose for the file is not relevant to the Title or *Id. If you don’t save now, the application will prompt you to save your file before compiling your code, but it’s good practice to frequently save.

2.2 Signal Generator Sink

Finding Blocks

You will now start constructing the flow chart, forming the basis of the waterfall & frequency plot. The easiest way to place blocks is to grab and drag from the list of blocks on the right-hand side of GNU Radio’s interface Figure 5. Using CTRL-F opens a search bar at the top of the block list, which can help you find the blocks you need in a faster manner.

Figure 5: GNU Radio List of Blocks/Search Function

Signal Source

To start, find a Signal Source block, which sends out signals to be transmitted by your Crimson TNG. Double click on the block and ensure the properties match figure 8.

Figure 6: Properties of Signal Source

Notice how the Sample Rate doesn’t contain a value, but references the samp_rate variable. For now, the Frequency and Amplitude* are arbitrary. Later, you will turn these into variables.

Complex to IShort

Next, you will need an Complex to IShort block. The function of this block is self explanatory. Ensure the Vector Output and Scale Factor match the image below. This scaling factor is recommended by the GNU program when working with signed voltage and a 16-bit output.

Figure 7: Properties of Complex to IShort

UHD: URSP Sink

To finish the Signal Generator Sink, you will need a GUI sink block will act like a transmitter to a SDR and displays the signals it sends on the screen. The sink block you’ll use today is called the UHD: URSP Sink. You will have to use both the general and the RF Options tabs.

Figure 8: Properties of UHD: URSP Sink

Completed Sink Flow Chart

The final signal generator sink flow chart should look like the following:

Figure 9: Signal Generator Sink

2.3 Waterfall and Frequency Sink

Second, we will construct the waterfall & frequency sink using blocks connected in following order: UHD: USRP Source, inputted to a IShort to Complex block, which is then inputted to a QT GUI Frequency Sink and QT GUI Waterfall Sink. Again, we will need to change a few parameters on these blocks:

UHD: URSP Source

For the UHD: USRP Source block, change the Output type and Wire Format parameter to Complex int16, set the Stream Channels parameter to [0] in square brackets since we are using channels Tx-A and Rx-A, and set the Sample Rate, Ch0: Center Freq (Hz) and Ch0: Gain Value to the same values as the UHD: USRP Sink in the signal generator sink block diagram: Figure 10.

Figure 10: Properties of UHD: URSP Source

Completed Waterfall and Frequency Flow Chart

The figure below shows how the waterfall and frequency plot sink block flow chart should look on your screen.

Figure 10: Waterfall and Frequency Sink

Notice how both GUI blocks connect to the output of the IShort to Complex block.

2.4 Variable Ranges

We also want to control the frequency and amplitude values of the waterfall & frequency plot, which can be accomplished using two QT GUI Range blocks.

Figure 11: Properties of GUI Ranges

The figure below shows how these ranges are referenced in the other signal functions:

Figure 12: Ranges Referenced

Notice that the centre frequency in some areas is the range divided by two. It’s good practice to try and use the ranges as variables when you can because it will make it easier if you ever need to change values.

2.4 Running Your First GNU Radio Script

In order to run the code, save your work and then press the play button on the top of the interface screen. The program will run, and a new window should appear which shows your frequency slider, amplitude slider, waterfall sink plot, and frequency sink plot, as shown in Figure 13.

Figure 13: Window of your Waterfall and Frequency Plot

Note

 By default, GNU Radio will automatically save a block prior to running it. You may want to make back-ups or use version control.

Part 3: Extending GNU Radio Script

You may also want to use your Crimson TNG on different channels or on multiple channels. Below we will go through how to perform a waterfall & frequency plot on a different channel and on multiple channels.

3.1. Channel Modification

Crimson Channel Associations

The four channels on the Crimson unit are related to [0, 1, 2, 3], which you would refer to in the the properties of the function blocks.

Figure 14: Crimson Channel Associations (Rx and Tx)

Changing to Tx-B and Rx-B

To make your waterfall & frequency plot work on a different channel, you simply need to move the SMA connector with 30dB attenuator external loop over to channels Tx-B and Rx-B, shown in Figure 10 and change the stream channels parameter in the UHD: USRP Source and UHD: USRP Sink block to [1], as shown below in Figure 11.

Figure 10: Changing Crimson External SMA connector to Tx-B and Rx-B

Figure 11: Using a Different Stream Channel in GNU Radio

You should now be able to run this the same as you did before and see a similar new window appear.

3.2 Using Multiple Channels

Now we are going to make our GNU Radio script waterfall & frequency plot sink work using two channels; the Tx-A & Rx-A and Tx-C & Rx-C. We need to use two SMA connectors now to make an external loop for each channel, shown in Figure 11 below.

Figure 12: Multi-channel (Tx-A/Rx-A and Tx-C/Rx-C) external SMA Loops

Duplicating the Signal Generator Sink Flow Chart

Start setting up your second channel by copying and pasting your GUI Range blocks. GNU Radio will auto update their Ids, but you are welcome to set them to whatever name is easiest for you. Theoretically, you could have two UHD: USRP Sink blocks receiving input from the same output, but for this project you will have four range controls. Two per Signal Source Block.

Figure 13: Second Set of GUI Ranges

Next, we will need to duplicate the signal generator sink block diagram shown in Figure 6. We can easily select multiple blocks by holding CTRL and clicking the relevant blocks, followed by copying and pasting. You will now have two block diagrams composed of a Signal Source to Complex to IShort to UHD:USRP Sink: one block diagram which we will allocate to Tx-A/Rx-A and the other to Tx-C/Rx-C. We will need to make the following parameter changes to use multiple channels:

Figure 14: Second Signal Generator Properties

The entire block diagram should be similar to what is shown in the Figure 13 below.

Figure 15: Multi-channel Waterfall and Frequency Block Diagram

Finally, you can run the GNU Radio script and your output should produce two frequency and water plots, one for each channel, similar to what we had in 3.4.

Note

You can also double-click on the <u>QT GUI Waterfall Sink</u>, go into the "Config tab" and change the *Line One Color* parameter to get different color schemes for your plots.

You should now have something similar to Figure 14 shown below.

Figure 16: Multi-channel Waterfall and Frequency Plot