SDR GUI

I created this GUI for my various SDR devices. It requires yad and redsea which can be installed via your favorite package manager. It also requires nrsc5 which has to be built.

sdrgui_66.png

Installation

yad

Debian/Ubuntu install with sudo apt install -y yad.

redsea

Debian/Ubuntu install with sudo apt install -y redsea.

sdr.sh

Create a bash script and put it somewhere in your path. I use ~/.local/bin. And yes, make it executable. chmod 775 ~/.local/bin/sdr.sh.

#!/usr/bin/env bash

filename=$(basename -- "$0")
extension="${filename##*.}"
filename="${filename%.*}"

response=$(~/.local/bin/yad-${filename}.${extension})

IFS="|"
i=0
for j in $response
do
    cmd[$i]=$j
    ((i++))
done

tuner=${cmd[0]}
mode=${cmd[1]}
freq=${cmd[2]}
channel=${cmd[3]}

if [ "$tuner" = "HamItUp" ]; then
    units=${freq:0-1}
    freq=${freq::-1}
    case $units in
        "k")    echo "mult k"; freq=$(( $freq*1000 ));;
        "m")    echo "mult m"; freq=$(( $freq*1000*1000 ));;
        "K")    echo "mult k"; freq=$(( $freq*1000 ));;
        "M")    echo "mult m"; freq=$(( $freq*1000*1000 ));;
        "*") freq=$freq;;
    esac
    freq=$(( freq + 125000000 ))
    tuner="RTL2838"
fi

case $mode in
    "AM")   in_params="-E offset -g 49 -M am -s 24k"
        out_params="-r 24k -t raw -e s -b 16 -c 1 -V1 -"
    ;;
    "FM")   in_params="-E offset -g 49 -M fm -s 24k"
        out_params="-r 24k -t raw -e s -b 16 -c 1 -V1 -"
    ;;
    "WBFM") in_params="-A fast -E offset -g 49 -l 0 -M fm -r 32k -s 170k"
        out_params="-r 32k -t raw -e s -b 16 -c 1 -V1 -"
    ;;
    "RDS")  in_params="-A fast -E offset -g 49 -l 0 -M fm -r 32k -s 171k"
        out_params="redsea -r 171k"
    ;;
    "*")    in_params="-E offset -g 49 -M fm -s 24k"
        out_params="-r 24k -t raw -e s -b 16 -c 1 -V1 -"
    ;;
esac

if [ "$mode" = "NRSC5" ]; then
    case $tuner in
        "RTL2838") nrsc5 $freq $channel
            ;;
        "*") exit
            ;;
    esac
else
    case $tuner in
        "RTL2838")
            if [ "$mode" = "AM" ]; then
                rtl_fm -f $freq -E offset -g 49 -M am -s 24k | play -r 24k -t raw -e s -b 16 -c 1 -V1 -
            fi
            if [ "$mode" = "FM" ]; then
                rtl_fm -f $freq -E offset -g 49 -M fm -s 24k | play -r 24k -t raw -e s -b 16 -c 1 -V1 -
            fi
            if [ "$mode" = "WBFM" ]; then
                rtl_fm -f $freq -E offset -g 49 -l 0 -M fm -r 32k -s 170k | play -r 32k -t raw -e s -b 16 -c 1 -V1 -
            fi
            if [ "$mode" = "RDS" ]; then
                rtl_fm -f $freq -E offset -g 49 -l 0 -M fm -r 32k -s 171k | redsea -r 171k
            fi
            ;;
        "HACKRF")
            if [ "$mode" = "AM" ]; then
                /opt/rx_tools/rx_fm -d driver=hackrf -f $freq -E offset -g 49 -M am -s 24k | play -r 24k -t raw -e s -b 16 -c 1 -V1 -
            fi
            if [ "$mode" = "FM" ]; then
                /opt/rx_tools/rx_fm -d driver=hackrf -f $freq -E offset -g 49 -M fm -s 24k | play -r 24k -t raw -e s -b 16 -c 1 -V1 -
            fi
            if [ "$mode" = "WBFM" ]; then
                /opt/rx_tools/rx_fm -d driver=hackrf -f $freq -E offset -g 49 -l 0 -M fm -r 32k -s 170k | play -r 32k -t raw -e s -b 16 -c 1 -V1 -
            fi
            ;;
        "*") exit
            ;;
    esac
fi

Desktop entry

Lastly create a desktop entry ~/.local/share/applications/desktop/SDR.desktop

[Desktop Entry]
Type=Application
Name=SDR
Comment=My SDR GUI
Exec=/home/jcm/.local/bin/sdr.sh 
Terminal=true
Icon=/home/jcm/.local/share/icons/sdr.png

Usage

The GUI is fairly straightforward. The frequency field is in Hertz and accepts standard prefixes. 162400000 is the same as 162.4M which is NOAA Weather Radio in certain cities.

Channel is for NRSC5, HD Radio here in North America. A frequency of 90.5M and channel 0 in Austin is KUT-HD. 90.5M and channel 1 is BBC World Service.


Home / Knowledge Base