Table of Contents

FIT/CorteXlab 102

We will now use the fft_web tool that allow use to have a spectrum analyzer and to follow spectrum evolution during a CorteXlab experiment from anywhere in the world.

Of course, use prerequisite tutorial to connect to CorteXlab, log into the “airlock” SSH front-end with the following command:

cxlbusr@debian-jessie-cortexlab:~$ ssh -X -v tuto<group number>@airlock 

And don't forget to replace <group number> with the number of the group assigned to you

We recall that division of resources will be according to the table below

Group SSH login Nodes to use Frequency TCP Port
1 tuto1 node 3 and node 4 2.490GHz 6663
2 tuto2 node 7 and node 8 2.491GHz 6664
3 tuto3 node 13 and node 14 2.492GHz 6665
4 tuto4 node 17 and node 18 2.493GHz 6666
5 tuto5 node 23 and node 24 2.494GHz 6667
6 tuto6 node 25 and node 27 2.495GHz 6668
7 tuto7 node 28 and node 32 2.496GHz 6669
8 tuto8 node 33 and node 34 2.497GHz 6670
9 tuto9 node 37 and node 38 2.498GHz 6671

Executing the test_fft_web task

fft_web is a bloc provided by CorteXlab that permits to visualise a spectrum during an experiment.

Go into the test_fft_web directory and take a look:

tuto#@srvairlock:~$ cd examples/test_fft_web
tuto#@srvairlock:~/examples/test_fft_web$ ls
benchmark_tx.py  scenario.yaml    transmit_path.py  usrp_fft.py
receive_path.py  test_fft_web.py  uhd_interface.py

Some of these files as benchmark_tx.py are already known to you. Some other are new, the only one that we will use is usrp_fft.py. This script is used to configure the fft_web GNU radio block with all the necessary parameter: on which frequency it should listen, on which UDP port it should send its spectrum etc.

The command line in the scenario.yaml file lists all these parameters, see below, and do not forget to change the number of the nodes corresponding to your tutorial. On can see below that the UDP port used here is 6663, please change it with the one associated with your tuto in the table above.

nodes:

  node4:
    command: benchmark_tx.py --antenna="TX/RX" --args="addr=192.168.10.2" --tx-amplitude=0.2 -v -W 2M -f 2.49G -M 100.0

  node3:
    command: usrp_fft.py  -T 'TX/RX' -G '25' -W '4M' -F '2.49G' -P '6663' -I 'srvwww.cortexlab.fr' -A '-110' -B '-50' -R '4M' -S '1024' -H '10'
    passive: true

Lauching test_fft_web

First reserve the nodes of your tuto as it is indicated in CorteXlab 101 tutorial

The create and launch the task:

tuto#@srvairlock:~/examples/test_fft_web$ cd ..
tuto#@srvairlock:~/examples$ minus task create test_fft_web 
Creating the task file...
Task file test_fft_web.task created successfully.
tuto#@srvairlock:~/examples$ minus task submit test_fft_web.task 

The task is now running, come back is the virtual machine an launch a Firefox browser internet → Firefox ESR. Actually you can use any browser present on your machine.

go to the following URL: http://xp.cortexlab.fr/fft, set the UDP port on which the transmission should occur and click on New graph, you should your signal' spectrum, something like that:

Creating a flow graph on your PC

As it is not very convenient to work on CorteXlab server, we will explain here how to create flow graphs with GNUradio on your machine and export them to CorteXlab. We are going to create a new flowgraph called spectrum_analyzer.grc.

Cloning the example task

An example task is provided in the FIT/CorteXlab GitHub repositories. It is kept up-to-date and well prepared to run. First let us prepare to clone the example task.

Let us start by erasing any previous (and possibly outdated) version of the example task already present in your home dir:

cxlbusr@debian-jessie-cortexlab:~$ rm -rf examples

Now let us retrieve the examples repository on GitHub :

cxlbusr@debian-jessie-cortexlab:~$ git clone https://github.com/CorteXlab/examples.git
cxlbusr@debian-jessie-cortexlab:~$ cd examples
cxlbusr@debian-jessie-cortexlab:~/examples$ cd my_task

Creating our flow graph

Launch, on your virtual machine, the gnuradio-companion tool

 cxlbusr@debian-jessie-cortexlab:~/examples$ gnuradio-companion 

Now we are going to add two blocks to the flowgraph:

Connect the “out” connector of the UHD:USRP Source to the “in” connector of the fft web block.

Here are the parameter to change for the two new blocs that we have added:

This is it!

Save your grc file to spectrum_analyzer.grc

Generate the flowgraph, a spectrum_analyzer.py should have appeared in the directory.

Sending the task to airlock

Copy the whole new directory to CorteXlab's server:

cxlbusr@debian-jessie-cortexlab:~/my_fft_web$ cd ..
cxlbusr@debian-jessie-cortexlab:~/$ scp -P 22 -r my_fft_web/ tuto#@gw.cortexlab.fr:~

Log on the testbed and add the necessary files to your your new task:

you@srvairlock:~/my_fft_web$ cp ~/examples/test_fft_web/benchmark_tx.py ./
you@srvairlock:~/my_fft_web$ cp ~/examples/test_fft_web/uhd_interface.py ./
you@srvairlock:~/my_fft_web$ cp ~/examples/test_fft_web/transmit_path.py ./
you@srvairlock:~/my_fft_web$ cp ~/examples/test_fft_web/scenario.yaml ./

Edit the scenario.yaml file, do not forget to use your nodes.

you@srvairlock:~/examples/spectrum_analyzer$ pico scenario.yaml
#
duration: 300

#
nodes:

  node4:
    command: benchmark_tx.py --antenna="TX/RX" --args="addr=192.168.10.2" --tx-amplitude=0.2 -v -W 2M -f 2.49G -M 100.0

  node3:
    command: ./spectrum_analyzer.py
    passive: true

Create your task, reserve your node, launch your task and check for spectrum with xp.cortexlab.fr/fftweb