Browse Source

First commit

tags/v1.0
Nico Rey 6 years ago
commit
6e2dd2a5ab
6 changed files with 88 additions and 0 deletions
  1. +14
    -0
      README.md
  2. +3
    -0
      index.html
  3. +12
    -0
      nginx.cfg
  4. +20
    -0
      receive.sh
  5. +14
    -0
      schedule.sh
  6. +25
    -0
      schedule_sat.sh

+ 14
- 0
README.md View File

@@ -0,0 +1,14 @@
# NOAA Automated capture using Raspberry PI
Most of the code and setup stolen from: [Instructables](https://www.instructables.com/id/Raspberry-Pi-NOAA-Weather-Satellite-Receiver/)
### New Features!
- Nginx webserver to show images
- Timestamp and satellite name over every image
- WXToIMG configured to create several images (HVC,HVCT,MCIR, etc)

### Manual work
- sudo apt-get install imagemagick nginx predict libusb-1.0 cmake
- Install [rtlsdr](https://github.com/keenerd/rtl-sdr.git)

### Important notes
- I tried to run this on a Raspberry PI Zero Wifi, no luck. Seems like it's too much load for the CPU. Running on a Raspberry PI 2+ is ok.
- Code was a bit updated on how it handles the UTC vs timezone times.

+ 3
- 0
index.html View File

@@ -0,0 +1,3 @@
<h1>WX reception server</h1>
<a href="image">Images</a>
<a href="audio">audio</a>

+ 12
- 0
nginx.cfg View File

@@ -0,0 +1,12 @@
server {
listen 80 default_server;
root /home/pi;
index index.html index.htm index.nginx-debian.html;
autoindex on;

server_name wx.home wx.reyni.co;

location / {
try_files $uri $uri/ =404;
}
}

+ 20
- 0
receive.sh View File

@@ -0,0 +1,20 @@
#!/bin/bash
if pgrep "rtl_fm" > /dev/null
then
exit 1
fi
# $1 = Satellite Name
# $2 = Frequency
# $3 = FileName base
# $4 = TLE File
# $5 = EPOC start time
# $6 = Time to capture
start=`date '+%d-%m-%Y %H:%M'`
timeout $6 rtl_fm -f ${2}M -s 60k -g 50 -p 55 -E wav -E deemp -F 9 - | sox -t raw -e signed -c 1 -b 16 -r 60000 - /home/pi/audio/$3.wav rate 11025

PassStart=`expr $5 + 90`
/usr/local/bin/wxmap -T "${1}" -H $4 -p 0 -l 0 -o $PassStart /home/pi/map/${3}-map.png
for i in ZA MCIR MCIR-precip MSA MSA-precip HVC-precip HVCT-precip HVC HVCT; do
/usr/local/bin/wxtoimg -o -m /home/pi/map/${3}-map.png -e $i /home/pi/audio/$3.wav /home/pi/image/$3-$i.png
/usr/bin/convert /home/pi/image/$3-$i.png -undercolor black -fill yellow -pointsize 18 -annotate +20+20 "$1 $start" /home/pi/image/$3-$i.png
done

+ 14
- 0
schedule.sh View File

@@ -0,0 +1,14 @@
#!/bin/bash
#wget -qr https://www.celestrak.com/NORAD/elements/weather.txt -O /home/pi/predict/weather.txt
grep "NOAA 15" /home/pi/predict/weather.txt -A 2 > /home/pi/predict/weather.tle
grep "NOAA 18" /home/pi/predict/weather.txt -A 2 >> /home/pi/predict/weather.tle
grep "NOAA 19" /home/pi/predict/weather.txt -A 2 >> /home/pi/predict/weather.tle

#Remove all AT jobs
for i in `atq | awk '{print $1}'`;do atrm $i;done


#Schedule Satellite Passes:
/home/pi/schedule_sat.sh "NOAA 19" 137.1000
/home/pi/schedule_sat.sh "NOAA 18" 137.9125
/home/pi/schedule_sat.sh "NOAA 15" 137.6200

+ 25
- 0
schedule_sat.sh View File

@@ -0,0 +1,25 @@
#!/bin/bash
PREDICTION_START=`/usr/bin/predict -t /home/pi/predict/weather.tle -p "${1}" | head -1`
PREDICTION_END=`/usr/bin/predict -t /home/pi/predict/weather.tle -p "${1}" | tail -1`

var2=`echo $PREDICTION_END | cut -d " " -f 1`

MAXELEV=`/usr/bin/predict -t /home/pi/predict/weather.tle -p "${1}" | awk -v max=0 '{if($5>max){max=$5}}END{print max}'`

while [ `date --date="@${var2}" +%D` == `date +%D` ]; do
START_TIME=`echo $PREDICTION_START | cut -d " " -f 3-4`
var1=`echo $PREDICTION_START | cut -d " " -f 1`
var3=`echo $START_TIME | cut -d " " -f 2 | cut -d ":" -f 3`
TIMER=`expr $var2 - $var1 + $var3`
OUTDATE=`date --date="TZ=\"UTC\" $START_TIME" +%Y%m%d-%H%M%S`
if [ $MAXELEV -gt 19 ]
then
echo ${1//" "}${OUTDATE} $MAXELEV
echo "/home/pi/receive.sh \"${1}\" $2 ${1//" "}${OUTDATE} /home/pi/predict/weather.tle $var1 $TIMER" | at `date --date="TZ=\"UTC\" $START_TIME" +"%H:%M %D"`
fi
nextpredict=`expr $var2 + 60`
PREDICTION_START=`/usr/bin/predict -t /home/pi/predict/weather.tle -p "${1}" $nextpredict | head -1`
PREDICTION_END=`/usr/bin/predict -t /home/pi/predict/weather.tle -p "${1}" $nextpredict | tail -1`
MAXELEV=`/usr/bin/predict -t /home/pi/predict/weather.tle -p "${1}" $nextpredict | awk -v max=0 '{if($5>max){max=$5}}END{print max}'`
var2=`echo $PREDICTION_END | cut -d " " -f 1`
done

Loading…
Cancel
Save