Skip to content

Instantly share code, notes, and snippets.

@darksidelemm
Last active December 20, 2022 09:45
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save darksidelemm/5b514b3beeb767be94429e5c020525ec to your computer and use it in GitHub Desktop.
Save darksidelemm/5b514b3beeb767be94429e5c020525ec to your computer and use it in GitHub Desktop.
#!/bin/bash
# STRF Capture Script
# Mark Jessop <vk5qi@rfhead.net>
#
# 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:
# ./rtl_capture.sh <frequency_in_hz> <time>
# e.g.:
# ./rtl_capture.sh 437e6 10m
#
# FFT data will be stored to ./data/
#
# Settings
FREQ=$1
RATE=2048e3
# Set gain as appropriate. For no preamp, probably ~40 is better.
# With preamp, around 30 is usually right.
GAIN=32.8
# Uncomment to enable bias-tee (this will require that the rtl-sdr be installed from https://github.com/rtlsdrblog/rtl-sdr)
#BIAS=1
# Change as appropriate
WORKINGDIR=/home/pi/satobs
FIFO=$WORKINGDIR/fifo
DURATION=$2
# Cron starts this script elsewhere... CD to the right directory.
cd $WORKINGDIR
if [ "$BIAS" = "1" ]; then
echo "Enabling Bias Tee"
rtl_biast -b 1
fi
# Start channelizer
nice -20 ./rffft -i $FIFO -p $WORKINGDIR/data -f $FREQ -s $RATE -q -c 50 -F char &
# Start rx_samples_to_file
nice -20 rtl_sdr -g $GAIN -f $FREQ $FIFO &
RTL_PID=$!
# Sleep for the time specified
sleep $2
# Kill the rtl_sdr capture
kill $RTL_PID
if [ "$BIAS" = "1" ]; then
echo "Disabling Bias Tee"
rtl_biast -b 0
fi
@zanco
Copy link

zanco commented Dec 20, 2022

Hi, can I suggest to add $3 as gain to be able to set the gain without editing the script file ? Works for me :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment