Tutorial: OpenWebRX setup using a rtlsdr dongle and a raspberrypi - adrians/meta-amateurradio GitHub Wiki

OpenWebRX setup

Intro

This tutorial shows the steps to set up a web-based SDR station using Yocto, a rtlsdr dongle and a RaspberryPi version 4 board.

Important note

This setup should not be connected straight to the internet, as it is unsecure:

  • OpenWebRX is an abandoned project, no patches or improvements are expected.
  • Python2 is an abandoned project.
  • The image starts with an SSH server, but without a root password. Should be used only in secure networks (local networks or over VPN connections).
  • The tutorial uses the root account to run the server - this is a bad idea.
  • Use at your own risk.

Building the image

  • We'll use yocto and kas to build the image. Save the following text into a file called sdr.yml.
header:
  version: 11

machine: raspberrypi4-64
distro: poky
target: core-image-minimal

repos:
  poky:
    url: https://git.yoctoproject.org/git/poky
    refspec: dunfell
    layers:
      meta:
      meta-poky:

  meta-openembedded:
    url: http://git.openembedded.org/meta-openembedded
    refspec: dunfell
    path: poky/meta-openembedded
    layers:
      meta-oe:
      meta-python:
      meta-networking:

  meta-raspberrypi:
    url: https://github.com/agherzan/meta-raspberrypi/
    path: poky/meta-raspberrypi
    refspec: dunfell

  meta-python2:
    url: https://git.openembedded.org/meta-python2
    path: poky/meta-python2
    refspec: dunfell

  meta-amateurradio:
    url: https://github.com/adrians/meta-amateurradio/
    path: poky/meta-amateurradio
    refspec: dunfell

local_conf_header:
  standard: |
    CONF_VERSION = "1"
    PACKAGE_CLASSES = "package_rpm"
    SDKMACHINE = "x86_64"
    USER_CLASSES = "buildstats image-mklibs image-prelink"
    PATCHRESOLVE = "noop"

  debug-tweaks: |
    IMAGE_INSTALL_append = " rtlsdr csdr python netcat"
    EXTRA_IMAGE_FEATURES = "debug-tweaks ssh-server-dropbear package-management"

  diskmon: |
    BB_DISKMON_DIRS = "\
        STOPTASKS,${TMPDIR},1G,100K \
        STOPTASKS,${DL_DIR},1G,100K \
        STOPTASKS,${SSTATE_DIR},1G,100K \
        STOPTASKS,/tmp,100M,100K \
        ABORT,${TMPDIR},100M,1K \
        ABORT,${DL_DIR},100M,1K \
        ABORT,${SSTATE_DIR},100M,1K \
        ABORT,/tmp,10M,1K"
  • Build the image using kas. This step can take a few hours.
kas build sdr.yml
  • Copy the image to an sdcard:
sudo bmaptool copy build/tmp/deploy/images/raspberrypi4-64/core-image-minimal-raspberrypi4-64.wic.bz2 /dev/sdg

Configuring the board

  • Boot the RaspberryPi, download OpenWebRX and start it. To log onto the board, use the root username with no password.
wget https://github.com/ha7ilm/openwebrx/archive/refs/heads/master.zip
unzip master.zip
cd openwebrx.py
./openwebrx.py
  • Check from another computer that the web-server started on port 8073.

  • Fine-tune the server - overwrite the following values in the config_webrx.py configuration file. The vi editor should be available in the image.

# Example to monitor the 2 meter band (144-146MHz)
samp_rate = 2000000     # Bandwidth of the monitored spectrum, in Hz. I found that 2MHz of bandwidth works reasonably well.
rf_gain = 0             # Automatic.
center_freq = 145000000 # Central frequency, in Hz.
  • If the rtlsdr dongle has also a shortwave/HF/direct-sampling antenna port, you can also monitor shortwave frequencies. To do this, the start_rtl_command will need to be updated to include the -D2 parameter.
# Example to monitor the 20 meter band (14MHz)
samp_rate = 2000000     # Bandwidth of the monitored spectrum, in Hz.
rf_gain = 0             # Automatic.
center_freq = 14000000  # Central frequency, in Hz.
start_rtl_command = "rtl_sdr -D2 -s {samp_rate} -f {center_freq} -p {ppm} -g {rf_gain} -".format(rf_gain=rf_gain, center_freq=center_freq, samp_rate=samp_rate, ppm=ppm)

Common issues

  • The frequencies are slightly offset. This can be compensated using the ppm variable, as each dongle might have its own deviations. Use kalibrate-rtl to find a specific dongle's error.

  • The rtlsdr dongle is not recognized. It might be because the regular DVB-T driver was loaded by the kernel. Check if the driver dvb_usb_rtl28xxu is shown by the lsmod command and, if it appears, unload it (using rmmod dvb_usb_rtl28xxu). You might even try blacklisting the package from the Yocto build (it's named kernel-module-dvb-usb-rtl28xxu).