Skip to content

gr ubuntu

Tomek Mrugalski edited this page May 23, 2021 · 12 revisions

GNU Radio + Ubuntu 20.10

This page contains random notes of @tomaszmrugalski's attempt to run GNU Radio with the aim to possibly integrate it with Svarog.

Soapy Installation on Ubuntu

  1. soapy (https://gitlab.com/librespacefoundation/gr-soapy)
  2. soapySDR (https://github.com/pothosware/SoapySDR)

After installation, the SoapySDRUtil --info becomes available. It reports the following:

$ SoapySDRUtil --info
######################################################
##     Soapy SDR -- the SDR abstraction library     ##
######################################################

Lib Version: v0.8.0-g3fa5ef74
API Version: v0.8.0
ABI Version: v0.8
Install root: /usr/local
Search path:  /usr/local/lib/SoapySDR/modules0.8 (missing)
No modules found!
Available factories... No factories found!
Available converters...
 -  CF32 -> [CF32, CS16, CS8, CU16, CU8]
 -  CS16 -> [CF32, CS16, CS8, CU16, CU8]
 -  CS32 -> [CS32]
 -   CS8 -> [CF32, CS16, CS8, CU16, CU8]
 -  CU16 -> [CF32, CS16, CS8]
 -   CU8 -> [CF32, CS16, CS8]
 -   F32 -> [F32, S16, S8, U16, U8]
 -   S16 -> [F32, S16, S8, U16, U8]
 -   S32 -> [S32]
 -    S8 -> [F32, S16, S8, U16, U8]
 -   U16 -> [F32, S16, S8]
 -    U8 -> [F32, S16, S8]

Note the missing modules path. We'll get there in a minute.

  1. If using RTL-SDR, install https://github.com/pothosware/SoapyRTLSDR
  2. If using AirSpy, install https://github.com/pothosware/SoapyAirspy
  • requires libairspy (sudo apt install libairspy-dev)

Once those are installed, the SoapySDRUtil reports the hardware-specific modules are available:

$ SoapySDRUtil --info
######################################################
##     Soapy SDR -- the SDR abstraction library     ##
######################################################

Lib Version: v0.8.0-g3fa5ef74
API Version: v0.8.0
ABI Version: v0.8
Install root: /usr/local
Search path:  /usr/local/lib/SoapySDR/modules0.8
Module found: /usr/local/lib/SoapySDR/modules0.8/libairspySupport.so (0.1.2-10d697b)
Module found: /usr/local/lib/SoapySDR/modules0.8/librtlsdrSupport.so (0.3.2-53ee8f4)
Available factories... airspy, rtlsdr
Available converters...
 -  CF32 -> [CF32, CS16, CS8, CU16, CU8]
 -  CS16 -> [CF32, CS16, CS8, CU16, CU8]
 -  CS32 -> [CS32]
 -   CS8 -> [CF32, CS16, CS8, CU16, CU8]
 -  CU16 -> [CF32, CS16, CS8]
 -   CU8 -> [CF32, CS16, CS8]
 -   F32 -> [F32, S16, S8, U16, U8]
 -   S16 -> [F32, S16, S8, U16, U8]
 -   S32 -> [S32]
 -    S8 -> [F32, S16, S8, U16, U8]
 -   U16 -> [F32, S16, S8]
 -    U8 -> [F32, S16, S8]

Soapy Installation on Raspbian

This is much easier. Configure the APT source for Raspbian 10, then:

sudo apt install soapysdr-tools soapysdr0.7-module-rtlsdr soapysdr0.7-module-airspy:armhf

GNU Radio install on Ubuntu

GR 3.8 is included in the default Ubuntu 20.10. Simple sudo apt install gnuradio will do the trick.

GNU Radio install on Raspbian

Make sure you have librespace:satnogs sources configured in APT, as explain above. Then do the following:

sudo apt update
sudo apt install gnuradio gr-soapy gr-satnogs satnogs-flowgraphs

This will install the GR itself (gnuradio), the Soapy module for GR (gr-soapy), Satnogs specific modules for GR, e.g. doppler correction, LRPT decoder or APT sink (gr-satnogs) and flowgraphs that take use of many of the installed modules (satnogs-flowgraphs).

GR-satellites

  1. gr-satellites (https://github.com/daniestevez/gr-satellites/releases/tag/v3.8.0) - note the latest version (4.1.0) requires GR 3.9, which is newer than the commonly available 3.8. For the GR 3.8, the project releases older branch. As of May 2021, that's gr-satellites 3.8.0.

Swig is necessary for gr-satellites.

Experiments with flowgraphs

satnogs-flowgraphs provide a number of interesting flows for GNU Radio:

  • satnogs_afsk1200_ax25.py
  • satnogs_amsat_fox_duv_decoder.py
  • satnogs_argos_bpsk_ldr.py
  • satnogs_bpsk.py
  • satnogs_cw_decoder.py
  • satnogs_example_flowgraph.py
  • satnogs_fm.py
  • satnogs_fsk.py
  • satnogs_iq_receiver.py
  • satnogs_noaa_apt_decoder.py
  • satnogs_reaktor_hello_world_fsk9600_decoder.py
  • satnogs_sstv_pd120_demod.py

Each flow can be run independently from a command line and has many parameters. For example, the noaa_apt_decoder has the following:

$ satnogs_noaa_apt_decoder.py --help
usage: satnogs_noaa_apt_decoder.py [-h] [--antenna ANTENNA]
                                   [--bb-freq BB_FREQ] [--bw BW]
                                   [--dc-removal DC_REMOVAL]
                                   [--decoded-data-file-path DECODED_DATA_FILE_PATH]
                                   [--dev-args DEV_ARGS]
                                   [--doppler-correction-per-sec DOPPLER_CORRECTION_PER_SEC]
                                   [--enable-iq-dump ENABLE_IQ_DUMP]
                                   [--file-path FILE_PATH]
                                   [--flip-images FLIP_IMAGES] [--gain GAIN]
                                   [--gain-mode GAIN_MODE]
                                   [--iq-file-path IQ_FILE_PATH]
                                   [--lo-offset LO_OFFSET]
                                   [--other-settings OTHER_SETTINGS]
                                   [--ppm PPM] [--rigctl-port RIGCTL_PORT]
                                   [--rx-freq RX_FREQ]
                                   [--samp-rate-rx SAMP_RATE_RX]
                                   [--soapy-rx-device SOAPY_RX_DEVICE]
                                   [--stream-args STREAM_ARGS] [--sync SYNC]
                                   [--tune-args TUNE_ARGS] [--udp-IP UDP_IP]
                                   [--udp-dump-host UDP_DUMP_HOST]
                                   [--udp-dump-port UDP_DUMP_PORT]
                                   [--udp-port UDP_PORT]
                                   [--waterfall-file-path WATERFALL_FILE_PATH]

A NOAA APT Decoder with automatic image synchronization

optional arguments:
  -h, --help            show this help message and exit
  --antenna ANTENNA     Set antenna [default='']
  --bb-freq BB_FREQ     Set Baseband CORDIC frequency (if the device supports
                        it) [default='0.0']
  --bw BW               Set Bandwidth [default='0.0']
  --dc-removal DC_REMOVAL
                        Set Remove automatically the DC offset (if the device
                        support it) [default='False']
  --decoded-data-file-path DECODED_DATA_FILE_PATH
                        Set decoded_data_file_path
                        [default='/tmp/.satnogs/data/data']
  --dev-args DEV_ARGS   Set Device arguments [default='']
  --doppler-correction-per-sec DOPPLER_CORRECTION_PER_SEC
                        Set doppler_correction_per_sec [default=20]
  --enable-iq-dump ENABLE_IQ_DUMP
                        Set enable_iq_dump [default=0]
  --file-path FILE_PATH
                        Set file_path [default='test.wav']
  --flip-images FLIP_IMAGES
                        Set flip_images [default=0]
  --gain GAIN           Set gain [default='0.0']
  --gain-mode GAIN_MODE
                        Set gain_mode [default='Overall']
  --iq-file-path IQ_FILE_PATH
                        Set iq_file_path [default='/tmp/iq.dat']
  --lo-offset LO_OFFSET
                        Set lo_offset [default='100.0k']
  --other-settings OTHER_SETTINGS
                        Set Soapy Channel other settings [default='']
  --ppm PPM             Set ppm [default='0.0']
  --rigctl-port RIGCTL_PORT
                        Set rigctl_port [default=4532]
  --rx-freq RX_FREQ     Set rx_freq [default='100.0M']
  --samp-rate-rx SAMP_RATE_RX
                        Set Device Sampling rate [default='0.0']
  --soapy-rx-device SOAPY_RX_DEVICE
                        Set soapy_rx_device [default='driver=invalid']
  --stream-args STREAM_ARGS
                        Set Soapy Stream arguments [default='']
  --sync SYNC           Set sync [default=1]
  --tune-args TUNE_ARGS
                        Set Soapy Channel Tune arguments [default='']
  --udp-IP UDP_IP       Set udp_IP [default='127.0.0.1']
  --udp-dump-host UDP_DUMP_HOST
                        Set udp_dump_host [default='']
  --udp-dump-port UDP_DUMP_PORT
                        Set udp_dump_port [default=57356]
  --udp-port UDP_PORT   Set udp_port [default=16887]
  --waterfall-file-path WATERFALL_FILE_PATH
                        Set waterfall_file_path [default='/tmp/waterfall.dat']

There are source flows (*.grc files) available in the satnogs-flowgraphs repo, in satellites and generic directories. Opening those in GNU Radio companion can help a lot to understand what specific parameters do:

In our experiments, we tried the following:

./satnogs_noaa_apt_decoder.py --soapy-rx-device="driver=airspy" --rx-freq 137.9125M
  --antenna RX --gain 45 --bw 41000 --samp-rate-rx=3000000
  --decoded-data-file-path=/home/pi/observations/satnogs/decoded.png 
  --waterfall-file-path=/home/pi/observations/satnogs/waterfall
  --file-path=/home/pi/observations/recording.wav

Some parameters are mostly fixed:

  • --soapy-rx-device specifies the soapy init string. We can use driver=rtlsdr or driver=airspy, depending on which SDR is currenctly conencted.
  • rx-freq - obviously this is sat specific, expressed in Hz. Possible to use SI prefix, e.g. 137.1M
  • antenna RX - more advanced SDRs have multiple antennas, including TX. We use RX only
  • --decoded-data-file-path - this specifies where the output image file will be stored, format: PNG.
  • --waterfall-file-path - this specifies where the waterfall data will be stored, format unknown, python decoder.
  • --file-path - this specifies where the APT signal recorded as audio will be stored, format: WAV.

Others will require some tuning:

  • gain 49 - for RTL-SDR, the maximum is 49.6, for airspy max is 45.
  • bw 41000 - bandwidth 41000 Hz, according to US Radio guy, or 34000 Hz, according to wikipedia. Wider bandwidth is more forgiving for Doppler correction and SDR radio freq setting imperfections. However, too wide bandwidth will also amplify noise.
  • samp-rate-rx - this is samples per second, this is device specific. Some devices (e.g. RTL-SDR) support only certain number of samples per sec. RTL seems to work well with 2048000 samples/s, for airspy it's 3000000 samples/s.
Clone this wiki locally