Skip to content

Instantly share code, notes, and snippets.

@darksidelemm
Created May 14, 2020 13:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save darksidelemm/f36fbc752db06e36c5193502ab1b0f3f to your computer and use it in GitHub Desktop.
Save darksidelemm/f36fbc752db06e36c5193502ab1b0f3f to your computer and use it in GitHub Desktop.
#!/bin/bash
# STRF Cronjob Script
#
# Compile rffft from https://github.com/cbassa/strf
# Use: make rffft
# You should only need libfftw3-dev as a dependency.
#
# Prepare directory with:
# mkfifo fifo
# mkdir data
# Copy the rffft utility to this directory.
# Run with:
# ./airspy_capture_wideband.sh <frequency_in_hz> <time>
# e.g.:
# ./airspy_capture_wideband.sh 437e6 10m
#
# FFT data will be stored to ./data/
#
# WARNING: A RPi (even a RPi 4) cannot keep up with the 6 MSPS input
#
# Settings
FREQ=$1
FREQMHZ=$(python -c "print($FREQ/1e6)")
RATE=6000e3
GAIN=20
WORKINGDIR=/home/darkside/satobs
FIFO=$WORKINGDIR/fifo
DURATION=$2
# Cron starts this script elsewhere... CD to the right directory.
cd $WORKINGDIR
# Start channelizer
nice -20 ./rffft -i $FIFO -p $WORKINGDIR/data -f $FREQ -s $RATE -q -c 50 &
# Start rx_samples_to_file
# Note - The airspy sample rate is set using the -a argument.
# On the Mini, 0 = 6 MHz, 1 = 3 MHz, which is of course perfectly obvious.
nice -20 airspy_rx -a 0 -f $FREQMHZ -t 2 -g $GAIN -r fifo &
RTL_PID=$!
# Sleep for the time specified
sleep $2
# Kill the rtl_sdr capture
kill $RTL_PID
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment