Translate

Monday 8 June 2020

Raspberry Pi Zero NOAA finishing touches.

I'm chuffed with the Pi Zero receiver in the last post, and I'm going to install it in my workshop in Evesham, to take over the job done by the laptop and my FT-817.

I needed to pretty it up a bit.

I found a suitable small case to house the Pi, the SDR and an old LNA (previously failed, but a new amp chip and all is well) 

I got to thinking.... 

Nice if we had some status LEDs on the front panel.

Power (obv.), READY (we've got a pass schedule, so ready to go when a bird pops up), AOS (Acquisition of Satellite) and PROC (processing images).

A front panel is created and printed on a piece of clear acetate, which is then stuck to the front panel with lacquer. It's OK if you don't look too closely...











To drive the LEDs, there are two bash scripts to alter ...

schedule_all.sh and receive_and_process.sh

both are found in ~weather/predict/

schedule_all.sh needs the following lines at the end..

#Switch READY led ON
sudo echo "24" > /sys/class/gpio/export
sudo echo "out" > /sys/class/gpio/gpio24/direction
sudo echo "1" > /sys/class/gpio/gpio24/value

receive_and_process.sh now looks like this..

#!/bin/bash

# $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/pics/Folder${NOW}
#switch on AOS led, switch off READY LED
sudo echo "22" > /sys/class/gpio/export
sudo echo "out" > /sys/class/gpio/gpio22/direction
sudo echo "1" > /sys/class/gpio/gpio22/value
sudo echo "0" > /sys/class/gpio/gpio24/value
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 ]

then
#switch off AOS led, switch on PROC led
sudo echo "0" > /sys/class/gpio/gpio22/value 
sudo echo "23" > /sys/class/gpio/export
sudo echo "out" > /sys/class/gpio/gpio23/direction
sudo echo "1" > /sys/class/gpio/gpio23/value
/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 CLASS $3.wav ${3}.CLASS.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 MSA-precip $3.wav ${3}.MSAPRECIP.png
/usr/local/bin/wxtoimg -m ${3}-map.png -e MCIR-PRECIP $3.wav ${3}.MCIRPRECIP.png

fi


# PROC LED off

sudo echo "0" > /sys/class/gpio/gpio23/value

# copies files to the new folder and deletes the original ones

cp /home/pi/weather/*.png /home/pi/weather/pics/Folder${NOW}/
rm /home/pi/weather/pics/Folder${NOW}/*-map.png
rm /home/pi/weather/*.png
rm /home/pi/weather/*.wav
wput -B -u --dont-continue --reupload --tries=5 --binary --verbose --reupload ftp://mywebspaceusername:mypassword@myurl ~/weather/pics/Folder*/*.*
# READY led on
sudo echo "1" > /sys/class/gpio/gpio24/value

You can see from the script that the GPIO pins 22,23 and 24 are used for the LEDs (The POWER LED is driven from the supply). Because only one LED is on at anytime, we can cheat and use only one 220 ohm current limiting resistor to a ground pin, and drive the LEDs directly from the GPIOs, a huge saving of ~3p. Every little helps...

GPIO pin 22 is the AOS LED drive, 23 is PROC, and 24 is READY.

The finished receiver...


In situ, waiting for a pass...

        


No comments:

Post a Comment