I have the following script that downloads and processes NOAA satellites. I'd really like some external LEDs to indicate the following;

  1. When the script is running, turn or blink red
  2. When the script is not running, turn or blink green
  3. When the script is within 1 hr of running, turn or blink yellow

I need some assistance in getting a traffic light working WHILE the script is running. I don't know if it's better to call certain other scripts or embed into the existing code (not sure where to do this). I have the LEDs on a breadboard and working fine. Any assistance would be appreciated...thanks.

Further Details on PI GPIO = Red 10, Yellow 9, Green 11

# $1 = Satellite Name
# $2 = Frequency
# $3 = FileName base
# $4 = TLE File
# $5 = EPOC start time
# $6 = Time to capture
# reads and creates folder with current date / time (i.e 05-30-2019_07-48 *windows friendly*)
NOW=$(date +%m-%d-%Y_%H-%M)
mkdir /home/pi/weather/${NOW}
sudo timeout $6 rtl_fm -f ${2}M -s 60k -g 45 -p 55 -E wav -E deemp -F 9 - | 
sox -t wav - $3.wav rate 11025
PassStart=`expr $5 + 90`
if [ -e $3.wav ]
/usr/local/bin/wxmap -T "${1}" -H $4 -p 0 -l 0 -o $PassStart ${3}-map.png
#/usr/local/bin/wxtoimg -m ${3}-map.png -e ZA $3.wav ${3}.png
#/usr/local/bin/wxtoimg -m ${3}-map.png -e NO $3.wav ${3}.NO.png
#/usr/local/bin/wxtoimg -m ${3}-map.png -e MCIR $3.wav ${3}.MCIR.png
#/usr/local/bin/wxtoimg -m ${3}-map.png -e MSA $3.wav ${3}.MSA.png

#CODE FROM https://forums.qrz.com/index.php?threads/weather-satellite script-help-raspbian.614971/page-7...added 1.17.2020
/usr/local/bin/wxtoimg -m ${3}-map.png -e ZA $3.wav ${3}.png
/usr/local/bin/wxtoimg -m ${3}-map.png -e NO $3.wav ${3}.NO.png
/usr/local/bin/wxtoimg -m ${3}-map.png -e MCIR $3.wav ${3}.MCIR.png
/usr/local/bin/wxtoimg -m ${3}-map.png -e MSA $3.wav ${3}.MSA.png
/usr/local/bin/wxtoimg -m ${3}-map.png -e HVCT $3.wav ${3}.HVCT.png
/usr/local/bin/wxtoimg -m ${3}-map.png -e therm $3.wav ${3}.Thermal.png
/usr/local/bin/wxtoimg -m ${3}-map.png -e JF $3.wav ${3}.JF.png
# copies files to the new folder and deletes the original ones
cp /home/pi/weather/*.png /home/pi/weather/${NOW}/
cd /home/pi//weather/${NOW}/
rm /home/pi/weather/${NOW}/*-map.png
rm /home/pi/weather/*.png
rm /home/pi/weather/*.wav
  • Hi @dandspach, Welcome and nice to meet you. Ah, let me see. Your NOAA satellite project is very interesting. Can you tell me the web link of the tutorial for writing your bash script? I think it is easier to do that in python which you can find loads of newbie tutorials blinking LEDs with something called "GPIO" . References: (1) NOAA: en.wikipedia.org/wiki/… (2) NOAA Satellites - Wiki en.wikipedia.org/wiki/List_of_NOAA_Satellites, (3) Rpi GPIO Tutorial - PiMyLife pimylifeup.com/raspberry-pi-gpio
    – tlfong01
    Jan 30, 2020 at 1:35
  • Sure...I'm familiar with turning LEDs on and off in Python, but not inside of a script. I don't know if I can call a Python script from a bash script. I basically followed the directions in the following: [instructables.com/id/…)
    – dandspach
    Jan 30, 2020 at 1:59
  • Also, some of my results are posted at: [ycars.org/]
    – dandspach
    Jan 30, 2020 at 2:04
  • (1) You enclosed yacrs.org in square brackets and this confuses the forum software here. (2) I am not sure if python imbedded in bash script is the way to go, I would prefer to do the other way around, bash ("os" commands) inside a python script. If you already know how to turn on/off LED in python, then you can explore a little bit, and perhaps write you answer here. I guess many bash/python guys would love to help you along.
    – tlfong01
    Jan 30, 2020 at 2:40
  • I have not used SDR before, though I can do basic GPS, also catch satellites. I am googling reference to refresh my memory, to see if I can join in your python project. References: (4) Receiving NOAA Weather Satellites with an SDR and a Rasperry Pi - 52,591 views 33 People Made This Project! 2017jan08 youtube.com/… (5) Building a quadrifilar helix antenna (QFH) for NOAA satellite reception with an RTL-SDR youtube.com/watch?v=KU75FSA6o2M&feature=youtu.be
    – tlfong01
    Jan 30, 2020 at 2:42

1 Answer 1


Got it. Very simple...in BASH

#Defines gpio pin direction
gpio -g mode 17 out #green
gpio -g mode 27 out #yellow
gpio -g mode 22 out #red

#Turns off GREEN led
gpio -g write 17 0

#Turns on RED led
gpio -g write 22 1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.