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:
- Part 1: How to set up Per Vices Crimson TNG
- Part 2: How to test and confirm your host set up
- Part 3: How to setup the Crimson TNG to write your first GNU Radio script: Waterfall & Frequency Plot
- Part 4: Extending The Waterfall & Frequency Plot to Different and Multiple Channels
You can also find the completed waterfall & frequency plot GNU Radio script here.
Part 1: Set Up and Configuring the Unit
In Part 1, we will be ensuring your Crimson TNG unit is properly connected.
1.1. How to physically setup your SDR
Information on how to physically set up your unit can be found here.
Information on how to configure your network can be found here.
1.2. Connect Rx to Tx using external SMA Loop Back for Waterfall plot
|You MUST use an SMA connector with a 30dB attenuator to ensure safe operation of the Crimson TNG device.|
Setting up Crimson TNG for the waterfall & frequency plot first involves looping Tx-A and Rx-A SMA jacks together on the front of the unit using an SMA connector with a 30dB attenuator. See Figure 3 below.
Figure 3: implementing external SMA loop back from Rx-A to Tx-A using an SMA connector with 30dB attenuator
Part 2: Testing Successful Setup and Operation
Testing the successful setup and operation of your unit can be found here.
Part 3: Building Your First Waterfall & Frequency plot using GNU Radio
3.1. Launching GNU Radio
Next we will launch GNU Radio and begin the waterfall & frequency plot project. GNU Radio is a toolkit which allows us to prototype a software defined radio system using an easy to use graphical user interface (GUI). This allows us to connect signal processing function blocks in a flow chart, creating a program which communicates with our external Crimson TNG hardware.
When you open up a new project in GNU Radio, you will have two blocks: an Options and a Variable block. Double-click on the Options block, and do the following:
- Make the Title “Waterfall/Frequency”, and type an Author and Description in the appropriate fields if you choose.
Similarly, double-click on the Variable block and change the following:
- Make the Id “samp_rate”, and set the Value parameter to a sample rate of 1e6 (1,000,000)
Figure 4: Default Blocks
3.2 Finding and Placing Blocks
We will now start constructing blocks that are wired together; forming the basis of our 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. The two main types of blocks are a source block (samples incoming waves/acts as a receiver) and sink block (convey output of our processing/acts as a transmitter). We are able to wire these blocks together by clicking on the output of a block, where a virtual cable appears, which we are then able to route to the input of another block. Also note that you can use the CTRL-F shortcut and a search bar will appear that allows you to easily find blocks for your GNU Radio project.
Figure 5: GNU Radio List of Blocks/Search Function
3.3. Placing and Wiring Blocks for our Waterfall & Frequency Plot
In our case, the waterfall & frequency plot will require the following two flow block diagrams: a signal generator sink and a waterfall & frequency sink.
First, we need to construct our signal generator sink block diagram, Figure 6, using the following blocks: Signal Source block, connected to the input of a Complex To Ishort block which is inputted into a UHD: USRP Sink block. We will need to change a few parameters by double-clicking on these blocks:
- For the Signal Source block, set the Sample Rate paremeter to 1M, Frequency parameter to 50k and Amplitude parmeter to 26k.
- For the Complex To Ishort block, leave the Scale Factor as is and change Vector Output to yes.
- For the UHD: USRP Sink block, change the Input Type parameter to Complex int16, set the Stream Channels to  in square brackets (i.e. Tx CH A), set the Wire Format to Complex int16, set the CH0: Center Freq (Hz) parameter to 400M, and set the CH0: Gain Value to 15.
Figure 6: Signal Generator 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:
- For the UHD: USRP Source block, change the Output type and Wire Format parameter to Complex int16, set the Stream Channels parameter to  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 6.
- For the Ishort to Complex, this will have the same values as the Complex To Ishort in the signal generator sink block diagram above as well.
- The default parameters on the QT GUI Waterfall Sink and QT GUI Frequency Sink are fine for this project.
The figure below shows how the waterfall and frequency plot sink block diagram should look on your screen.
Figure 7: Waterfall and Frequency Sink
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.
- Set the ID and Label parameter accordingly on both QT GUI Range blocks.
- Change the parameter values on the QT GUI Range block (amplitude counter & slider) as follows:
- Default Value = 26k, Start =0, Step=32k, and Step=1K.
- Similarly, change the parameter values on the QT GUI Range block (frequency counter & slider) as follows:
- Default Value= 50k, Start=-500k, Stop=500k, and Step=1k.
The figure below shows how these two range blocks should look:
Figure 8: Frequency and Amplitude Range Blocks
3.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 9.
Figure 9: Window of your waterfall and frequency plot
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 4: 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.
4.1. Modify Waterfall & Frequency Project Script to Different Channel
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 , 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 we did in 3.4. and see a simlar new window appear.
4.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
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:
- Click on both the UHD:USRP Sink blocks, and assign one block’s Stream Channel parameter to  (i.e.Tx-A) and the other block’s Stream Channel parameter to  (i.e.Tx-C).
- Change the UHD: USRP Source Stream Channels parameter to [0,2], indicating that we want to be able to output and control two channels on two separate QT GUI Waterfall Sink and QT GUI Frequency Sink blocks.
- Set Num Channels parameter in the Signal Source to “2”, so that we have two outputs on the block. We are then able to route each output channel to a Complex to Ishort and then to a QT GUI Waterfall Sink and QT GUI Frequency Sink.
- We also need to ensure that our Center Freq parameter matches with the signal generator block’s UHD:USRP Sink.
- To control the frequency and amplitude of each channel, we will also need to make another two GUI Range blocks, and ensure the Id parameter of each of these matches what is found on each Signal Source block under Frequency and Amplitude.
The entire block diagram should be similar to what is shown in the Figure 13 below.
Figure 13: 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.
You can also double-click on the QT GUI Waterfall Sink, 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.