-
-
Notifications
You must be signed in to change notification settings - Fork 130
KA9Q‐Radio Setup Notes
Last updated: 2025-02-21
ka9q-radio is a very high performance multi-channel SDR server and demodulator, written by Phil Karn, KA9Q. Use of ka9q-radio allows auto_rx to monitor the entire available bandwidth of a SDR, and decode all radiosonde signals detected within that bandwidth. It uses much less CPU than SpyServer, allowing a RPi4 to monitor the entire available bandwidth (8 MHz) of an Airspy R2!
Note: The ka9q-radio repository is changing rapidly, and updates may break compatibility with auto_rx. The latest known-working ka9q-radio commits are:
- For use with auto_rx master/main branch: 4025a34db6e88dce87b8f67c7eb9cc339b920261
- For use with auto_rx testing branch: 4025a34db6e88dce87b8f67c7eb9cc339b920261
Please ensure you follow the setup instructions below carefully to obtain the correct commit.
Note: These instructions assume you already have some familiarity with configuring radiosonde_auto_rx. We recommend you start off with a basic single-RTLSDR setup as per the regular guide before trying this.
Big thanks to the following people for making this possible:
- Phil Karn KA9Q for developing this marvellous software, enabling a high performance, open source networked SDR server.
- Andrew Koenig and Clayton Smith for adding spectrum support, doing lots of small fixes, and helping test everything!
At this stage, we're assuming you've probably already got an auto_rx station, and are looking to upgrade to a more capable receive system. If not, go check out the main guide for information on antennas, filtering, etc...
Known-working platforms include:
- Raspberry Pi 4 (use Raspbian 64-bit)
- Raspberry Pi 5 (use Raspbian 64-bit)
- Zimaboard 432 (Intel Celeron N3450)
- Most likely any old Intel machine (multi-core Celeron, i3, i5) you have lying around will handle this.
We currently only support connecting to a single ka9q-radio server, so you need to be able to cover your entire frequency range of interest with a single SDR.
- Airspy R2 / Airspy Mini - Both the Airspy R2 and Mini can cover the entire radiosonde band, when run at their maximum sample rate (20 MHz real sampling - yes, the Mini can do this too!). However, some notes:
- KA9Q-Radio uses the real-valued samples from the Airspy receivers, which are normally converted to IQ by the Airspy drivers. So, 20 MHz sample rate means ~8 MHz usable bandwidth, 12 MHz sample rate means ~5 MHz usable bandwidth.
- While the Airspy Mini can run at 20 MHz sample rate, it has more spurs than the R2 due to its cheaper build. Depending on your situation, this may or may not impact you. See here for some comparisons
There is also now support for the SDRPlay RSP1A. This will cover the entire 400-406 MHz band with one SDR.
We do not support using RTLSDRs with ka9q-radio.
For this section, we assume you've already got a Raspbian or Debian-based system ready to go.
These instructions are based on: https://github.com/ka9q/ka9q-radio/blob/main/docs/INSTALL.md
Install package dependencies using:
sudo apt install avahi-utils build-essential make gcc libairspy-dev libairspyhf-dev libavahi-client-dev libbsd-dev libfftw3-dev libhackrf-dev libiniparser-dev libncurses5-dev libopus-dev librtlsdr-dev libusb-1.0-0-dev libusb-dev portaudio19-dev libasound2-dev libogg-dev uuid-dev rsync time git libsamplerate-dev
Clone the ka9q-radio repository, and checkout the latest known-working commit:
git clone https://github.com/ka9q/ka9q-radio.git
cd ka9q-radio
git checkout 4025a34db6e88dce87b8f67c7eb9cc339b920261
make -f Makefile.linux
sudo make -f Makefile.linux install
If you already have ka9q-radio installed and need to update to the most recent working commit, you can do so by running:
cd ka9q-radio
git checkout main
git pull
git checkout 4025a34db6e88dce87b8f67c7eb9cc339b920261
make -f Makefile.linux clean
make -f Makefile.linux
sudo make -f Makefile.linux install
If you hit errors when building, you may be missing new package dependencies. Look further up in this guide for the apt install
command and re-run this to ensure you have everything needed.
Add your user to the radio
group. This allows you to edit the contents of /etc/radio (where the ka9q-radio configuration files will live) without root.
sudo usermod -aG radio $(whoami)
FFTW Wisdom file generation (Reference: ka9q-radio/docs/FFTW3.md)
This needs to be run to ensure the FFT calculations used in ka9q-radio are run as optimally as possible.
This can take many hours to run, so set the fftwf-wisdom command going and come back in a few hours. Best to run this overnight.
cd /etc/fftw/
# For Airspy R2 (or Airspy Mini running at 20 MHz sample rate), run:
time sudo fftwf-wisdom -v -T 1 -o nwisdom rof500000 cob2400 cob1250 cob1202 cob1200
# For Airspy Mini running at 12 MHz sample rate, run:
time sudo fftwf-wisdom -v -T 1 -o nwisdom rof300000 cob2400 cob1250 cob1202 cob1200
# For SDRPlay (@ 10MS/s), run:
time sudo fftwf-wisdom -v -T 1 -o nwisdom cof250000 cob2400 cob1250 cob1202 cob1200
# Then, run:
ls -l nwisdom wisdomf
# If wisdomf doesn't exists, then just copy nwisdom to it. If wisdomf exists, check that nwisdom is larger than it before copying over it.
cp -i nwisdom wisdomf
Refer the sections below for configuration settings for a range of known-working setups.
Create a file at the path specified (e.g. /etc/radio/radiod@airspy-autorx.conf ) and add in the content below.
An Airspy R2 can provide approximately 8 MHz of usable receive bandwidth, and with KA9Q is operated in 'real' mode at 20 MHz.
We need to set the frequency in the ka9q-radio configuration to at least 600 kHz above the highest frequency of interest. E.g. to observe 400-406 MHz, set the frequency to 407 MHz.
Refer to the ka9q-radio documentation for details on Airspy-specific configuration options.
ka9q-radio - /etc/radio/radiod@airspy-autorx.conf
[global]
hardware = airspy
mode = fm
status = sonde.local
iface = lo
ttl = 0
data = sonde-pcm.local
[airspy]
device = airspy
description = "auto_rx"
# The airspy frequency must be set at least 600 kHz above the highest frequency we wish to observe.
# Since the Airspy R2 can easily cover 8 MHz, we can just set this to 407 MHz to cover the 400-406 MHz
# radiosonde band.
frequency = 407m0
#
# If required, you can enable a bias-tee output to power a preamplifier.
#bias = true
#
# By default, KA9Q-Radio will use its own AGC to optimize the SDRs gain settings. If you want to set a
# fixed gain setting, you can do so by uncommenting the line below, and setting a gain value between 0 and 21,
# which corresponds to the Airspy's 'linearity' gain settings.
#gainstep = 17
#
# You can also specify a calibration factor for your SDR, specified as a fractional value.
#calibrate = -1e-6
[telemetry]
freq = "401m50"
[manual-400]
freq = 0
ttl = 0
Enable using:
sudo systemctl enable radiod@airspy-autorx
sudo systemctl start radiod@airspy-autorx
An Airspy Mini can provide approximately 5 MHz of usable receive bandwidth, and with KA9Q is operated in 'real' mode at 12 MHz by default.
As with the Airspy R2, we need to set the frequency in the ka9q-radio configuration to ~600 kHz above the highest frequency of interest. E.g. to observe 400-405 MHz, set the frequency to 405.6 MHz.
You can also run the Airspy Mini at 20 MHz real sample rate, giving it the same coverage as an Airspy R2 (8 MHz), with some performance caveats, by uncommenting the samprate = 20000000
line in the config below.
Refer to the ka9q-radio documentation for details on Airspy-specific configuration options.
ka9q-radio - /etc/radio/radiod@airspymini-autorx.conf
[global]
hardware = airspy
mode = fm
status = sonde.local
iface = lo
ttl = 0
data = sonde-pcm.local
[airspy]
device = airspy
description = "auto_rx"
# The airspy frequency must be set at least 600 kHz above the highest frequency we wish to observe.
# As the Airspy Mini can only observe ~5 MHz of spectrum at once, we can set this to either
# 405.6 MHz (405m6, to cover 400-405 MHz) or 406.6 MHz (406m6, to cover 401-406 MHz) depending on where sondes are prevalent in your local area.
frequency = 405m6
#
# If required, you can enable a bias-tee output to power a preamplifier.
#bias = true
#
# By default, KA9Q-Radio will use its own AGC to optimize the SDRs gain settings. If you want to set a
# fixed gain setting, you can do so by uncommenting the line below, and setting a gain value between 0 and 21,
# which corresponds to the Airspy's 'linearity' gain settings.
#gainstep = 17
#
# You can also specify a calibration factor for your SDR, specified as a fractional value.
#calibrate = -1e-6
#
# Uncomment this to run your Airspy Mini at 20 MHz sample rate (same at the Airspy R2)
# Note that the Mini has more spurs when operating at this rate.
#samprate = 20000000
[telemetry]
freq = "401m50"
[manual-400]
freq = 0
ttl = 0
Enable using:
sudo systemctl enable radiod@airspymini-autorx
sudo systemctl start radiod@airspymini-autorx
The SDRPlay RSP1-series radios can provide approximately 8MHz of usable bandwidth when configured for 10MS/s. It is recommended to use a preamplifier with the RSP1 series radios to provide the best noise figure.
ka9q-radio requires the SDRPlay API (tested on v3.15.2) to be used with the SDRPlay radios. This must be installed before building ka9q-radio.
NOTE: Due to the closed-source nature of the SDRPlay API, support from the ka9q-radio and auto_rx developers is minimal. The settings listed below are known to work with ka9q-radio commit 37bc78643100d7dcb6d33a03274584e067ef9e7b
.
ka9q-radio - /etc/radio/radiod@sdrplay-autorx.conf
[global]
status = sonde.local
hardware = sdrplay
mode = iq
#iface = lo
ttl = 0
verbose = 1
fft-threads = 4
data = sonde-pcm.local
[sdrplay]
device = sdrplay
description = RSP1B
samprate = 10000000
# LNA Gain reduction
# See SDRplay API docs or ka9q-radio sdrplay.c for LNA attenuator values
rf-gr = 0
# Min value 20, gain lowers as value increases
# Use this OR if-agc
#if-att = 20
# Set this to 1 to enable IF AGC (preferred)
# Use this OR if-att
if-agc = 1
if-agc-rate = 0
if-agc-setpoint-dbfs = -20
if-agc-attack-ms = 10
if-agc-decay-ms = 500
if-agc-decay-delay-ms = 200
if-agc-decay-threshold-db = 5
# Frequency in Hz
# 402.44MHz chosen to place intermod product from 28.8MHz USB clock above 406MHz
frequency = 402440000
Enable using:
sudo systemctl enable radiod@sdrplay-autorx
sudo systemctl start radiod@sdrplay-autorx
It should be possible to check ka9q-radio is running using:
control sonde.local
It'll probably ask you for a SSRC (channel ID). (Is this the best way? It would be good to just see some IF stats?)
ka9q-radio may also suggest that you run certain optimizations for the FFT library depending on sample rates that are unique to your configuration. Check the logs using journalctl and follow any fftw
instructions mentioned.
journalctl -f -n 100 -u radiod@{your instance}
radiosonde_auto_rx can be setup as per the usual setup guides, either using 'native' or 'docker' approaches. Note that when running via docker some additional arguments must be used when starting up the container (see further below)
radiosonde_auto_rx's station.cfg file must be configured to communicate with the KA9Q-radio server - see below for a list of parameters to modify. Find these within your station.cfg file and update accordingly.
[sdr]
sdr_type = KA9Q
# Note - More than 10 channels should be quite achievable, but is pretty unlikely to be required in practice.
sdr_quantity = 10
sdr_hostname = sonde.local
# Note - port is unused for ka9q-radio.
sdr_port = 5555
[search_params]
# NOTE: These frequencies must not exceed the available range of the KA9Q server's SDR, otherwise odd behaviour may occur.
# For an Airspy R2, we can cover the entire radiosonde band, so using a min of 400.05 and a max of 406.0 is fine.
# For an Airspy Mini running at 12 MHz, you will need to adjust these values to fit within the available range you have configured in ka9q-radio
# e.g. 400.05 to 405.0 MHz
min_freq = 400.05
max_freq = 406.0
Note that if you are using docker, some lines (the dbus and ahavi lines) need to be added to the docker start command:
docker run \
-d \
--name radiosonde_auto_rx \
--restart="always" \
--device=/dev/bus/usb \
--network=host \
-v ~/radiosonde_auto_rx/station.cfg:/opt/auto_rx/station.cfg:ro \
-v ~/radiosonde_auto_rx/log/:/opt/auto_rx/log/ \
-v /var/run/dbus:/var/run/dbus \
-v /var/run/avahi-daemon/socket:/var/run/avahi-daemon/socket \
ghcr.io/projecthorus/radiosonde_auto_rx:latest
Warning - we have had reports that this startup approach doesn't work on Debian 12, with connections to ka9q-server timing out. It has been confirmed to work under Ubuntu 22.04 and Raspbian bookworm. User on Debian 12 will likely need to run a 'native' install of auto_rx.