Last active
November 28, 2022 02:08
-
-
Save mpentler/7c169c58ebfe46543dfaf47c11cadc8a to your computer and use it in GitHub Desktop.
Python RPI VHF Wx satellite recorder
This file contains 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
# RPi zero RTL-SDR VHF weather satellite recorder | |
# Mark Pentler 2021 v0.1 | |
from gpiozero import Button #import button from the Pi GPIO library | |
import time # import time functions | |
import os #imports OS library for Shutdown control | |
hold_time = 2 | |
record_button_delay = 1 | |
# define button GPIO pins | |
noaa15Button = Button(5) | |
noaa18Button = Button(6) | |
noaa19Button = Button(13) | |
meteorm2Button = Button(19) | |
shutdownButton = Button(26) | |
while True: # loop | |
if noaa15Button.is_pressed: | |
time.sleep(hold_time) | |
if noaa15Button.is_pressed: # check if the user let go of the button | |
# cmd here | |
full_command = “rtl_fm -f 137620000 -M fm -s 40k - | sox -t raw -e signed -c 1 -b 16 -r 40 - test.wav rate 11025” | |
process = subprocess.Popen(full_command, stdin=None, stdout=None, stderr=None, close_fds=True) | |
time.sleep(record_button_delay) # delay to give time for button to be released | |
noaa15Button.wait_for_press() # now wait here for button push to stop recording | |
process.kill() | |
if noaa18Button.is_pressed: | |
time.sleep(hold_time) | |
if noaa18Button.is_pressed: | |
full_command = “rtl_fm -f 137912500 -M fm -s 40k - | sox -t raw -e signed -c 1 -b 16 -r 40 - test.wav rate 11025” | |
process = subprocess.Popen(full_command, stdin=None, stdout=None, stderr=None, close_fds=True) | |
time.sleep(record_button_delay) | |
noaa18Button.wait_for_press() | |
process.kill() | |
if noaa19Button.is_pressed: | |
time.sleep(hold_time) | |
if noaa19Button.is_pressed: | |
full_command = “rtl_fm -f 137100000 -M fm -s 40k - | sox -t raw -e signed -c 1 -b 16 -r 40 - test.wav rate 11025” | |
process = subprocess.Popen(full_command, stdin=None, stdout=None, stderr=None, close_fds=True) | |
time.sleep(record_button_delay) | |
noaa19Button.wait_for_press() | |
process.kill() | |
if meteorm2Button.is_pressed: | |
time.sleep(hold_time) | |
if meteorm2Button.is_pressed: | |
# cmd here | |
process = subprocess.Popen(full_command, stdin=None, stdout=None, stderr=None, close_fds=True) | |
time.sleep(record_button_delay) | |
noaa19Button.wait_for_press() | |
process.kill() | |
if shutdownButton.is_pressed: | |
time.sleep(hold_time) | |
if shutdownButton.is_pressed: | |
os.system("shutdown now -h") # shut down the Pi | |
time.sleep(1) # delay loop to spare CPU cycles |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment