Installing goestools onto a Raspberry Pi 3 or 4

Goestools is a GOES receiver and processor Pieter Noordhuis developed for decoding HRIT into usable imagery. It is a LINUX product and was created for PI, but could (and can) be run on Ubuntu, and other Linux platforms and emulators. However, these instructions are for a PI, There are many tutorials out there, this is an edited amalgamation of mine and two others. This is the procedure that worked for me.

Setting up the Raspberry PI

Goto the Raspberry Pi site and download the latest Raspbian Lite (Currently Raspbian Buster Lite) 

Burn the Rasbian Lite image to an SDCard (I would suggest at least a 32Gb card) using Etcher or Win32Diskimager.

FOR ETHERNET if using an Ethernet cable you do not need to set up WiFi.

FOR WIFI SETUP
Configure wpa_supplicant.conf on your SDCard
Step 1: Create an empty file. You can use Notepad on Windows or Notepad++ to do so by creating a new file. Just name the file ssh. Save that empty file and save it into boot partition (microSD).
Step 2: Create another file name wpa_supplicant.conf . This time you need to write a few lines of text for this file. For this file, you need to use the FULL VERSION of wpa_supplicant.conf. Meaning you must have the 3 lines of data namely country, ctrl_interface and update_config

country=US 
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev 
update_config=1 
network={ ssid="your_real_wifi_ssid" scan_ssid=1 psk="your_real_password" key_mgmt=WPA-PSK 
}

Insert the card into the Pi.
Connect a monitor, keyboard, Ethernet cable (if your using it) and mouse to the PI then boot the Pi,
Log in with username: pi and password: raspberry, then run “

sudo raspi-config

Set up your WiFi connection with SSID and Password

Find the IP Address of the Pi with one of the two methods below:

With Monitor attached to PI, open a terminal on the Pi and find it’s IP address by using the command “ip addr” without quotes. Or,
Open your network routers’ configuration page on any PC, and search the settings for a list of connected devices. You should be able to see the Raspberry Pi listed there, with it’s IP address. Please note that router reboots, loss of power, etc. can change your PI’s IP address.

Now you should connect to your Pi from a PC on the same network using any SSH software such as PuTTy. I would recommend that you create saved sessions with PuTTy, as you might be using it a lot!

Installing Required Dependencies

All of the Following commands should be run on the Raspberry Pi.
Connect to the Raspberry Pi’s IP address, port: 2222 with SSH. Log in to the Pi with the default username/password: pi/raspberry, (or whatever username/password you use).

1. Get everything up to date

sudo apt update
sudo apt dist-upgrade

# reboot the device
sudo reboot

Note: you will have to SSH into your PI EVERYTIME you reboot!

2. Install dependencies

# get the packages necessary to build and run goestools
sudo apt install git build-essential cmake libusb-1.0 libopencv-dev libproj-dev

3. Install librtlsdr

Grab the latest librtlsdr source, compile it, and install the shared libraries/includes. This is what allows your Realtek RTL2832 based DVB dongle to work as an SDR receiver

# download, compile, and install librtlsdr
git clone https://github.com/steve-m/librtlsdr.git
cd librtlsdr
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -DINSTALL_UDEV_RULES=ON ..
sudo make -j2 install

# load udev rules and blacklist the DVB driver shipped with the OS
sudo cp ../rtl-sdr.rules /etc/udev/rules.d/
sudo ldconfig
echo 'blacklist dvb_usb_rtl28xxu' | sudo tee --append /etc/modprobe.d/blacklist-dvb_usb_rtl28xxu.conf

# reboot the device
sudo reboot

4. Test your the RTL-SDR dongle

rtl_test 

You should see something like this:

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

If it hangs, just press crtl-c to exit. It does not have to finish

If there are errors, or if the device is not recognized:

  • Reinstall the driver from Step 3
  • Ensure the dongle is secured in the USB port
  • Remove all USB hubs and plug in into the Pi directly
  • Make sure you power your Raspberry Pi with at least a 2.5A power supply
  • Check the device using lsusb command. You should see ID 0bda:2838 Realtek Semiconductor Corp. RTL2838 or something of the like listed there. If not, try the previous steps.
  • Run dmesg and check for errors such as error -71 related to the USB device. This may mean that your RTL-SDR receiver might be broken.

5. Install goestools

git clone https://github.com/pietern/goestools.git
cd goestools
git submodule init
git submodule update --recursive
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr ..

# this will take a while on a raspberry pi
sudo make -j2 install 

6. Create goesrecv.conf config

Change the sample_rate to 2000000. Higher sample rates MAY cause goesrecv to require multiple restarts in order to get a lock on the frequency. 

If you’re using an RTL-SDR V3 enable the bias tee “true” and increase the gain to 30:
sample_rate = 2000000
gain = 30
bias_tee = true

Bias Tee is not needed for the Nooelec SmarTee XTR which supplies constant bias tee power to the LNA or if you’re powering your SAWBird through the micro USB port, set bias_tee = false under [rtlsdr].

cat <<EOF > ~/goesrecv.conf
[demodulator]
mode = "hrit"
source = "rtlsdr"

[rtlsdr]
frequency = 1694100000
sample_rate = 2000000
gain = 5
bias_tee = false

[costas]
max_deviation = 200e3

[decoder.packet_publisher]
bind = "tcp://0.0.0.0:5004"
send_buffer = 1048576

[monitor]
statsd_address = "udp4://localhost:8125"
EOF

Now the tricky Part! Getting your Dish pointed at the satellite.

7. Roughly point your antenna at the satellite

setup

Remember that you are using a small dish to get signal from a satellite 23,000 miles away! Make sure your mount is STABLE, whether a tripod or verticle permanent mount keep it stable and level. I used a heavy base and a 2 inch piece of conduit for the pole. Did I say keep it stable? here is a lesson learned, I had mine set up on my back deck. got it all adjusted, and working in the cold weather, two days later my vits went way up! How? The temps increased enough that the little bit of snow/ice under my base melted, and changed the levelness of my setup!

Find where the GOES-16 or GOES-17 satellites are in the sky at your location using dishpointer.com, it will draw a line on the aerial map where to point your dish. Note the azimuth and elevation. Another great satellite location tracker is https://www.satellite-calculations.com/Satellite/lookangles.htm enter your address or coordinates and then select the satellite.

A real Compass

Use an actual real compass to point your dish at the azimuth. Even with my Note 9 I found many errors in digital compass. I have a guide on How to use a real compass here

Adjust your dish angle according to the elevation. Use your smartphone level app, or just eyeball it.

IMPORTANT: Polarization Skew

You should also adjust the skew of your dish roughly according to what Satellite Calculations says under “Skew”. For GOES-16 I did not need to change the skew at all, my skew angle was 14.5° so it really wasn’t going to improve signal much.

8. Run goesrecv and perform fine antenna adjustments

To run the software open an SSH terminal on your main PC using PuTTy. Connect to the Raspberry Pi’s IP address, port: 2222 with SSH. Log into the Pi with the default username/password: pi/raspberry. In the first terminal run the command:

goesrecv -v -i 1 -c ~/goesrecv.conf

This will show output every second that looks something like this:

Vit Averages

The vit(avg) stat shows the average viterbi error rate over 1-second interval (if running with -i 1).

If there’s no signal, the vit value should be over 2000. When signal is stronger it should decrease. If you have no discernable signal double check the antenna position again with a compass to make sure you’re pointed at the intended satellite. Make sure there is nothing blocking line of sight to the satellite.

I used RaspController app by Ettore Gallina on my NOTE9 phone to monitor the goesrecv while I physically made adjustments to the dish. This should help you point the antenna correctly. Slightly rotate the dish right or left and note whether the vit errors are increasing or decreasing.

Once you’re at the local error minimum, perform the same process to find the minimum error rate while slightly adjusting the vertical angle.

When the vit errors are at their lowest, you’ve pointed the antenna. Monitoring the bits, you might want to try and adjust your reflector in or out, or try and bending it flatter to see if it lowers your bits. Remember moving your dish, just a little can cause you to increase your bits. Even putting your hand in front of dish will cause a loss of signal.

If you can’t pinpoint the signal even after precicely adjusting the antenna, flip the dish 90 degrees and try again. (Instead of wide horizontal it would now be tall in the verticle).

9. Restart goesrecv and play around with the config parameters.

If your vit errors are under 400, and you’re observing no packet drops, you’re all set!

If the average errors are at around 1500-1800, try the following:

  • Terminate and restart goesrecv. This should allow it to readjust the gain and frequency offset to get a better read on the signal. This is done by editing the goesr.conf file.
  • Cool the Raspberry Pi and the RTL-SDR dongle. Too hot and your PI will throttle down.
  • Play around with goesrecv.conf parameters. Try adjusting the gain and sample_rate. For the NooElec XTR or other E4000 tuners, you might need to set your gain to 10 or below.

Once you decreased the error rates, but your vit is still over 400, try making very slight adjustments to the antenna again. Try adjusting the reflector in or out, and try flipping it. In each case monitor your  vit .

10. Turning packets into images

While goesrecv is running in one SSH session, start another separate SSH session, and run:

goesproc -c /usr/share/goestools/goesproc-goesr.conf -m packet  --subscribe tcp://127.0.0.1:5004

This can take a few minutes until it has received enough packets. Once goesproc receives enough packets, it will start writing images and text to the locations described in /usr/share/goestools/goesproc-goesr.conf.

Writing: /home/pi/goes/./goes16/fd/staticimage/GOES16_FD_FC_NOMAP20200527T140016Z.jpg (took 1.838s)
Writing: /home/pi/goes/./goes16/fd/NOMAP/2020-05-27/GOES16_FD_FC_NOMAP20200527T140016Z.jpg (took 1.804s)
Writing: /home/pi/goes/./goes16/fd/ch02/2020-05-27/GOES16_FD_CH02_20200527T140016Z.jpg (took 1.474s)
Writing: /home/pi/goes/./goes16/fd/fc/2020-05-27/GOES16_FD_FC_20200527T140016Z.jpg (took 1.981s)

...

Congratulations your receiving and decoding GOES!

Periodically, the code for goestools is updated. You should periodically do the distribution upgrades, and the apt package upgrades, but also go to the goestools directories and do a “sudo git pull” and then the recompile the tools periodically as well.

cd build
sudo git pull
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr ..
sudo make -j2 install

Transferring files to your PC

I use the software called Syncthing. This software allows you to synch the files on your RPI with your PC. I find it nice and simple to use.

You can choose between the “stable” (latest release) or “candidate” (earlier release candidate) tracks. The stable channel is updated usually every first Tuesday of the month.

# Add the release PGP keys:
curl -s https://syncthing.net/release-key.txt | sudo apt-key add -

# Add the "stable" channel to your APT sources:
echo "deb https://apt.syncthing.net/ syncthing stable" | sudo tee /etc/apt/sources.list.d/syncthing.list

# Update and install syncthing:
sudo apt-get update
sudo apt-get install syncthing

The candidate channel (may have bugs!) is updated with release candidate builds, usually every second Tuesday of the month. These predate the corresponding stable builds by about three weeks.

# Add the release PGP keys:
curl -s https://syncthing.net/release-key.txt | sudo apt-key add -

# Add the "candidate" channel to your APT sources:
echo "deb https://apt.syncthing.net/ syncthing candidate" | sudo tee /etc/apt/sources.list.d/syncthing.list

# Update and install syncthing:
sudo apt-get update
sudo apt-get install syncthing

Depending on your distribution, you may see an error similar to the following when running apt-get:

E: The method driver /usr/lib/apt/methods/https could not be found.
N: Is the package apt-transport-https installed?
E: Failed to fetch https://apt.syncthing.net/dists/syncthing/InRelease

If so, please install the apt-transport-https package and try again:

sudo apt-get install apt-transport-https

Syncthing is configured via a web interface, with default IP address of 127.0.0.1 (localhost). As we’re running Raspbian Lite, we don’t have a GUI and therefore can’t run a web browser on the Pi. So we’ll need to open the browser-based configuration GUI on a networked PC. To do this we need to set the IP address of the GUI to the Pi’s local network address. Edit the syncthing config, and under the <gui> entry, change the <address> value to 0.0.0.0 which will allow you to connect to the Pi’s IP Address.

sudo nano /home/pi/.config/syncthing/config.xml

Save and Exit the nano editor with CTRL+X then Y then ENTER

Run “syncthing” on the PI

On your PC web browser, navigate to http://yourPIipaddress:8384

On the PC you will be syncing files with, download the appropriate version of syncthing. There are versions for Windows, macOS, Linux, etc. after you install and run it, your browser will open with the GUI for syncthing. Click “Add Remote Device” Just let it sit for about 5 minutes or so (not sure why this takes so many minutes, but it did on mine), Within a few minutes the Raspberry PI GUI should pop up with a new device as well. Add The Device.

Within the raspberry PI GUI set the folder path to /home/pi/goes and create a label, like Goes Images, or Satellite Imagery. Go to the sharing tab and share it with your Windows PC.

Again, after a few minutes or two, the Windows GUI web interface should pop up with a “New Folder” alert. Click on “Add”, then under “Folder Path” set where you want the all the image files to be copied to. Then click on save.

After a few minutes, things should start syncing.

Autostart Goestools and Syncthing

First a word about automatically starting your RPI and goestools, etc. Work with the processes listed above, get comfortable with how they run, where the imagery is saved, and make sure everything is running BEFORE you add auto-start. Any trouble shooting should be done ahead of time!

I added the ability to have my PI automatically start all of the goestools processes and the syncthing software on boot or after a power glitch.   You can add other goesproc processes if you wish as well. be sure and match the file structure to your own set up!

By editing the rc.local file in the /etc/ directory on the PI as such:
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
printf "My IP address is %s\n" "$_IP"
fi
#
#Start Goestools
#
/usr/bin/sudo -u pi /usr/bin/screen -dmS goesrecv /usr/local/bin/goesrecv -v -i 1 -c /home/pi/goesrecv.conf
#
/usr/bin/sudo -u pi /usr/bin/screen -dmS goesproc /usr/bin/goesproc -c /usr/share/goestools/goesproc-goesr.conf -m packet --subscribe tcp://127.0.0.1:5004 --out /home/pi/goes
#
#
#Start Syncthing
#
/usr/bin/sudo -u pi /usr/bin/screen -dmS syncthing /usr/bin/syncthing
exit 0

If the ‘screen’ app is not on your PI, run

sudo apt update
sudo apt-get install screen

You can view the Processes running by /using the commands

screen -r goesrev 
or screen -r goesproc 
or, lastly 
screen -r syncthing   

To stop viewing press ‘ctrl A then D’. The processes will keep running in the background.