Compare commits

..

No commits in common. '624add1aa8085b4695f62b8c9a7124d8666d55ea' and '7c70d34d1dde94253f27e5a958b4e4a0c8cd109f' have entirely different histories.

@ -95,10 +95,9 @@ function check_restart {
echo "$value" > /dev/null
set -- $value
# if [ "$1" = "p" ] || [ "$1" = "P" ] ; then
# reboot=1
#el
if [ "$1" == "f" ] || [ "$1" == "b" ] || [ "$1" == "e" ] || [ "$1" == "j" ] ; then
if [ "$1" = "p" ] || [ "$1" = "P" ] ; then
reboot=1
elif [ "$1" == "f" ] || [ "$1" == "b" ] || [ "$1" == "e" ] || [ "$1" == "j" ] ; then
FILE=/home/pi/CubeSatSim/battery_saver
if [ -f "$FILE" ]; then
restart=1
@ -356,12 +355,13 @@ if [ "$1" = "" ]; then
txc=0
fi
if [[ $(lsusb | grep "RTL") ]] ; then
timeout 1 rtl_test &> out.txt
if [[ $(grep "No supported" out.txt) ]] ; then
# echo "No RTL-SDR detected"
rtl=0
else
echo "RTL-SDR detected"
rtl=1
else
echo "No RTL-SDR detected"
rtl=0
fi
echo
@ -1423,7 +1423,7 @@ elif [ "$1" = "-g" ]; then
if [ "$rset" = "y" ] || [ "$rset" = "yes" ] ; then
echo "Resetting"
echo "Resetting and shutting down."
echo "AMSAT 0 0 0 no 3 434.9 435 no 0 0" > /home/pi/CubeSatSim/sim.cfg
@ -1441,8 +1441,6 @@ elif [ "$1" = "-g" ]; then
sudo rm /home/pi/CubeSatSim/failure_mode.txt > /dev/null 2>&1
sudo rm /home/pi/CubeSatSim/transmit_dtmf > /dev/null 2>&1
sudo systemctl stop cubesatsim
sudo systemctl stop transmit
sudo systemctl stop command
@ -1452,25 +1450,11 @@ elif [ "$1" = "-g" ]; then
sudo journalctl --rotate
sudo journalctl --vacuum-time=1s
rm -rf ~/.config/chromium/Singleton* > /dev/null 2>&1
rm -rf ~/.config/chromium/Singleton*
cat /dev/null > ~/.bash_history && history -c
sudo systemctl stop pacsatsim &>/dev/null
sudo rm -r /home/pi/PacSat > /dev/null 2>&1
sudo rm -r /home/pi/PacSatGround > /dev/null 2>&1
sudo rm -r /home/pi/PacSatGroundLoop > /dev/null 2>&1
if [ "$noreboot" = "0" ] ; then
echo "Shutting down."
sudo shutdown now
else
echo
echo "Shutdown or reboot to complete the operation."
echo
fi
sudo shutdown now
# reboot=1
else
@ -1827,24 +1811,16 @@ elif [ "$1" = "-G" ]; then
reboot=1
sudo echo "p" > /home/pi/CubeSatSim/.mode
value=`cat /home/pi/CubeSatSim/sim.cfg`
echo "$value" > /dev/null
set -- $value
if [ "${7}" != "434.9" ] && [ "${7}" != "434.900" ] ; then
echo "The default transmit frequency of 434.9 MHz is NOT set."
echo
echo "To change the transmit frequency (for example to 434.9 MHz) use the CubeSatSim/config -F command."
sleep 5
# read input
# echo
#
# if [ "$input" = "y" ] || [ "$input" = "yes" ] ; then
# /home/pi/CubeSatSim/config -F n
# fi
fi
# if [ "$1" == "f" ] || [ "$1" == "b" ] || [ "$1" == "e" ] ; then
# FILE=/home/pi/CubeSatSim/battery_saver
# if [ -f "$FILE" ]; then
# restart=1
# else
# reboot=1
# fi
# else
# restart=1
# fi
elif [ "$1" = "-I" ]; then
@ -1857,26 +1833,18 @@ elif [ "$1" = "-I" ]; then
# echo "changing CubeSatSim to Pacsat mode"
# reboot=1
check_restart
reboot=1
sudo echo "P" > /home/pi/CubeSatSim/.mode
value=`cat /home/pi/CubeSatSim/sim.cfg`
echo "$value" > /dev/null
set -- $value
if [ "${7}" = "434.9" ] && [ "${8}" = "435" ]; then
echo "The default transmit frequency of 434.9 MHz is set"
echo
echo "To change it (for example to 435 MHz) use the CubeSatSim/config -F command."
# read input
# echo
#
# if [ "$input" = "y" ] || [ "$input" = "yes" ] ; then
# /home/pi/CubeSatSim/config -F n
# fi
fi
# if [ "$1" == "f" ] || [ "$1" == "b" ] || [ "$1" == "e" ] ; then
# FILE=/home/pi/CubeSatSim/battery_saver
# if [ -f "$FILE" ]; then
# restart=1
# else
# reboot=1
# fi
# else
# restart=1
# fi
elif [ "$1" = "-k" ]; then
@ -1885,8 +1853,7 @@ elif [ "$1" = "-k" ]; then
echo
sudo systemctl stop pacsatsim &>/dev/null
sudo rm -r /home/pi/PacSat
# reboot=1
sudo systemctl restart pacsatsim
reboot=1
elif [ "$1" = "-h" ]; then

@ -9,8 +9,6 @@ sudo systemctl stop rtl_tcp
pkill -o chromium &>/dev/null
pkill -o firefox &>/dev/null
sudo killall -9 rtl_fm &>/dev/null
sudo killall -9 direwolf &>/dev/null

@ -9,8 +9,6 @@ sudo systemctl stop rtl_tcp &>/dev/null
pkill -o chromium &>/dev/null
pkill -o firefox &>/dev/null
sudo killall -9 sdrpp &>/dev/null
sudo killall -9 rtl_fm &>/dev/null

@ -1,93 +0,0 @@
from rtlsdr import RtlSdr
import numpy as np
import matplotlib.pyplot as plt
import sys
if __name__ == "__main__":
graph = 'n'
center_frequency = 434.7e6
if (len(sys.argv)) > 0:
# print("There are arguments!")
center_frequency = float(sys.argv[1]) - 200e3
if (center_frequency == 0):
center_frequency = 434.7e6
if (len(sys.argv)) > 1:
# print("There are more arguments")
if (sys.argv[2] == 'g') or (sys.argv[2] == '-g'):
graph = 'y'
sampling_rate = 1024e3 # 250e3 # Hz
duration = 65536/sampling_rate # 1 # seconds
try:
sdr = RtlSdr()
# configure device
sdr.sample_rate = sampling_rate # 250e3 # 2.4e6
#center_frequency = 434.8e6
sdr.center_freq = center_frequency
sdr.gain = 47
sdr.direct_sampling = False
# signal = sdr.read_samples(64*1024) #256
signal = sdr.read_samples(duration*sampling_rate).real #256
# print(f"Center frequency is {center_frequency}")
sdr.close()
# Compute the FFT
fft_result = np.fft.fft(signal)
# Calculate the frequencies corresponding to the FFT output
n = len(signal)
frequencies = np.fft.fftfreq(n, d=1/sampling_rate)
# Take the absolute value for amplitude spectrum and consider only the positive frequencies
positive_frequencies_indices = np.where(frequencies >= 0)
positive_frequencies = frequencies[positive_frequencies_indices]
amplitude_spectrum = 2/n * np.abs(fft_result[positive_frequencies_indices]) # Normalize for amplitude
if (graph == 'y'):
# Plotting the results
t = np.linspace(0, duration, int(sampling_rate * duration), endpoint=False)
plt.figure(figsize=(12, 6))
plt.subplot(1, 2, 1)
plt.plot(t, signal)
plt.title('Time Domain Signal')
plt.xlabel('Time (s)')
plt.ylabel('Amplitude')
plt.subplot(1, 2, 2)
plt.stem(positive_frequencies, amplitude_spectrum, markerfmt=" ", basefmt="-b")
plt.title('Frequency Domain (FFT)')
plt.xlabel('Frequency (Hz)')
plt.ylabel('Amplitude')
plt.grid(True)
plt.tight_layout()
plt.show()
# print(amplitude_spectrum)
x = amplitude_spectrum
# print(x)
min_value = min(x)
max_value = max(x) * 100
#freq_min = np.argmax(min_value)
# print(np.argmax(x))
# print(np.argmax(x)*(150e3 - 10e3)/(9770 - 709))
# print(sampling_rate)
# print(center_frequency)
offset = (np.argmax(x)*(150e3 - 10e3)/(9770 - 709))
freq_max = center_frequency + offset + 2000
except: # if no RTL-SDR or in use, stop scanning with high max value and center frequency
max_value = 100
freq_max = center_frequency + 200e3 # should be 434900000
print(f" {freq_max:.0f} {max_value:.0f}")

@ -1,5 +1,5 @@
[Desktop Entry]
Type=Application
Name=Browser with WebSDR
Exec=x-www-browser http://localhost:8073/
Name=Chromium with WebSDR
Exec=chromium-browser --check-for-update-interval=1 --simulate-critical-update --noerrdialogs --disable-infobars --app=http://localhost:8073

@ -1,4 +1,4 @@
[Desktop Entry]
Type=Application
Name=Chromium with WebSDR
Exec=x-www-browser http://127.0.0.1:8073
Exec=chromium-browser --check-for-update-interval=1 --simulate-critical-update --noerrdialogs --disable-infobars http://127.0.0.1:8073

@ -1,41 +0,0 @@
#!/bin/bash
# script to send APRS or DTMR commands to a CubeSatSim
value=`cat /home/pi/CubeSatSim/.mode`
echo "$value" > /dev/null
set -- $value
if [ "$1" != "n" ]; then
echo "You are not in Transmit Commands mode"
sleep 10
exit
fi
sudo killall -9 zenity &>/dev/null
echo
autotune=0
mode=$(zenity --timeout=20 --list 2>/dev/null --width=300 --height=360 --title="Transmit Command" --text="Choose the command to transmit" --column="Mode" --column="Result" a "APRS Mode" f "FSK Mode" b "BPSK Mode" s "SSTV Mode" m "CM Mode" e "Repeater Mode" j "FUNcube Mode" o "Beacon On/Off")
# echo $mode
if [ -z "$mode" ]; then
echo "No choice made."
sleep 10
exit
fi
/home/pi/CubeSatSim/config -$mode
sleep 10

@ -8,8 +8,6 @@ sudo systemctl stop rtl_tcp
pkill -o chromium &>/dev/null
pkill -o firefox &>/dev/null
sudo killall -9 rtl_fm &>/dev/null
sudo killall -9 direwolf &>/dev/null

@ -17,8 +17,6 @@ sudo systemctl stop rtl_tcp &>/dev/null
pkill -o chromium &>/dev/null
pkill -o firefox &>/dev/null
sudo killall -9 sdrpp &>/dev/null
sudo killall -9 rtl_fm &>/dev/null

@ -5,7 +5,7 @@ echo "Script to run FUNcube CubeSatSim Telemetry"
echo
echo "The browser will load in a few seconds with fctelem."
echo "The Chromium browser will load in a few seconds with fctelem."
echo "You can also use another web browser if you are on the same network as your Pi."
@ -34,8 +34,6 @@ sudo killall -9 python3 &>/dev/null
#pkill -o chromium &>/dev/null
#pkill -o firefox &>/dev/null
#sudo killall -9 rtl_tcp &>/dev/null
#sudo killall -9 CubicSDR &>/dev/null
@ -82,9 +80,8 @@ else
echo
fi
autotune=0
frequency=$(zenity --timeout=10 --list 2>/dev/null --width=410 --height=220 --title="FUNcube Telem Decoding" --text="Choose the frequency for FUNcube decoding:" --column="kHz" --column="Use" 434900 "CubeSatSim" Auto-tune "CubeSatSim Auto-tune" Other "Choose another frequency")
frequency=$(zenity --timeout=10 --list 2>/dev/null --width=410 --height=180 --title="FUNcube Telem Decoding" --text="Choose the frequency for FUNcube decoding:" --column="kHz" --column="Use" 434900 "CubeSatSim" Other "Choose another frequency")
echo $frequency
@ -99,11 +96,6 @@ if [ "$frequency" = "434900" ]; then
frequency=434900000
elif [ "$frequency" = "Auto-tune" ]; then
frequency=434900000
autotune=1
elif [ "$frequency" = "Other" ]; then
echo
@ -118,39 +110,6 @@ elif [ "$frequency" = "Other" ]; then
fi
if [ "$autotune" = "1" ]; then
threshold=1
delay=5
retries=5
echo "Starting Auto-tune scanning"
echo "Scan will stop when confidence exceeds threshold value of" $threshold "or after" $retries "retries"
tries=0
confidence=0
delay=$((delay-2)) # subtract 2 second built in delay
while [ $tries -le $retries ] && [ "$confidence" -le "$threshold" ]; do
sleep $delay
source /home/pi/venv/bin/activate
python3 /home/pi/CubeSatSim/groundstation/auto-tune.py 434900000 n 2> null > /home/pi/CubeSatSim/groundstation/auto-tune.txt
# echo "auto-tune.txt"
# cat /home/pi/CubeSatSim/groundstation/auto-tune.txt
confidence=$(awk '{print $2}' /home/pi/CubeSatSim/groundstation/auto-tune.txt)
echo "Auto tune confidence:" $confidence
tries=$((tries+1))
done
if [ "$confidence" -gt "$threshold" ]; then
frequency=$(awk '{print $1}' /home/pi/CubeSatSim/groundstation/auto-tune.txt)
echo "Auto tune frequency:" $frequency
else
echo "Auto tune failed, frequency unchanged"
fi
sleep 5
fi
echo "Frequency is" $frequency
echo
echo "If your CubeSatSim is transmitting in FUNcube mode (mode 7) you should get some frames after 30 seconds"
@ -176,8 +135,7 @@ cp /home/pi/CubeSatSim/sstv/sstv_image_1_320_x_256.jpg ./image_file.jpeg
python3 -m http.server 8002 &
#setsid chromium-browser --check-for-update-interval=1 --simulate-critical-update --noerrdialogs --disable-infobars http://127.0.0.1:8002 &>/dev/null &
setsid x-www-browser http://127.0.0.1:8002/
setsid chromium-browser --check-for-update-interval=1 --simulate-critical-update --noerrdialogs --disable-infobars http://127.0.0.1:8002 &>/dev/null &
cd /home/pi/fctelem

@ -5,12 +5,6 @@ echo "Startup script to run FoxTelem for FIAB v4"
echo
value=`cat /home/pi/CubeSatSim/.mode`
echo "$value" > /dev/null
set -- $value
echo $1
if [ "$1" != "P" ] ; then
sudo killall -9 FoxTelem &>/dev/null
FILE=/home/pi/FoxTelemetryData/.foxprofile
@ -42,10 +36,4 @@ sleep 10
fi
else
echo "Don't run FoxTelem since PacSat Ground Station mode is set"
# /home/pi/CubeSatSim/groundstation/pacsat-run.sh
fi
#$SHELL

@ -11,8 +11,6 @@ sudo systemctl stop rtl_tcp &>/dev/null
pkill -o chromium &>/dev/null
pkill -o firefox &>/dev/null
sudo killall -9 sdrpp &>/dev/null
sudo killall -9 rtl_tcp &>/dev/null

@ -12,8 +12,6 @@ sudo systemctl stop rtl_tcp
pkill -o chromium &>/dev/null
pkill -o firefox &>/dev/null
sudo killall -9 rtl_fm &>/dev/null
sudo killall -9 sdrpp &>/dev/null
@ -41,9 +39,7 @@ sudo /etc/init.d/alsa-utils start
echo
autotune=0
frequency=$(zenity --timeout=10 --list 2>/dev/null --width=410 --height=400 --title="Packet Decoding with Direwolf" --text="Choose the frequency for packet decoding" --column="kHz" --column="Application" 144390 "APRS US 2m" 434900 "CubeSatSim" Auto-tune "CubeSatSim Auto-tune" 144800 "APRS European 2m" 145175 "APRS Australian 2m" Other "Choose another frequency" 145825 "APRS on ISS" APRS "Test APRS decoding with CubeSatSim WAV file")
frequency=$(zenity --timeout=10 --list 2>/dev/null --width=410 --height=360 --title="Packet Decoding with Direwolf" --text="Choose the frequency for packet decoding" --column="kHz" --column="Application" 144390 "APRS US 2m" 434900 "CubeSatSim" 144800 "APRS European 2m" 145175 "APRS Australian 2m" Other "Choose another frequency" 145825 "APRS on ISS" APRS "Test APRS decoding with CubeSatSim WAV file")
#echo $frequency
@ -81,11 +77,6 @@ elif [ "$choice" = "2" ] || [ "$frequency" = "434900" ] ; then
echo "If your CubeSatSim is transmitting in APRS mode (mode 1) then you should see packets."
echo
elif [ "$frequency" = "Auto-tune" ] ; then
frequency=434900000
autotune=1
elif [ "$choice" = "3" ] || [ "$frequency" = "144800" ]; then
frequency=144800000
@ -166,41 +157,7 @@ echo
#fi
#sleep 5
if [ "$autotune" = "1" ]; then
threshold=1
delay=1
retries=30
echo "Starting Auto-tune scanning"
echo "Scan will stop when confidence exceeds threshold value of " $threshold " or after " $retries " retries"
tries=0
confidence=0
while [ $tries -le $retries ] && [ "$confidence" -le "$threshold" ]; do
# sleep $delay
source /home/pi/venv/bin/activate
python3 /home/pi/CubeSatSim/groundstation/auto-tune.py 434900000 n 2> null > /home/pi/CubeSatSim/groundstation/auto-tune.txt
# echo "auto-tune.txt"
# cat /home/pi/CubeSatSim/groundstation/auto-tune.txt
confidence=$(awk '{print $2}' /home/pi/CubeSatSim/groundstation/auto-tune.txt)
echo "Auto tune confidence: " $confidence
tries=$((tries+1))
done
if [ "$confidence" -gt "$threshold" ]; then
frequency=$(awk '{print $1}' /home/pi/CubeSatSim/groundstation/auto-tune.txt)
echo "Auto tune frequency: " $frequency
else
echo "Auto tune failed, frequency unchanged"
fi
echo
echo "If your CubeSatSim is transmitting in APRS mode (mode 1) then you should see packets."
echo
fi
sleep 5
value=`aplay -l | grep "Loopback"`
echo "$value" > /dev/null

@ -78,7 +78,7 @@ sudo killall -9 direwolf &>/dev/null
fi
# sudo killall -9 direwolf &>/dev/null
sudo killall -9 direwolf &>/dev/null
sleep 10

@ -1,46 +1,32 @@
#!/bin/bash
function start-rtl {
value=`aplay -l | grep "Loopback"`
echo "$value" > /dev/null
set -- $value
#rtl_fm -M fm -f 144.39M -s 48k | aplay -D hw:${2:0:1},0,0 -r 48000 -t raw -f S16_LE -c 1
rtl_fm -M fm -f $frequency -s 48k | tee >(aplay -D hw:${2:0:1},0,0 -r 48000 -t raw -f S16_LE -c 1) | aplay -r 48000 -t raw -f S16_LE -c 1
rtl_fm -g 48 -M fm -f $frequency -s 48k | aplay -D hw:${2:0:1},0,0 -r 48000 -t raw -f S16_LE -c 1 &
}
# script to auto decode packets using Direwolf and FM TXC and run Pacsat Ground Station
sudo pkill -f "/home/pi/CubeSatSim/groundstation/direwolf-pacsat-tmp.conf"
loopback=0
vox=0
#rpitx=0
#card=0
#pwm=0
safe=0
card=0
pwm=0
if [ "$1" = "l" ] ; then
loopback=1
elif [ "$1" = "v" ] ; then
vox=1
#elif [ "$1" = "c" ] ; then
# card=1
#else
# pwm=1
fi
if [[ $(lsusb | grep "RTL") ]] ; then
echo "RTL-SDR detected"
rtl=1
elif [ "$1" = "c" ] ; then
card=1
else
echo "No RTL-SDR detected"
rtl=0
# pwm=1
fi
pwm=1
fi
if [[ $(arecord -l | grep "USB Audio Device") ]] ; then
echo "USB Sound Card detected"
@ -50,15 +36,6 @@ else
soundcard=0
fi
gpio -g mode 12 up
if [[ $(gpio -g read 12 | grep 0) ]] ; then
echo "LPF is present"
lpf=1
else
echo "LPF not present"
lpf=0
fi
gpio -g mode 7 up
if [[ $(gpio -g read 7 | grep 0) ]] ; then
echo "TXC is present"
@ -66,26 +43,23 @@ if [[ $(gpio -g read 7 | grep 0) ]] ; then
else
echo "TXC not present"
txc=0
fi
timeout 1 rtl_test &> out.txt
if [[ $(grep "No supported" out.txt) ]] ; then
echo "No RTL-SDR detected"
rtl=0
else
echo "RTL-SDR detected."
rtl=1
fi
FILE=/home/pi/CubeSatSim/battery_saver
if [ -f "$FILE" ]; then
rpitx=1
elif [ "$txc" = "0" ] && [ "$lpf" = "1" ]; then
rpitx=1
else
rpitx=0
fi
if [ "$soundcard" = "0" ] && [ "$rtl" = "0" ]; then
echo "Won't work since can't receive with Sound Card or RTL-SDR"
sleep 10
exit
fi
safe=1
fi
value=`cat /home/pi/CubeSatSim/.mode`
echo "$value" > /dev/null
@ -94,27 +68,29 @@ set -- $value
MODE=$1
if [ ! "$MODE" = "P" ] && [ ! "$loopback" = "1" ] ; then
echo
echo "Changing to PacSat Ground Station Mode."
echo "You might reboot"
echo
sleep 5
/home/pi/CubeSatSim/config -I
fi
value=`cat /home/pi/CubeSatSim/sim.cfg`
echo "$value" > /dev/null
set -- $value
callsign="$1"
txfrequency="$7e3"
rxfrequency="$8e3"
frequency="$8e6"
echo
echo "Mode is not PacSat Ground Station"
echo
echo "Would you like to change to PacSat Ground Station mode and reboot? (y/n)?"
read -r ANS
if [ "$ANS" = "y" ]; then
/home/pi/CubeSatSim/config -I
exit
else
echo -n "Callsign is "
echo $callsign
echo
echo "You can run the PacSat Ground Station after you change mode and reboot."
sleep 10
exit
fi
if [ "$loopback" = "1" ] ; then
elif [ "$loopback" = "1" ] ; then
# if [ ! "$MODE" = "p" ] ; then
echo
@ -128,40 +104,18 @@ if [ "$loopback" = "1" ] ; then
cd
sudo rm PacSatGroundLoop.zip &>/dev/null
# wget https://github.com/alanbjohnston/CubeSatSim/raw/refs/heads/master-b/spacecraft/PacSatGround_0.46o/PacSatGround.zip
cp /home/pi/CubeSatSim/spacecraft/PacSatGround_0.46o/PacSatGround.zip .
unzip PacSatGround.zip -d PacSatGroundLoop
sudo rm PacSatGround.zip
mkdir PacSatGroundLoop/spacecraft
mv PacSatGroundLoop/PacSatGround/spacecraft/PacSatSim.properties PacSatGroundLoop/spacecraft/PacSatSim.properties
mv PacSatGroundLoop/PacSatGround/stp.dat PacSatGroundLoop/stp.dat
mv PacSatGroundLoop/PacSatGround/seq.dat PacSatGroundLoop/seq.dat
mv PacSatGroundLoop/PacSatGround/PacSatGround.properties PacSatGroundLoop/PacSatGround.properties
sudo sed -i 's/logfile_dir=\/home\/pi\/PacSatGround/logfile_dir=\/home\/pi\/PacSatGroundLoop/g' /home/pi/PacSatGroundLoop/PacSatGround.properties
FILE=/home/pi/Desktop/PacsatGround/spacecraft/PacSatSim.properties
if [ -f "$FILE" ]; then
FILE2=/home/pi/PacSatGroundLoop/spacecraft/PacSatSim.properties
sudo rm $FILE2
cp $FILE $FILE2
else
echo
echo "The first time you run the Ground Station, you will need to select Yes to override files, then put in your callsign"
sleep 10
fi
wget https://github.com/alanbjohnston/CubeSatSim/raw/refs/heads/master-b-p/spacecraft/PacSatGround_0.46o/PacSatGroundLoop.zip
unzip PacSatGroundLoop.zip -d PacSatGroundLoop
sudo rm PacSatGroundLoop.zip
echo
echo "The first time you run the Ground Station, you will need to select Yes to override files, then put in your callsign"
sleep 10
fi
sudo sed -i "s/TNC_TX_DELAY=.*$/TNC_TX_DELAY=750/g" /home/pi/PacSatGroundLoop/PacSatGround.properties
else
echo -n "Transmit Frequency is "
echo $txfrequency
echo -n "Receive Frequency is "
echo $rxfrequency
sleep 2
echo
echo "Mode is PacSat Ground Station"
echo
@ -170,30 +124,48 @@ else
cd
sudo rm PacSatGround.zip &>/dev/null
# wget https://github.com/alanbjohnston/CubeSatSim/raw/refs/heads/master-b/spacecraft/PacSatGround_0.46o/PacSatGround.zip
cp /home/pi/CubeSatSim/spacecraft/PacSatGround_0.46o/PacSatGround.zip .
unzip PacSatGround.zip
wget https://github.com/alanbjohnston/CubeSatSim/raw/refs/heads/master-b-p/spacecraft/PacSatGround_0.46o/PacSatGround.zip
unzip PacSatGround.zip -d PacSatGround
sudo rm PacSatGround.zip
FILE=/home/pi/Desktop/PacsatGround/spacecraft/PacSatSim.properties
if [ -f "$FILE" ]; then
FILE2=/home/pi/PacSatGround/spacecraft/PacSatSim.properties
sudo rm $FILE2
cp $FILE $FILE2
else
echo
echo "The first time you run the Ground Station, you will need to select Yes to override files, then put in your callsign"
sleep 10
fi
echo
echo "The first time you run the Ground Station, you will need to select Yes to override files, then put in your callsign"
sleep 10
fi
sudo sed -i "s/TNC_TX_DELAY=.*$/TNC_TX_DELAY=750/g" /home/pi/PacSatGround/PacSatGround.properties
fi
value=`cat /home/pi/CubeSatSim/sim.cfg`
echo "$value" > /dev/null
set -- $value
callsign="$1"
txfrequency="$7e3"
rxfrequency="$8e3"
echo -n "Callsign is "
echo $callsign
echo -n "Transmit Frequency is "
echo $txfrequency
echo -n "Receive Frequency is "
echo $rxfrequency
echo
sleep 2
sudo sed -i "s/TNC_TX_DELAY=.*$/TNC_TX_DELAY=750/g" /home/pi/PacSatGround/PacSatGround.properties
sudo sed -i "s/TNC_TX_DELAY=.*$/TNC_TX_DELAY=750/g" /home/pi/PacSatGroundLoop/PacSatGround.properties
sudo modprobe snd-aloop
#sudo systemctl stop cubesatsim >/dev/null 2>&1
#sudo systemctl stop transmit >/dev/null 2>&1
sudo systemctl stop command >/dev/null 2>&1
#/home/pi/CubeSatSim/config -I
sudo systemctl stop command >/dev/null 2>&1
sudo systemctl stop openwebrx >/dev/null 2>&1
@ -202,12 +174,14 @@ sudo systemctl stop rtl_tcp >/dev/null 2>&1
pkill -o chromium &>/dev/null
pkill -o firefox &>/dev/null
sudo killall -9 rtl_fm &>/dev/null
#sudo killall -9 direwolf &>/dev/null
sudo killall -9 sdrpp &>/dev/null
#sudo killall -9 aplay &>/dev/null
sudo killall -9 qsstv &>/dev/null
sudo killall -9 rtl_tcp &>/dev/null
@ -218,107 +192,77 @@ sudo killall -9 CubicSDR &>/dev/null
sudo killall -9 zenity &>/dev/null
sudo usermod -a -G gpio pi
#sudo systemctl restart pacsatsim
#sudo /etc/init.d/alsa-utils stop
#sudo /etc/init.d/alsa-utils start
sudo usermod -a -G gpio pi
if [ "$loopback" = "1" ] ; then
echo "1: Using Audio Loopback, No Transmit or Receive"
echo "Using Audio Loopback"
ADEVICE="ADEVICE plughw:CARD=Loopback,DEV=1"
PTT="PTT GPIOD gpiochip0 17"
else
elif [ "$safe" = "1" ] ; then
if [ "$lpf" = "1" ] ; then
ADEVICE="ADEVICE shared_mic plughw:CARD=Loopback,DEV=0"
PTT="PTT GPIOD gpiochip0 17"
if [ "$txc" = "1" ] && [ "$soundcard" = "1" ] ; then
if [ "$rpitx" = "1" ] ; then
echo "2: Using FM for Receive and rpitx for Transmit"
ADEVICE="ADEVICE shared_mic plughw:CARD=Loopback,DEV=0"
PTT="PTT GPIOD gpiochip0 17"
else
echo "3: Using FM for Receive and Transmit"
ADEVICE="ADEVICE shared_mic plughw:CARD=Headphones,DEV=0"
PTT="PTT GPIOD gpiochip0 -20"
fi
if [ ! "$txc" = "1" ] ; then
echo "Safe mode - battery saver won't work since no TXC present"
sleep 5
elif [ ! "$soundcard" = "1" ] ; then
echo "Safe mode - battery saver won't work since no sound card present"
sleep 5
else
echo "Safe mode - battery saver"
fi
elif [ "$txc" = "1" ] && [ "$soundcard" = "0" ] ; then
elif [ "$vox" = "1" ] ; then
if [ "$rtl" = "1" ]; then
if [ "$rpitx" = "1" ]; then
ADEVICE="ADEVICE plughw:CARD=Device,DEV=0"
PTT="PTT GPIOD gpiochip0 17"
echo "2b: Using RTL-SDR for Receive and rpitx for Transmit"
start-rtl
# ADEVICE="ADEVICE shared_mic plughw:CARD=Loopback,DEV=0"
ADEVICE="ADEVICE plughw:CARD=Loopback,DEV=1 plughw:CARD=Loopback,DEV=0"
PTT="PTT GPIOD gpiochip0 17"
else
if [ "$soundcard" = "1" ] ; then
echo "Using Soundcard Audio TX and RX (VOX, no PTT)"
else
echo "Soundcard Audio TX and RX (VOX, no PTT) will not work since no sound card present"
sleep 5
fi
echo "3b: RTL-SDR for Receive Only"
ADEVICE="ADEVICE plughw:CARD=Loopback,DEV=1"
PTT="#PTT GPIOD gpiochip0 17"
elif [ "$pwm" = "1" ] ; then
fi
else
echo "Won't work since can't receive with Sound Card or RTL-SDR"
sleep 10
exit
fi
else
if [ "$rtl" = "1" ]; then
echo "4: Using RTL-SDR for Receive and rpitx for Transmit"
start-rtl
# ADEVICE="ADEVICE shared_mic plughw:CARD=Loopback,DEV=0"
ADEVICE="ADEVICE plughw:CARD=Loopback,DEV=1 plughw:CARD=Loopback,DEV=0"
PTT="PTT GPIOD gpiochip0 17"
else
echo "5: Using Sound Card for Receive and rpitx for Transmit"
ADEVICE="ADEVICE shared_mic plughw:CARD=Loopback,DEV=0"
PTT="PTT GPIOD gpiochip0 17"
fi
fi
ADEVICE="ADEVICE shared_mic plughw:CARD=Headphones,DEV=0"
PTT="PTT GPIOD gpiochip0 -20"
if [ ! "$txc" = "1" ] ; then
echo "FM TXC using Soundcard input (JP13), PWM output won't work since no TXC present"
sleep 5
elif [ ! "$soundcard" = "1" ] ; then
echo "FM TXC using Soundcard input (JP13), PWM output won't work since no sound card present"
sleep 5
else
if [ "$txc" = "1" ] ; then
echo "6: Using FM for Receive Only"
ADEVICE="ADEVICE shared_mic plughw:CARD=Headphones,DEV=0"
PTT="#PTT GPIOD gpiochip0 -20"
echo "FM TXC using Soundcard input (JP13), PWM output"
fi
else
else
if [ "$rtl" = "1" ] ; then
start-rtl
echo "7: Using RTL-SDR for Receive Only"
ADEVICE="ADEVICE plughw:CARD=Loopback,DEV=1"
PTT="#PTT GPIOD gpiochip0 17"
else
echo "FM TXC using Soundcard input (JP13) and output (JP14)"
ADEVICE="ADEVICE shared_mic plughw:CARD=Device,DEV=0"
PTT="PTT GPIOD gpiochip0 -20"
echo "8: Using Sound Card for Receive and Transmit"
ADEVICE="ADEVICE plughw:CARD=Device,DEV=0"
PTT="PTT GPIOD gpiochip0 17"
fi
fi
if [ ! "$txc" = "1" ] ; then
echo "FM TXC using Soundcard input (JP13) and output (JP14) won't work since no TXC present"
sleep 5
elif [ ! "$soundcard" = "1" ] ; then
echo "FM TXC using Soundcard input (JP13), output (JP14) won't work since no sound card present"
sleep 5
else
echo "FM TXC using Soundcard input (JP13), output JP14"
fi
fi
DIREWOLF_CONF="/home/pi/CubeSatSim/groundstation/direwolf-pacsat-tmp.conf"
@ -334,7 +278,7 @@ echo
cat $DIREWOLF_CONF
echo
direwolf -P+ -D1 -qd -r 48000 -c $DIREWOLF_CONF &
direwolf -r 48000 -c $DIREWOLF_CONF -t 0 &
cd /home/pi/Desktop/PacsatGround/

@ -23,8 +23,6 @@ sudo systemctl stop rtl_tcp
pkill -o chromium &>/dev/null
pkill -o firefox &>/dev/null
sudo killall -9 java &>/dev/null
sudo killall -9 rtl_fm &>/dev/null

@ -29,8 +29,6 @@ sleep 2
pkill -o chromium &>/dev/null
pkill -o firefox &>/dev/null
sudo systemctl stop rtl_tcp &>/dev/null
sudo killall -9 sdrpp &>/dev/null

@ -5,7 +5,7 @@ echo "Script to run Web SDR for ARISS Radio Pi"
echo
echo "The browser will load in a few seconds with OpenWebRX."
echo "The Chromium browser will load in a few seconds with OpenWebRX."
echo "You can also use another web browser if you are on the same network as your Pi."
@ -32,8 +32,6 @@ sudo killall -9 rtl_fm &>/dev/null
pkill -o chromium &>/dev/null
pkill -o firefox &>/dev/null
sudo killall -9 rtl_tcp &>/dev/null
sudo killall -9 CubicSDR &>/dev/null
@ -61,8 +59,7 @@ sudo systemctl restart openwebrx
sleep 10
#setsid chromium-browser --password-store=basic --check-for-update-interval=1 --simulate-critical-update --noerrdialogs --disable-infobars --app=http://localhost:8073 &>/dev/null &
setsid x-www-browser http://localhost:8073/
setsid chromium-browser --check-for-update-interval=1 --simulate-critical-update --noerrdialogs --disable-infobars --app=http://localhost:8073 &>/dev/null &
sleep 10

@ -15,8 +15,6 @@ sudo systemctl stop rtl_tcp
pkill -o chromium &>/dev/null
pkill -o firefox &>/dev/null
sudo killall -9 rtl_fm &>/dev/null
sudo killall -9 direwolf &>/dev/null

@ -15,8 +15,6 @@ sudo systemctl stop rtl_tcp
pkill -o chromium &>/dev/null
pkill -o firefox &>/dev/null
sudo killall -9 rtl_tcp &>/dev/null
sudo killall -9 java &>/dev/null

@ -21,8 +21,6 @@ sudo systemctl stop rtl_tcp
pkill -o chromium &>/dev/null
pkill -o firefox &>/dev/null
sudo killall -9 qsstv &>/dev/null
sudo killall -9 rtl_tcp &>/dev/null

@ -22,8 +22,6 @@ sudo systemctl stop rtl_tcp &>/dev/null
pkill -o chromium &>/dev/null
pkill -o firefox &>/dev/null
sudo killall -9 rtl_tcp &>/dev/null
sudo killall -9 java &>/dev/null
@ -41,9 +39,7 @@ sudo killall -9 rtl_fm &>/dev/null
#echo "s" >> .mode
autotune=0
frequency=$(zenity --timeout=10 --list 2>/dev/null --width=410 --height=270 --title="SSTV Decoding using QSSTV" --text="Choose the frequency for SSTV decoding:" --column="kHz" --column="Use" 145800 "ISS" 434900 "CubeSatSim" Auto-tune "CubeSatSim Auto-tune" Other "Choose another frequency" SSTV "Test SSTV decoding with WAV file")
frequency=$(zenity --timeout=10 --list 2>/dev/null --width=410 --height=220 --title="SSTV Decoding using QSSTV" --text="Choose the frequency for SSTV decoding:" --column="kHz" --column="Use" 145800 "ISS" 434900 "CubeSatSim" Other "Choose another frequency" SSTV "Test SSTV decoding with WAV file")
echo $frequency
@ -79,11 +75,6 @@ echo
echo "If your CubeSatSim is transmitting in SSTV mode (mode 4) you should get images."
echo "Note: if you see and hear an SSTV signal but don't get any images, the CubeSatSim signal might have a frequency offset. Try rebooting the CubeSatSim to fix."
elif [ "$frequency" = "Auto-tune" ]; then
frequency=434900000
autotune=1
elif [ "$choice" = "3" ] || [ "$frequency" = "Other" ]; then
echo
@ -129,49 +120,15 @@ echo
echo -e "Auto decoding SSTV on $frequency Hz"
#sleep 2
sleep 2
setsid qsstv &
#sleep 5
if [ "$autotune" = "1" ]; then
threshold=1
delay=5
retries=5
echo "Starting Auto-tune scanning"
echo "Scan will stop when confidence exceeds threshold value of" $threshold "or after" $retries "retries"
tries=0
confidence=0
delay=$((delay-2)) # subtract 2 second built in delay
while [ $tries -le $retries ] && [ "$confidence" -le "$threshold" ]; do
sleep $delay
source /home/pi/venv/bin/activate
python3 /home/pi/CubeSatSim/groundstation/auto-tune.py 434900000 n 2> null > /home/pi/CubeSatSim/groundstation/auto-tune.txt
# echo "auto-tune.txt"
# cat /home/pi/CubeSatSim/groundstation/auto-tune.txt
confidence=$(awk '{print $2}' /home/pi/CubeSatSim/groundstation/auto-tune.txt)
echo "Auto tune confidence:" $confidence
tries=$((tries+1))
done
if [ "$confidence" -gt "$threshold" ]; then
frequency=$(awk '{print $1}' /home/pi/CubeSatSim/groundstation/auto-tune.txt)
echo "Auto tune frequency:" $frequency
else
echo "Auto tune failed, frequency unchanged"
fi
echo
echo "If your CubeSatSim is transmitting in SSTV mode (mode 4) you should get images."
echo
fi
sleep 5
#sudo systemctl restart cubesatsim
value=`aplay -l | grep "Loopback"`
echo "$value" > /dev/null
set -- $value

@ -21,8 +21,6 @@ sudo systemctl stop rtl_tcp
pkill -o chromium &>/dev/null
pkill -o firefox &>/dev/null
sudo killall -9 qsstv &>/dev/null
sudo killall -9 rtl_tcp &>/dev/null

@ -65,10 +65,10 @@ if [[ $(grep '11.' /etc/debian_version) ]]; then
sudo sed -i 's/console=serial0,115200 //g' /boot/cmdline.txt
sudo sed -i 's/console=tty1 r/console=tty1 maxcpus=2 r/g' /boot/cmdline.txt # single core if Pi Zero 2
# sudo sed -i 's/console=tty1 maxcpus=1 r/console=tty1 r/g' /boot/cmdline.txt
# sudo sed -i 's/console=tty1 r/console=tty1 maxcpus=1 r/g' /boot/cmdline.txt # single core if Pi Zero 2
sudo sed -i 's/console=tty1 maxcpus=1 r/console=tty1 r/g' /boot/cmdline.txt
sudo sed -i 's/maxcpus=1/maxcpus=2/g' /boot/cmdline.txt # single core if Pi Zero 2
# sudo sed -i 's/maxcpus=2/maxcpus=1/g' /boot/cmdline.txt # single core if Pi Zero 2
sudo sed -i 's/#dtparam=i2c_arm=on/dtparam=i2c_arm=on/g' /boot/config.txt
@ -163,10 +163,11 @@ if [[ $(grep 'bookworm' /etc/os-release) ]]; then
sudo sed -i 's/console=serial0,115200 //g' /boot/firmware/cmdline.txt
sudo sed -i 's/console=tty1 r/console=tty1 maxcpus=2 r/g' /boot/firmware/cmdline.txt # single core if Pi Zero 2
# sudo sed -i 's/console=tty1 maxcpus=1 r/console=tty1 r/g' /boot/firmware/cmdline.txt
# sudo sed -i 's/console=tty1 r/console=tty1 maxcpus=1 r/g' /boot/firmware/cmdline.txt # single core if Pi Zero 2
sudo sed -i 's/console=tty1 maxcpus=1 r/console=tty1 r/g' /boot/firmware/cmdline.txt
sudo sed -i 's/maxcpus=1/maxcpus=2/g' /boot/firmware/cmdline.txt # single core if Pi Zero 2
# sudo sed -i 's/maxcpus=2/maxcpus=1/g' /boot/firmware/cmdline.txt # single core if Pi Zero 2
sudo sed -i 's/#dtparam=i2c_arm=on/dtparam=i2c_arm=on/g' /boot/firmware/config.txt
@ -404,21 +405,12 @@ fi
sudo systemctl disable gpsd
sudo systemctl disable gpsd.socket
#if [ ! -d "/home/pi/WiringPi" ]; then
# cd
# git clone https://github.com/alanbjohnston/WiringPi
# cd WiringPi
# ./build debian
# sudo dpkg -i debian-template/wiringpi-2.61-1.deb
#fi
if [ ! -d "/home/pi/WiringPi3" ]; then
if [ ! -d "/home/pi/WiringPi" ]; then
cd
git clone https://github.com/WiringPi/WiringPi.git WiringPi3
cd WiringPi3
git clone https://github.com/alanbjohnston/WiringPi
cd WiringPi
./build debian
mv debian-template/wiringpi*.deb .
sudo apt install ./wiringpi*.deb
sudo dpkg -i debian-template/wiringpi-2.61-1.deb
fi
cd
@ -516,8 +508,8 @@ FILE=/home/pi/pi_pacsat/Debug/pi_pacsat # code has already been compiled
if [ ! -f "$FILE" ]; then
cd
git clone https://github.com/alanbjohnston/pi_pacsat.git
#git clone https://github.com/ac2cz/pi_pacsat.git
#git clone https://github.com/alanbjohnston/pi_pacsat.git
git clone https://github.com/ac2cz/pi_pacsat.git
cd pi_pacsat
#git checkout master-debug
cd Debug
@ -595,10 +587,10 @@ sudo raspi-config nonint do_vnc 0
if [ ! -d "/home/pi/Desktop/PacsatGround" ]; then
cd /tmp
wget https://www.g0kla.com/pacsat/downloads/test/PacsatGround_unix_0_46q.tar.gz
tar -xzf PacsatGround_unix_0_46q.tar.gz -C /home/pi/Desktop
rm PacsatGround_unix_0_46q.tar.gz
# cp /home/pi/CubeSatSim/spacecraft/PacSatGround_0.46o/* /home/pi/Desktop/PacsatGround/spacecraft/
wget https://www.g0kla.com/pacsat/downloads/test/PacsatGround_unix_0_46o.tar.gz
tar -xzf PacsatGround_unix_0_46o.tar.gz -C /home/pi/Desktop
rm PacsatGround_unix_0_46o.tar.gz
cp /home/pi/CubeSatSim/spacecraft/PacSatGround_0.46o/* /home/pi/Desktop/PacsatGround/spacecraft/
# mkdir /home/pi/PacSatGround
sudo usermod -a -G gpio pi
sudo apt-get install default-jdk -y
@ -620,7 +612,6 @@ fi
if [ ! -d "/home/pi/rpitx" ]; then
sudo apt install -y libraspberrypi-dev
cd
git clone https://github.com/alanbjohnston/rpitx.git
cd rpitx

@ -50,14 +50,14 @@ else
txc=0
fi
#timeout 1 rtl_test &> out.txt
#if [[ $(grep "No supported" out.txt) ]] ; then
# echo "No RTL-SDR detected"
# rtl=0
#else
# echo "RTL-SDR detected."
# rtl=1
#fi
timeout 1 rtl_test &> out.txt
if [[ $(grep "No supported" out.txt) ]] ; then
echo "No RTL-SDR detected"
rtl=0
else
echo "RTL-SDR detected."
rtl=1
fi
value=`cat /home/pi/CubeSatSim/sim.cfg`
echo "$value" > /dev/null
@ -67,7 +67,7 @@ callsign="$1"
txfrequency="$7e3"
rxfrequency="$8e3"
echo -n "PacSat callsign is "
echo -n "PacSat allsign is "
echo $callsign
echo -n "Transmit Frequency is "
echo $txfrequency
@ -84,12 +84,11 @@ if [ ! -d "/home/pi/PacSat" ]; then
cd
sudo rm pacsat-dir.zip
mkdir /home/pi/PacSat
mkdir /home/pi/PacSat/pacsat
mkdir /home/pi/PacSat/pacsat/dir
# wget https://github.com/alanbjohnston/pi_pacsat/releases/download/v0.2/pacsat-dir.zip
cp /home/pi/pi_pacsat/zip/pacsat-dir.zip .
unzip pacsat-dir.zip
mkdir PacSat
mkdir PacSat/pacsat
mkdir PacSat/pacsat/dir
wget https://github.com/alanbjohnston/pi_pacsat/releases/download/v0.1/pacsat-dir.zip
unzip pacsat-dir.zip -d PacSat/pacsat/dir
sudo rm pacsat-dir.zip
cd
@ -97,9 +96,8 @@ if [ ! -d "/home/pi/PacSat" ]; then
sudo rm /home/pi/pi_pacsat/Debug/pacsat.state
sudo rm /home/pi/pi_pacsat/Debug/pacsat_upload_table.dat
sudo rm pi_pacsat.zip
# wget https://github.com/alanbjohnston/pi_pacsat/releases/download/v0.2/pi_pacsat.zip
cp /home/pi/pi_pacsat/zip/pi_pacsat.zip .
unzip pi_pacsat.zip -d /
wget https://github.com/alanbjohnston/pi_pacsat/releases/download/v0.1/pi_pacsat.zip
unzip pi_pacsat.zip -d /home/pi/pi_pacsat/Debug
sudo rm pi_pacsat.zip
# mkdir /home/pi/PacSat
@ -298,8 +296,7 @@ echo
cat $DIREWOLF_CONF
echo
#direwolf -P+ -D1 -qd -dp -r 48000 -c $DIREWOLF_CONF -t 0 &
direwolf -qd -r 48000 -c $DIREWOLF_CONF &
direwolf -P+ -D1 -qd -dp -r 48000 -c $DIREWOLF_CONF -t 0 &
# arecord -D plughw:CARD=Loopback,DEV=1 -f S16_LE -r 48000 -c 1 | csdr convert_s16_f | csdr gain_ff 14000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f 434900 &
## arecord -D plughw:CARD=Loopback,DEV=1 -f S16_LE -r 48000 -c 1 | csdr convert_s16_f | csdr gain_ff 4000 | csdr convert_f_samplerf 20833 | sudo rpitx -i- -m RF -f 434900 &

Loading…
Cancel
Save

Powered by TurnKey Linux.