Raspberry Pi NOAA Weather Satellite Receiver

83,075

128

278

Introduction: Raspberry Pi NOAA Weather Satellite Receiver

About: I'm a ham, a tinker, a maker. I like interesting things. I'm a technophile, a wood turner, and a pen maker.

A new pile of parts means a new project is in the works.

I’m building a Raspberry Pi based NOAA weather satellite receiver. I’ve got some experience with receiving signals from NOAA satellites, but will be a little different, as all of the work is going to be done automatically on a Raspberry Pi. This will allow me to place the receiver right at the antenna, which is mounted in my attic. With a very short piece of coax, reducing feed-line loss.

I’ll be using the following list of parts:

  • Raspberry Pi 3 Model B
  • MicroUSB Power Supply
  • Generic Raspberry Pi 3 Case
  • 32 GB Micro SD Card
  • NooElec SDR Dongle
  • QFH Antenna

This project will require some basic Linux skills. If you are not comfortable navigating around the Linux command line, you may need to get some help if you want to follow along.

This instructable is going to focus on getting the Raspberry Pi working to receive images. Details around building a proper antenna can be found from other sources. I even made a video about it: https://youtu.be/KU75FSA6o2M

Step 1: Prepare the Raspberry Pi

The first step is getting the Raspberry Pi up and running. I’m using Raspbian (Jessie 2016-11-25).

There are plenty of tutorials on getting Raspbian set up and booting on the Raspberry Pi. You should have no difficulty in finding one: https://www.raspberrypi.org/documentation/installation/installing-images/README.md

Once you have the Raspbian image copied to your micro SD card, boot the Raspberry Pi. You'll need to get it on the network and enable SSH. You can certainly use either a wired Ethernet connection, or wireless. I'm using wireless, as I don't have a wired connection in my attic.

Enable SSH using the Raspberry Pi Configuration utility in the Preferences menu. You may want to set it to boot to CLI while you are in there. Since this is going to be a headless setup, there is no need to waste resources on a GUI.

Next we want to make sure the Raspberry Pi is fully up-to-date. Issue the following commands:

sudo apt-get update
sudo apt-get upgrade
sudo reboot

Step 2: Install the Necessary Software

The first thing we need is the USB drivers for the RTL dongle:

sudo apt-get install libusb-1.0

Since we need to build the latest version of rtl-sdr to actually make use of the RTL dongle, we'll need to install cmake:

sudo apt-get install cmake

We need to make sure the Raspberry Pi doesn't load any SDR kernel modules that will interfere with the rtl-sdr sofware.

Using your favorite text editor, create a new file named /etc/modprobe.d/no-rtl.conf and put the following text in the file. You need to run that text editor as sudo (i.e. 'sudo vi' or 'sudo nano' etc) to write to the modprobe.d directory:

blacklist dvb_usb_rtl28xxu
blacklist rtl2832
blacklist rtl2830

Install the most recent build of rtl-sdr:

cd ~
git clone https://github.com/keenerd/rtl-sdr.git
cd rtl-sdr/
mkdir build
cd build
cmake ../ -DINSTALL_UDEV_RULES=ON
make
sudo make install
sudo ldconfig
cd ~
sudo cp ./rtl-sdr/rtl-sdr.rules /etc/udev/rules.d/
sudo reboot

We'll need the sox audio toolkit in order to manipulate the received audio stream:

sudo apt-get install sox

We need a way to schedule the captures to happen as the satellites pass overhead. Install the at scheduler:

sudo apt-get install at

We need a way to know when the satellites will pass overhead. We'll use an application called predict:

sudo apt-get install predict

Finally, we'll need wxtoimg to convert the captured audio stream to an actual image:

cd ~
wget http://www.wxtoimg.com/beta/wxtoimg-armhf-2.11.2-beta.deb
sudo dpkg -i wxtoimg-armhf-2.11.2-beta.deb

Step 3: Testing Things Out

Once all the software is installed, make sure your USB dongle is connected and run the following command:

sudo rtl_test

You should see the following output:

Found 1 device(s):
  0:  Realtek, RTL2838UHIDIR, SN: 00000001

Using device 0: Generic RTL2832U OEM
Found Rafael Micro R820T tuner
Supported gain values (29): 0.0 0.9 1.4 2.7 3.7 7.7 8.7 12.5 14.4 15.7 16.6 19.7 20.7 22.9 25.4 28.0 29.7 32.8 33.8 36.4 37.2 38.6 40.2 42.1 43.4 43.9 44.5 48.0 49.6 
Sampling at 2048000 S/s.

Info: This tool will continuously read from the device, and report if
samples get lost. If you observe no further output, everything is fine.

Reading samples in async mode...

If you receive any error messages, you'll need to troubleshoot them before continuing. If your RTL Dongle isn't working at this point, it won't do any good to continue.

You need to run predict one time to set your ground station location. To do that you'll need your latitude and longitude. You can get your latitude and longitude from google maps by searching for your address, the right clicking on the pointer and selecting "What's Here". One thing to note is that Google displays North as positive and East as positive numbers. Predict uses North as positive but WEST as positive. Make sure to adjust accordingly, or your predictions will be no good.

Run predict from the command line, and select option 'G'. Enter your ground station information and exit the program.:

predict
                                      
                           --== PREDICT  v2.2.3 ==--         
                     Released by John A. Magliacane, KD2BD   
                                    May 2006                 
                                                             


                            --==[ Main Menu ]==--


 [P]: Predict Satellite Passes          [I]: Program Information
 [V]: Predict Visible Passes            [G]: Edit Ground Station Information
 [S]: Solar Illumination Predictions    [D]: Display Satellite Orbital Data
 [L]: Lunar Predictions                 [U]: Update Sat Elements From File
 [O]: Solar Predictions                 [E]: Manually Edit Orbital Elements
 [T]: Single Satellite Tracking Mode    [B]: Edit Transponder Database
 [M]: Multi-Satellite Tracking Mode     [Q]: Exit PREDICT

                 *  Ground Station Location Editing Utility  *



                        Station Callsign  : W1AW
                        Station Latitude  : 41.7169 [DegN]
                        Station Longitude : 72.7271 [DegW]
                        Station Altitude  : 25 [m]



            Enter the callsign or identifier of your ground station

You need to run wxtoimg once to accept the terms and conditions.

wxtoimg

You need to tell wxtoimg where your base station is at, so it can properly generate an overlay map. You do so by creating a file in your home directory named ~/.wxtoimgrc. In this file, North is positive, as with predict, however EAST is positive, which is the opposite of what predict uses. Make sure to adjust your values appropriately.

Using your favorite text editor, create a new file named ~/.wxtoimgrc and put the following text in the file, substituting your values:

Latitude: 41.7169
Longitude: -72.7271
Altitude: 25

Step 4: The Scripts

Now that you've got a working RTL dongle on your Raspberry Pi, it's time to actually make it receive some weather maps. Make sure your antenna is connected and located as best as possible. I've got mine mounted in my attic and it works fairly well from there. If you can mount it outside, that would be even better. Get it as high as possible.

We are going to need to create a few scripts to automate everything. This is where that Linux familiarity is going to come in.

First we'll create a couple directories to hold our files:

cd ~
mkdir weather
cd weather
mkdir predict
cd predict

Next we'll make the two scripts that kick off the scheduling. The first is 'schedule_all.sh'. This script will be called nightly at midnight. It downloads satellite pass information from celestrak and creates a TLE file for predict to use. Then it removes all AT jobs from the system, so no passes get double scheduled. Finally, it calls the second script 'schedule_satellite.sh' for each satellite we are interested in.

Using your favorite text editor, create a new file in ~/weather/predict named schedule_all.sh and put the following code in the file:

#!/bin/bash

# Update Satellite Information

wget -qr https://www.celestrak.com/NORAD/elements/weather.txt -O /home/pi/weather/predict/weather.txt
grep "NOAA 15" /home/pi/weather/predict/weather.txt -A 2 > /home/pi/weather/predict/weather.tle
grep "NOAA 18" /home/pi/weather/predict/weather.txt -A 2 >> /home/pi/weather/predict/weather.tle
grep "NOAA 19" /home/pi/weather/predict/weather.txt -A 2 >> /home/pi/weather/predict/weather.tle
grep "METEOR-M 2" /home/pi/weather/predict/weather.txt -A 2 >> /home/pi/weather/predict/weather.tle



#Remove all AT jobs

for i in `atq | awk '{print $1}'`;do atrm $i;done


#Schedule Satellite Passes:

/home/pi/weather/predict/schedule_satellite.sh "NOAA 19" 137.1000
/home/pi/weather/predict/schedule_satellite.sh "NOAA 18" 137.9125
/home/pi/weather/predict/schedule_satellite.sh "NOAA 15" 137.6200

The second script, 'schedule_satellite.sh', recurses through each pass of the given satellite for the current day. It determines if the maximum elevation is 20 degrees or greater. If it is, then it calculates the length of the pass, and schedules the recording and processing of the pass. If the maximum elevation is less than 20 degrees, the pass is ignored, as it generally won't produce a decent image.

Using your favorite text editor, create a new file in ~/weather/predict named schedule_satellite.sh and put the following code in the file:

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


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

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

while [ `date --date="TZ=\"UTC\" @${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/weather/predict/receive_and_process_satellite.sh \"${1}\" $2 /home/pi/weather/${1//" "}${OUTDATE} /home/pi/weather/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/weather/predict/weather.tle -p "${1}" $nextpredict | head -1`
PREDICTION_END=`/usr/bin/predict -t /home/pi/weather/predict/weather.tle -p "${1}"  $nextpredict | tail -1`

MAXELEV=`/usr/bin/predict -t /home/pi/weather/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

When the time comes for a give pass to be recorded and processed, at kicks off the final script 'receive_and_process_satellite.sh'. When this script is called, it uses rtl_fm to receive the audio from the satellite pass, and sends that audio to sox for processing. Sox saves the audio to a file. Once the pass is complete, wxmap is called to generate an overlay map for the image. Finally, wxtoimg is called to generate the actual image and place the overlay map on it.

Using your favorite text editor, create a new file in ~/weather/predict named receive_and_process_satellite.sh and put the following code in the file:

#!/bin/bash

# $1 = Satellite Name
# $2 = Frequency
# $3 = FileName base
# $4 = TLE File
# $5 = EPOC start time
# $6 = Time to capture

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
    /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
fi

Once all three scripts have been created, we need to make the executable, by issuing the following commands:

chmod +x schedule_all.sh
chmod +x schedule_satellite.sh
chmod +x receive_and_process_satellite.sh

Now, the last step in automating the reception is to schedule the first script to run just after midnight. Run the following command:

crontab -e

It will open a text editor of your choice to edit the cron file. Simply add the following line to the bottom of this file and save:

1 0 * * * /home/pi/weather/predict/schedule_all.sh

Now, at 00:01 the schedule will start. (if you don't want to wait, simply run the following command once to kick the process off:)

/home/pi/weather/predict/schedule_all.sh

Step 5: Check Things Out

To see upcoming satellite passes that are scheduled to be processed, run the following command:

atq

Check the ~/weather directory for your results. Each pass will generate three files:

NOAA1820170105-181147-map.png  <-- Map overlay file
NOAA1820170105-181147.png      <-- The final image file
NOAA1820170105-181147.wav      <-- The raw audio file

The format of the file name is the satellite name, followed by the date (YYYYMMDD) and time (HHMMSS) of the start of the pass. There are several filters that wxtoimg can use when generating the image file. I've had different luck with different satellites and passes on each filter. Feel free to play around with wxtoimg on the original map and audio files and see what you come up with.

One thing to note, the receiver can only receive one satellite at a time. If two satellites are passing overhead at the same time, the first one to start recording will "win" and be recorded. The second recording will error out and stop.

Step 6: Some of My Results

Epilog Contest 8

Participated in the
Epilog Contest 8

41 People Made This Project!

Recommendations

  • Battery Powered Contest

    Battery Powered Contest
  • Plywood Challenge

    Plywood Challenge
  • Plastic Contest

    Plastic Contest

278 Discussions

0
ConorJoe88
ConorJoe88

Question 3 days ago

When I try to run ./schedule_all.sh I get permission denied on lines 6-9. I can get past this with sudo, but my concern is that when this is called through the crontab it will also get denied.

I did the chmod +x schedule_all.sh.

Also, when I run "atq" i don't get any results. I am guessing this is related to my permissions problem but I'm not 100% sure.

Can I just add "sudo" in my crontab file? Any other suggestions?

0
john.swails
john.swails

Answer 3 days ago

on your weather directory I would assume you created with root then. check your /home/pi/weather folder with ls -la and make sure its owned by pi
you can fix that with sudo chown -R pi /home/pi/weather


0
rauditore
rauditore

Question 5 weeks ago

Good evening. I have a question.
Did someone have problems acquiring the images?
I did all the steps given in this tutorial and the raspberry didn't send any error message, but I am receiving only noise.
Which can be the mistake?
Should I change the code in some part?
Or could it be due to a mistake in the antenna fabrication?
The antenna is a QFH, made with a coaxial cable.
Thank you in advance.
The image shown should be from NOAA 19 .

NOAA1920201020-181431.pngNOAA1920201020-181431-map.png
0
skippyinspace
skippyinspace

6 weeks ago

In my log files Im getting this error, I get maps but no clouds
Direction: northbound
..Satellite: NOAA 19
Status: signal processing............................
wxtoimg: warning: Narrow IF bandwidth (purchase upgrade key!), low S/N, or volume too high
Gain: 31.1
Channel A: 3/3B (mid infrared)
Channel B: 4 (thermal infrared)

any ideas,

0
blazer91
blazer91

2 months ago on Introduction

i@raspberrypi:~ $ /home/pi/weather/predict/schedule_all.sh
date: extra operand ‘+%D’
Try 'date --help' for more information.
/home/pi/weather/predict/schedule_satellite.sh: line 10: [: ==: unary operator expected
date: extra operand ‘+%D’
Try 'date --help' for more information.
/home/pi/weather/predict/schedule_satellite.sh: line 10: [: ==: unary operator expected
date: extra operand ‘+%D’
Try 'date --help' for more information.
/home/pi/weather/predict/schedule_satellite.sh: line 10: [: ==: unary operator expected

HELP!!!!!! This error message has got me stuck in a loop and nothing is working

0
AndreB124
AndreB124

Reply 6 weeks ago

while [ "date --date='TZ="UTC" @${var2}' +%D" == "date +%D" ]; do

0
AndreB124
AndreB124

Tip 6 weeks ago on Step 4

The bash script schedule_satellite.sh gives an error. To fix it, I changed line 10 to:

while [ "date --date='TZ="UTC" @${var2}' +%D" == "date +%D" ]; do

0
Goodwolf
Goodwolf

Question 7 weeks ago

I've gotten everything setup, but I've got a few problems. One, I'm not certain how to convert from west positive coords to east positive coords... I imagine it's just flipping it from positive to negative? My other much more serious problem is the satellite prediction inaccuracies. When tracking the iss via several websites it comes up with consistent coords, but when using predict the longitude is massively incorrect.

0
Goodwolf
Goodwolf

Answer 7 weeks ago

Here's some images showing off the disparity between the reliable web tracker and.predict

Screenshot_20201006-054335_1.pngScreenshot_20201006-054348_1.png
0
solaria137
solaria137

8 weeks ago

Here's a variation: run the signal through rtl_power/heatmap.py instead of rtl_fm/wxtoimg.

[image#1] A 2-second integration on NOAA-18, 137.910 MHz. The Doppler shift from top to bottom is about 6kHz, which gives a delta v of about 23,500 kph

[image#2] CAS-4B at 145.892MHz. The satellite beacon on the right at 145.910 MHz

[image#3] Tried to see something from ISS, but so far only this beacon at 437.800 MHz. It's the same QFH antenna, so I guess I was lucky to get anything...

20200927-110536-50-NOAA-18-137.910-heatmap.png20200926-224017-37-CAS-4B-145.892-heatmap.png20200929-145112-71-ISS-437.800-heatmap.png
0
meteorseeker
meteorseeker

Question 2 months ago

For some reason could not ssh from the Mac into the pi. But decided to just use the pi. Got the bottom trying to get wxtoimg and received an error; can not access archive'wxtoimg-armhf-2.11.1-beta.debNo such file or directory? I found the replacement file and was able to get it up using the xwxtoimg. I could not get the Chmod commands to do anything, not sure if that is important or not?
How does the program know to use the sdr? Or is it just 'on' all the time while plugged in? Still very new to the whole pi, sdr, etc stuff but trying to get it working. Any other tips or advice is alway appreciated.

2
davidaswan
davidaswan

Tip 2 months ago

After struggling to get a decent image I changed the receive_and_process_satellite.sh script by splitting the following line:

sudo timeout $6 rtl_fm -f ${2}M -s 60k -g 49.6 -p 7 -E wav -E deemp -F 9 - | sox -t raw -r 60000 -b 16 -c 1 -L -e signed-integer - $3.wav rate 11025

into three separate lines:

sudo timeout $6 rtl_fm -f ${2}M -s 60k -g 49.6 -p 0 -E deemp -F 9 raw.raw

sox -t raw -r 60000 -b 16 -c 1 -L -e signed-integer raw.raw $3.wav rate 11025

touch -r raw.raw $3.wav

The touch command copies the time stamp from the original raw file to the processed wav file.
Image results are now great, although I am seeing blank areas in the audio file showing as black lines in the image......any suggestions?!
David

NOAA1820200907-110624.png
0
retjr127
retjr127

3 months ago

Just getting started with downloading weather images. Had to try to learn the basics of linux.
I have a pi 4 /8 gbs and using a RTL-SDR v3 dongle. Been getting static on my pictures. I
purchased a Sawbird Noaa filter and that doesn't do much. I was told to put it as close to my antenna as possible. The antenna is a dipole that has been tuned to 137.000 mhz, mounted on my roof top. Just wondering what type of case other people are using to protect it from the weather.
Also where in the "schedule_satellite.sh"script can I change the "maximum elevation is less than 20 degrees" to say like 30 degrees?
Thanks for your help.
Bob Turner

0
K4DQP
K4DQP

Reply 3 months ago

My antenna is mounted outside. A short run of LMR-400 to the window, an adapter w/coax into the SDR and pi sitting in windowsill.

The code you want to change is located in the schedule_satellite.sh file. Change the following:
if [ $MAXELEV -gt 30 ]

My pictures get filled with static below 30 degrees.

0
retjr127
retjr127

Reply 3 months ago

Thank you K4DQP. I well give that a try. Look forward to anyone answering your question about the static lines, I've got them too.

0
K4DQP
K4DQP

Reply 3 months ago

Thanks. You may also want to remove the reference to fixed gain setting in the following:

was:
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

now:
sudo timeout $6 rtl_fm -f ${2}M -s 60k -p 55 -E wav -E deemp -F 9 - | sox -t wav - $3.wav rate

0
retjr127
retjr127

Reply 2 months ago

Thank you K4DQP,
I have changed the elevation to 30 and that works great, also changed the fixed gain, that also works great.
Now I notice that on the evening passes(say 6 or 7 pm) that I don't get the map overlay(map.png), all I get is clouds. Morning passes work good. I had this problem before the change in elevation and gaiin, so I don't think that has anything to do with it. Any thoughts?
Bob Turner
KK7RT

0
K4DQP
K4DQP

Reply 2 months ago

glad to see it's working better and sorry to hear you are having issues with the map. Can you post a pic of one that works and one that does not?

I don't keep the map.png file, so I can't check my results. I keep all the others.

List out the file names that you get during a pass.

0
retjr127
retjr127

Reply 2 months ago

Hope you can enlarge these. First time posting pictures.
The first is in the morning at 07:13. It has the map overlay. Elv 53.8 deg
The second is at 16.35 in the evening, no picture and no map overlay. Elv 42.2 deg
I live in AZ so there is rarely any clouds.
The third picture is a screenshot of my "receive_and_process_satellite.sh", with names of the passes that I get.
Thanks for all the help
KK7RT

NOAA1920200905-071326_HVCT.pngNOAA1920200905-183537_MCIR-PRECIP.png2020-09-06-085638_1920x1080_scrot.png