Last active
December 20, 2022 09:45
-
-
Save darksidelemm/5b514b3beeb767be94429e5c020525ec to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# STRF Capture Script | |
# Mark Jessop <[email protected]> | |
# | |
# 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, can I suggest to add $3 as gain to be able to set the gain without editing the script file ? Works for me :-)