Skip to content

Instantly share code, notes, and snippets.

@darksidelemm
Last active August 6, 2024 05:53
Show Gist options
  • Save darksidelemm/6b60767714295962771bca7b728b343c to your computer and use it in GitHub Desktop.
Save darksidelemm/6b60767714295962771bca7b728b343c to your computer and use it in GitHub Desktop.
#/usr/bin/env bash
#
# SpyServer HF APRS iGate Script
#
# Mark Jessop <vk5qi@rfhead.net> 2020-09
#
# This script enables operation of a HF APRS iGate using input from a SpyServer.
# This is targeted for a Raspbian install. These instructions will probably work on
# other debian-based systems too.
#
# # System-Level Dependencies:
#
# $ sudo apt-get install build-essential autoconf automake libtool pkg-config git libfftw3-dev libsamplerate0-dev direwolf screen
#
# Note: I am installing direwolf from the system package manager. You may want to compile it from source.
#
# # Compile/Install CSDR:
#
# $ git clone https://github.com/jketterl/csdr.git
# $ cd csdr
# $ autoreconf -i
# $ ./configure
# $ make
# $ sudo make install
#
# # Compile / Install spyserver_client:
#
# $ git clone https://github.com/miweber67/spyserver_client.git
# $ cd spyserver_client
# $ make
# $ sudo cp ss_client /usr/bin/ss_iq
#
# Note that the spyserver_client makefile has no install target, hence the manual copy.
#
# # Download a template direwolf configuration file:
#
# $ wget https://gist.githubusercontent.com/darksidelemm/9a1aa7ce0bea8ebde813cbac8f757dc1/raw/868ec848aa00525ad4ee65e4468bbc5b7e179d93/hfaprs.conf
#
# Open this file and edit it appropriately, replacing callsigns, APRS-IS settings and your location for beaconing.
#
# # Configuration of this Script
#
# Presumably you have downloaded this script somewhere. You will need to make it executable:
#
# $ chmod +x ./spyserver_hf_aprs.sh
#
# Modify the settings below to match your target frequency, your spyserver settings, and the path to your hfaprs.conf file.
#
# You can now run this script with:
#
# ./spyserver_hf_aprs.sh
#
# # Starting Automatically
# One option is to start up this script in a screen session on boot.
# This can be performed by adding the following line to /etc/rc.local
#
# su - YOURUSERNAME -c "screen -dm -S hfaprs /home/YOURUSERNAME/spyserver_hf_aprs.sh"
#
# You can then access the screen session as your own user by running:
# $ screen -r hfaprs
#
# TODO: systemd service, for auto restart.
# USB Frequency, in Hz
# Within Australia, the following frequencies are in use:
# 30m = 10147600
# 40m = 7045200
FREQ=10147600
# SpyServer Details
HOST=localhost
PORT=5555
# Direwolf Configuration File Path
DCONFIG=$HOME/hfaprs.conf
# SpyServer Connection, requesting 12 kHz of IQ bandwidth, and using lots of buffering.
ss_iq -a 1200 -r $HOST -q $PORT -f $FREQ -s 12000 -b 16 - | \
# Convert the incoming signed 16-bit IQ to floating point
csdr convert_s16_f |\
# SSB demodulation using a tight bandpass filter (0-3600 Hz), and then taking the real part.
# (I could probably make this a bit narrower) Also add on some AGC and limiting.
csdr bandpass_fir_fft_cc 0 0.3 0.05 | csdr realpart_cf | csdr agc_ff | csdr limit_ff | \
# Convert back into signed 16-bit format and pass into direwolf.
# I suspect many of the direwolf command-line options are not necessary due to the config file.
csdr convert_f_s16 | direwolf -n 1 -r 12000 -D 1 -t 0 -a 300 -c $DCONFIG -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment