Raspberry Pi and SDR


rasp
Raspberry Pi 3 Model B+
The Raspberry Pi is a series of small single-board computers developed by the Raspberry Pi Foundation to promote the teaching of basic computer science in schools and in developing countries.

RTL-SDR dongles are often used on single board computers.
These small credit sized computers are powerful enough to run multiple dongles, and run various decoding programs.
Currently, the most popular of these small computers is the Raspberry Pi.

This guide shows a setup with various Radiosonde Decoding programs such as Auto-RX, DxlAPRS, RS-Decoders, Sondefinder and more SR Goodies!
If the Pi runs rtl_tcp, SpyServer or a similar server, then the RTL-SDR can then be accessed by a networked connected PC anywhere in your house, or even remotely over the internet from anywhere in the world.


Raspberry Hardware                         


Raspberry Pi...


3.5 inch TFT Lcd Touch Screen Raspberry Pi 480x320 RGB Pixels.

About 10 Euro on Ali-X , for installation use Waveshare-Driver

sdr                                 

RTL-SDR USB Adapter RTL2832U + R820T2 + 1PPM TCXO TV Tuner Stick Ontvanger Oscillator.
RTL-SDR Blog V3 R820T2 RTL2832U 1PPM TCXO SMA Software Defined Radio

            
DFM09 Modified GPS-Mouse, Wireless Keyboard and Powerbank.

 

Some extra cooling stuff.

Raspberry - Raspian Buster LXDE Install  


Install Buster preferred is Lite -->> https://downloads.raspberrypi.org/raspbian_lite/images/
Full -->>   https://downloads.raspberrypi.org/raspbian_full/images/
Unzip and burn to SD https://raspberry-projects.com/pi/pi-operating-systems/win32diskimager

Do not eject sd goto boot folder and make ssh file no contents inside, eject SD put in pi and boot.


Find out in use IP (eth connected overhere) and login with Putty

SSH 22 User: pi password: raspberry

Change to new password:
passwd

Paste in terminal for update:

sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get dist-upgrade

Install x-server and deps:

sudo apt-get install --no-install-recommends xserver-xorg xinit xserver-xorg-input-evdev -y

Install LXDE Desktop:

sudo apt-get install lxde-core lxappearance lxtask -y

Install Raspberry Stuff:
sudo apt-get install raspberrypi-ui-mods -y


Audio and Some other Programs:

sudo apt-get install pulseaudio pavucontrol preload pluma alacarte gpicview xfce4-terminal p7zip-full file-roller dialog -y

Samba:

sudo apt-get install samba samba-common-bin

sudo smbpasswd -a pi
Then set a password as prompted.
 
Enable Auto-login, Display, Expand filesystem, VNC, WiFi ect with raspi-config:
sudo raspi-config

Choose option 3: Boot Options
Choose option B1: Desktop / CLI and B4 Desktop Autologin Desktop Gui ect.



For 3"5 Display LCD, Select  5 Interface Options:
Enable P3 VNC and P4 SPI.

Setup country WiFi in 4 Localization Options.

Select 7 Advanced options, A1 Expand Filesystem

Select Finish, and reboot the pi hopefully return in Gui Desktop mode ;)

Install LCD Display:

git clone https://github.com/waveshare/LCD-show.git
cd LCD-show/
./LCD35-show 180

Pi will reboot..

Terminal for some cleanup sudo apt-get autoremove && sudo apt-get autoclean

Install RTL-SDR USB Drivers:

Open the terminal and Install the necessary tools:

sudo apt-get install git cmake build-essential libusb-1.0-0-dev

Install RTL-SDR-Blog Driver:

git clone git://github.com/happysat/rtl-sdr-blog.git
cd rtl-sdr-blog/
mkdir build
cd build
cmake ../ -DINSTALL_UDEV_RULES=ON -DDETACH_KERNEL_DRIVER=ON
make
sudo make install
sudo ldconfig
sudo cp ../rtl-sdr.rules /etc/udev/rules.d/
echo blacklist dvb_usb_rtl28xxu >> blacklist-rtl.conf
echo blacklist rtl2832 >> blacklist-rtl.conf
echo blacklist rtl2830 >> blacklist-rtl.conf
sudo cp blacklist-rtl.conf /etc/modprobe.d/

Save the file and reboot the machine.

Improvements:

rtl_tcp is significantly improved by modifying to code to use a ring buffer instead of using semaphore based locking.
The result is a tremendous performance improvement in rtl_tcp.

After the ring buffer changes rtl_tcp can handle much better and higher maximum sample rate's with less lag.
Unfortunately this patch is not included in the official upstreamed Osmocom drivers.

Dependencies

sudo apt-get install xfce4-terminal 
sudo apt-get install dialog
sudo apt-get install socat 
sudo apt-get install perl  
sudo apt-get install  sox 
sudo apt-get install gpsd gpsd-clients python-gps

Needed for: Tabbed terminal for small screens, menu scripts, pty-link virtualports, NMEA script, audio and GPS support.

GPSD Setup                                                 


In order to use gpsd with the decoder we have to disable the service.
So it can be manually started by the decoder:

sudo systemctl stop gpsd.socket
sudo systemctl disable gpsd.socket

Should you ever want to enable the default gpsd systemd service you can run these commands to restore it:
sudo systemctl enable gpsd.socket and sudo systemctl start gpsd.socket

RS-Decoder Scripts


Download Pre-Compiled Decoders

Updated compiled RS-Decoders are overhere.

Setup:

Extract RS-Decoders.tar.gz


chmod 755 -R home/pi/Radio/Radiosonde


Create new group with the groupadd command:
sudo groupadd dailout

Add user to a group with the gpasswd command:
sudo adduser pi dialout

Make permissions for COM ports:

Run ./home/pi/Radio/Radiosonde/vp1.sh so the virtual ports are accessible in /tmp for setting chown permissions.


sudo chown -R pi:pi /tmp/virtualcom0
sudo chown -R pi:pi /tmp/virtualcom1



Run shortcut from desktop, start FoxtrotGPS.

Folders and Symlinks for the Decoders, the log files go overhere:

mkdir /home/pi/log
mkdir /home/pi/tmp



/tmp is a virtual folder


Compile decoders DFM-09/RS-41:

git clone git://github.com/rs1729/RS.git
cd RS/demod/mod
gcc -Ofast -c demod_mod.c
gcc -c bch_ecc_mod.c
gcc dfm09mod.c demod_mod.o -lm -o dfm09mod
gcc rs41mod.c demod_mod.o bch_ecc_mod.o -lm -o rs41mod

Or any other you need.
You also need pos2nmea.pl (NMEA perl script) from folder RS/tools in the folder for GPS output!

It is also possible to use the NMEA output of the RS-Decoders and feed data into APRSMap via UDP.

Example of script's:

DFM06/09:

dfm.sh
#!/bin/bash
rtl_fm -p 0 -g 42.1 -M fm -F9 -s 15K -f402870000 2>/dev/null | sox -t raw -r 15k -e s -b 16 -c 1 - -r 48000 -b 8 -t wav - lowpass 2600 2>/dev/null | ./dfm09mod --dist -vv --ptu --auto 2>&1 | tee -a /home/pi/Log/dfm09_`date +%Y%m%d%H`Z.txt | ./pos2nmea.pl > /tmp/virtualcom0
exit

dfm_gps.sh

#!/bin/bash
xfce4-terminal -T vp1 -e ./vp1.sh --tab -T vp2 -e ./vp2.sh --tab -T vp3 -e ./vp3.sh --tab -T DFM -e ./dfm.sh


Gqrx DFM06/09:

dfm_gqrx.sh
 #!/bin/bash
sox -t alsa default -r 48000 -b 8 -t wav - lowpass 2600 2>/dev/null | ./dfm09mod --dist -v --ptu --auto 2>&1 | tee -a /home/pi/Log/dfm09_`date +%Y%m%d%H`Z.txt | ./pos2nmea.pl > /tmp/virtualcom0
exit

dfm_gqrx_gps.sh
xfce4-terminal -T vp1 -e ./vp1.sh --tab -T vp2 -e ./vp2.sh --tab -T vp3 -e ./vp3.sh --tab -T DFM -e ./dfm_gqrx.sh


       


RS41:

rs41.sh
#!/bin/bash
rtl_fm -p 0 -g 49.6 -M fm -F9 -s 9K -f405300000 2>/dev/null | sox -t raw -r 9k -e s -b 16 -c 1 - -r 48000 -b 8 -t wav - lowpass 2600 2>/dev/null | ./rs41mod --ecc2 --crc -vx --ptu 2>&1 | tee -a /home/pi/Log/rs41_`date +%Y%m%d%H`Z.txt | ./pos2nmea.pl > /tmp/virtualcom0
exit

rs41_gps.sh
#!/bin/sh
xfce4-terminal -T vp1 -e ./vp1.sh --tab -T vp2 -e ./vp2.sh --tab -T vp3 -e ./vp3.sh --tab -T DeBilt -e ./rs41_bilt.sh



Gqrx RS41:

rs41_gqrx.sh
#!/bin/bash
sox -t alsa default -r 48000 -b 8 -t wav - lowpass 2600 2>/dev/null | ./rs41mod --ecc2 --crc -vx --ptu 2>&1 | tee -a /home/pi/Log/rs41_`date +%Y%m%d%H`Z.txt | ./pos2nmea.pl > /tmp/virtualcom0
exit

rs41_gqrx_gps.sh
#!/bin/sh
xfce4-terminal -T vp1 -e ./vp1.sh --tab -T vp2 -e ./vp2.sh --tab -T vp3 -e ./vp3.sh --tab -T RS41 -e ./rs41_gqrx.sh





Virtual COM Ports:

vp1.sh

#!/bin/sh

echo "Creating Virtual Com Port 0 and 1"
socat -d -d pty,link=/tmp/virtualcom0,raw,echo=0 pty,link=/tmp/virtualcom1,raw,b4800,echo=0
sleep 2

vp2.sh

#!/bin/sh

echo "Start GPSD on Virtual Com Port"
sudo killall gpsd
sleep 2
gpsd -D2 -b -n -N /tmp/virtualcom1
sleep 3

vp3.sh
#!/bin/sh

echo "Start GPS Pipe on 2947"
sleep 3
gpspipe -R localhost:2947
sleep 3



Make permissions for COM ports:

Run ./vp1.sh so the virtual ports are accessible in /tmp for setting chown permissions.


sudo chown -R pi:pi /tmp/virtualcom0
sudo chown -R pi:pi /tmp/virtualcom1

As long as the socat (Terminal vp) is running, you have a pair of VPs open.

They are named virtualcom 0 and 1 so they stay static and no dev/pts/ number change.

What does it all mean.

rs41mod -h
rs41mod [options] audio.wav
options:
 -v, -vx, -vv  (info, aux, info/conf)
 -r, --raw
 -i, --invert
 --ths <x>    (peak threshold; default=0.7)
 --iq0,2,3    (IQ data)

dfm09mod -h
dfm09mod [options] audio.wav
options:
 -v, -vv
 -r, --raw
 -i, --invert
 --ecc        (Hamming ECC)
 --ths <x>    (peak threshold; default=0.6)
 --json       (JSON output)
 --ecc2 now also gives the output after each block how many bits the error correction has corrected.
 --ptu temperature Info
 --dist is like ecc, but only blocks that belong to the same frame are taken, i. if errors occur, the frame is discarded / Inversed used for DFM06/90

Foxtrot GPS


      

sudo apt-get instal foxtrotgps

Will install FoxtrotGPS v1.21 from feed.

For newer versions build from source:

Dependencies - https://www.foxtrotgps.org/build.html

Download source on FoxtrotGPS website.
 

Insert extra Maps for FoxtrotGPS.

Open FoxtrotGPS, goto Info Icon 3th screen, Map Types and select New, Insert:

http://tile.memomaps.de/tilegen/%d/%d/%d.png



For Thunderforest maps sign up free at their website to get api-key and insert it into the links below:

Example:

thunderforest_api_key = 123

https://tile.thunderforest.com/pioneer/%d/%d/%d.png?apikey=123
https://tile.thunderforest.com/cycle/%d/%d/%d.png?apikey=123
https://tile.thunderforest.com/transport/%d/%d/%d.png?apikey=123
https://tile.thunderforest.com/landscape/%d/%d/%d.png?apikey=123
https://tile.thunderforest.com/outdoors/%d/%d/%d.png?apikey=123
https://tile.thunderforest.com/transport-dark/%d/%d/%d.png?apikey=123
https://tile.thunderforest.com/spinal-map/%d/%d/%d.png?apikey=123
https://tile.thunderforest.com/neighbourhood/%d/%d/%d.png?apikey=123
https://tile.thunderforest.com/mobile-atlas/%d/%d/%d.png?apikey=123

Navit


Install Navit.

sudo apt-get install navit

It's recommended to follow this excellent guide about navit:

http://ozzmaker.com/navigating-navit-raspberry-pi/




OSD for  3.5"  480x320 resolution Display.

Put in pi/.navit folder.

Download Offline Map's:

http://maps3.navit-project.org/

Gqrx


Gqrx v2.11.5 is available on the Raspbian Buster feed.
Drivers included: Rtlsdr, Airspy, SDRPlay, HackRF, RFSpace, Funcube Dongle, Red Pitaya and SoapySDR (no plugins).

sudo apt-get install gqrx-sdr -y

After that it is possible to update Gqrx from git:

sudo apt-get install qt5-default libqt5svg5-dev libpulse-dev

For command line builds:

git clone https://github.com/csete/gqrx.git
cd gqrx/
mkdir build && cd build
cmake ..
make

Overwrite gqrx binary.
sudo cp gqrx /usr/bin
sudo chmod 755 /usr/bin/gqrx



Run volk_profile from terminal, wait for it to finish, then enjoy the performance boost.

If you are only interested in the FFT set Mode to Demod Off, this will greatly reduce the CPU load.
In most cases you can reduce the CPU load further by reducing the window size, sample rate, FFT rate and FFT size (try 2048 at 10-15 Hz).

Download Gqrx Profile for 3,5" LCD and some optimize settings.
Extract to home/pi/.config/gqrx/

Virtual Audio Setup


Some virtual audio can be setup:

Adding this line to this file ~/.config/pulse/default.pa:

load-module module-null-sink sink_name=VBCable_A sink_properties=device.description="VBCable"


Will always load the desired NULL sinks on starting the pulseaudio sound server.
Removing sinks that had been loaded by pactl or pacmd, i.e. without settings in our default.pa can most quickly done by pulseaudio -k 

This command will kill the running pulseaudio instance, to instantaneously respawn it (in a default set up) using values defined in the default.pa.


It is recommend disabling PulseAudio logging, as this seems to be a large user of CPU cycles.

Edit /etc/pulse/daemon.conf
Now find "log-level" and change it to "log-level = error".
Remove the semi-colon on the log-level line too. Save and exit.

; log-target = auto
log-level = error
; log-meta = no
You can now reload pulseaudio either by rebooting, or running "pulseaudio -k" at a command line.

     

Do not forget Gqrx Audio / PavuControl to select the Virtual audio!

librtlsdr errors and workarounds


Librtlsdr did not always play very nice with other SDR Software in Stretch.
In Buster it's a real pain in the ass, conflicting with many software...

Things get worsens because many SDR programs follow a install script which off course installs drivers or even uninstall certain rtl-sdr libraries.
Gqrx is available on Busters feed, this will also install GNURadio, Soapy drivers librtlsdr* ect ect.

This saves a lot of time and it runs smoother compared to Gqrx in Stretch.
But the libraries conflict with SondeFinder, and Qt-DAB.

Removing librtlsdr breaks gqrx..

pi@raspberrypi:~ $ sudo apt purge librtlsdr*
Reading package lists... Done
The following packages were automatically installed and are no longer required:
Ect, ect..
The following packages will be REMOVED:
gqrx-sdr* gr-osmosdr* libgnuradio-osmosdr0.1.4*
librtlsdr-dev* librtlsdr0* soapysdr0.6-module-all*
soapysdr0.6-module-rtlsdr*
 
Dirty fix screwing dpkg..

sudo dpkg --purge --force-all librtlsdr0

Open var/lib/dpkg/status

Insert:

Package: librtlsdr0
Status: install ok installed
Priority: optional
Section: libs
Installed-Size: 93
Maintainer: A. Maitland Bottoms <bottoms@debian.org>
Architecture: armhf
Multi-Arch: same
Source: rtl-sdr
Version: 0.6-1+rpt1
Depends: libc6 (>= 2.4), libusb-1.0-0 (>= 2:1.0.21)
Description: Software defined radio receiver for Realtek RTL2832U (library)
 rtl-sdr is a software defined radio (SDR) receiver software for certain
 low-cost DVB-T/DAB(+) USB dongles based on the Realtek RTL2832U chip.
 .
This package contains the shared library.
Homepage: http://sdr.osmocom.org/trac/wiki/rtl-sdr

Save it.

Apt update will complain sometimes about librtlsdr0 when updating but assumes its installed.
No wierd side affects are noticed, just ignore it Everything (SF, QT, Gqrx ect) will run fine :)



Same story for sudo apt-get remove rtl-sdr  <<-- do not do this, it will break stuff!

Rtl-sdr-blog driver overhere is compatible with all SDR programs listed on this website.

Rtl-sdr-blog driver github has a few commits about "EEPROM flag to determine if direct sampling mode should be forced ON."
Resulting in conflicts with librtlsdr which breaks everything in this Buster SDR setup, those commits are reverted in the driver listed on this website.


Auto-RX



Automatic Radiosonde Receiver Utilities.
Set of utilities ('auto_rx') based on rs1279's RS-Decoders codebase to allow automatic reception and uploading Radiosonde decoded data to HabHub and/or Radiosondy.

The following radiosonde types are supported:

Vaisala RS92, RS41, Graw DFM06/DFM09/DFM17/PS-15, Meteomodem M10, Intermet iMet-1, iMet-4, Lockheed Martin LMS6 and Meisei iMS-100.

Chasemapper is a mapping system designed specifically for chasing high-altitude weather balloons, intended to be run on Raspberry Pi's.
Accessable from a tablet or laptop computer via a web browser, providing live predictions of the balloon flight path during the flight calculated from GFS weather models.

The primary purpose of chasemapper is to provide an easy-to-use mapping interface to help you as close as possible to the landing location of a high-altitude balloon payload.
Maps can also be served up from a offline local cache, allowing use without internet connectivity.

Refer to the Wiki for Auto-RX and Chasemapper Installation.

Auto-RX is intend to run as a service when Buster starts up and scan a range of white listed Frequencies.
The Auto-RX Menu Script will provide some useful handy options to make fast actions without editing system files or any other time consuming things.

It's expected that Auto-RX with this script does NOT run as a service!



Screen #1 Startup with some device info.
Screen #2 and #3 Menu with several pre-programmed frequencies, option to insert a manual frequency or the last one used, En(dis)able APRS/HabHub upload.

 

Screen #4 Menu with clean exit on all running instants, Device info, View Station Config File and Show the GFS Prediction Model Date from Chasemapper.
Screen #5 Chasemapper running with DFM09 (Sirf/Binary mode) GPS-Mouse and offline maps from FoxtrotGPS initialized. 
Screen #6 Auto-RX Scanning the frequency awaiting signal to start decoding.



Some Chasemapper examples in 3,5" LCD Full Screen with Chromium Browser webIF port :5001
Predictor screen, Auto-RX Menu script will determine and push the Burst Alt. and Descent rate data/info to Chasemapper config based on the choice of a pre-programmed Wx-station.
As Value's can be different for each station, after the Burst Chasemapper makes it's own calculations for a accurate as possible prediction.

Auto-RX and Chasemapper Scripts.

Setup:

First install Auto-RX and Chasemapper from Github.
Make sure Chasemapper folder is inside the Auto-RX folder.
Example:/home/pi/Radio/auto_rx/chasemapper and the Predict files installed into Chasemapper folder.
And everything is setup in station.cfg and horusmapper.cfg for Chasemapper.
 
Download Auto-RX and Chasemapper Script

Unpack Auto-RX.tar.gz move files to /home/pi/Radio/auto_rx
Station.cfg info can change if Auto-RX gets updated, the script read some value's from it..
Same for Chasemapper, horusmapper.cfg only Burst and Descent Rate value's are inserted.
chmod 755 all scripts.

Put icons in /usr/share/pixmaps
GPS mouse is also loaded in the scripts, edit/change (maybe the baudrate default 9600) or comment out.

Auto-RX and Chasemapper log files are redirected via symlinks to a temp folder which runs in a virtual memory to make less SD writes as stated in fstab.
After program exit they are moved to /home/pi/Log/ for archive.



The following symlinks are needed for writing logfiles:

ln -s /home/pi/tmp/Auto-RX /home/pi/Radio/auto_rx/log
ln -s /home/pi/tmp/Auto-RX /home/pi/Radio/auto_rx/chasemapper/log_files

Start Auto-RX and Chasemapper with the shortcut on the Desktop.

DxlAPRS


DxlAPRS Chain program written by OE5DXL, it is possible to decode most types of probes used in Europe.
The data may be viewed locally on a map or passed on to APRS and / or Radiosondy Servers.
DxlAPRS can decode multiple Radiosondes simultaneously.

The following radiosonde types are supported:

Vaisala RS92, RS41, Graw DFM06/DFM09/DFM17/PS-15, Meteomodem M10.

DxlAPRS is normally started as a service when Buster starts up and begin auto scan preferred frequencies range.
DxlAPRS Menu Script will provide some useful handy options, start APRS-Map and Local GPS.

It's expected that DxlAPRS with this script does NOT run as a service!



Screen #1 Startup with some device info.
Screen #2 Menu with pre-programmed frequencies, insert a manual frequency, the last one used, edit sdr frequency List to custom, En(dis)able APRS upload, enter PPM.
Screen #3, #4 and #5 SondeUDP,  Sondemod and UDPGate will show received data, including distance of received Radiosonde.
Screen #6 GPS2APRS Tab, connected to Local GPS-Mouse to show position on APRS-Map.


In running operational mode the first tab shows the DxlAPRS SDR-Config menu with a few options:

             


During reception it's possible switching to another single or multiple Frequency or Custom Frequency list (Remove # to make active) without restarting.




DxlAPRS uses rtl_tcp for its local connection.
For the ring buffers to work rtl_tcp parameter -b Blocksize=20 is removed from the script.



UDPGate Webinterface on 127.0.0.1:14501


Download DxlAPRS

This setup is intented to run only 1 SDR.

Unpack DxlAPRS.tar.gz to move files to /home/pi/Radio/
sudo chmod 755 -R  /home/pi/Radio/DxlAPRS

Edit home/pi/Radio/dxlAPRS/config/userinfo.txt for your call, location ppm and gain value's.
And station_beacon.txt the Lat/Lon of your position.
You can copy these value's later from APRSMap from home/pi/Radio/dxlAPRS/bin/aprsmap/aprsmap.cfg when setup.

Put icons in /usr/share/pixmaps.
GPS mouse is also loaded in the scripts, edit/change home/pi/Radio/dxlAPRS/scripts/gps.sh (maybe the baudrate default 4800) or comment out.

Start DxlAPRS with the shortcut on the Desktop, this will open the screens above and APRSMap.

For APRS-Map the same thing, fill in callsign with optional SSID and QTH Location from the Online Menu.
Zoom to your QTH as far as you can 100% identify your home (zoom level <16).

Then open ONLINE - MY POSITION and point to your home.
While push and hold the SHIFT key click on your home.
The coordinates will be copied into the MY POSITION field, Just click OK to save them.

DxlAPRS log files are redirected via symlinks to a temp folder which runs in a virtual memory to make less SD writes as stated in fstab.
After program exit they are moved to /home/pi/Log/ for archive.



The following symlinks are needed for writing log files:
ln -s /home/pi/tmp/DxlAPRS /home/pi/Radio/dxlAPRS/log

Distance from the received radiosonde.

Sondeudp window shows the distance to the sonde, elevation, GPS deviation, etc.
An important feature is also the Overground feature, which must be activated extra, here we need -N, that is the height of your location.
The own coordinates -P in Maidenhead format and SRTM files.

Edit /home/pi/Radio/dxlAPRS/scripts/dxlaprs.sh

Line 299:
-N 92 \    Edit to your height of location, which you can find out overhere.

Line 300:

-P JO12XX34 \  Edit to you QTH Locator, which you can find overhere.

Line 301:

-S /home/pi -L AC=DFM09,70=DFM17 \  This is the path where WW15MGH.DAC file is (Allready set).

The Earth Gravitational Model EGM96 file (WW15MGH.DAC) is needed download and copy it to / home/pi.

Last thing is the STRM Files.

Download the strm file for your latitude.
Extract zip and place them in /home/pi/srtm1

If everything is configured correctly then such values should be visible in the comment field from APRS and in SondeUDP window.

Build DxlAPRS from source, needed Dependencies:
sudo apt-get install build-essential libx11-dev libxext-dev libpng-dev libjpeg-dev
git clone https://github.com/oe5hpm/dxlAPRS.git
cd dxlAPRS/src
make all

Pre-Build Binaries ready.
http://dxlaprs.hamspirit.at/?fbclid=IwAR0ZuXHxGyk4hw01_tfS-IzljIDKVAiOUL5e4aqUUaOVq9a-RjuSiZVMGlw

Refer for News, Tips and tricks about DXL-Toolchain Installation to:

https://sites.google.com/view/oe3jtb/tipps-und-tricks

https://sites.google.com/view/oe3jtb/aktuelles

APRS-Map


APRS-Map displays the current Radiosonde Position and your own position (off course a GPS-Mouse is required) in Maps.

 

Change start view:

Set the target area on the map.
Then click Zoom and with the Shift key pressed, left-click on this button:



The button is then called as the level (here: 11) and is used as a view at program start.
This view can also be called up with the "1" key.

In the same way, the three buttons on the right work next to it.
With Shift and click on the respective button the current view is saved, only the click (or the digit) calls up this view.

In response to these actions, there are brief messages at the top left. "View stored!" after saving and "Show One Symbol Off" after invoking a saved view.




Its possible to use other map sources, open and edit dxlAPRS\bin\aprsmap\maplist insert:

tiles_osm           zxy     png        http://tile.openstreetmap.org OSM Carto (Standard)
tiles_topo          zxy      png        http://tile.opentopomap.org  OpenTopoMap
tiles_topo2        zxy      png        http://tile.memomaps.de/tilegen OpenTopoMap2
tiles_topplus      zyx      png        http://sgx.geodatenzentrum.de/wmts_topplus_open/tile/1.0.0/web/default/WEBMERCATOR TopPlusOpen
tiles_esrisat       zyx      jpg         http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile  ArcGIS ESRI Satellite World Imagery
tiles_transport   zxy      png        http://tile.thunderforest.com/transport ?apikey=123  Thunderforest Transport (requires API key)
tiles_landscape zxy      png        http://tile.thunderforest.com/landscape ?apikey=123 Thunderforest Landscape (requires API key)
tiles_outdoors   zxy      png        http://tile.thunderforest.com/outdoors ?apikey=123 Thunderforest Outdoors (requires API key)
tiles_transport   zxy      png        http://tile.thunderforest.com/transport ?apikey=123 Thunderforest transport (requires API key)
tiles_mobile zxy png http://tile.thunderforest.com/mobile-atlas ?apikey=123 Thunderforest mobile (requires API key)
tiles_transport-dark zxy png http://tile.thunderforest.com/transport-dark ?apikey=123 Thunderforest transport-dark (requires API key)

This must be changed in dxlAPRS\bin\aprsmap\aprsmap.cfg also:

Map Names|1|tiles_topo2 0.25 78
Map Names|1|tiles_mobile 0.25 73
Map Names|1|tiles_osm 0.25 65
Map Names|1|tiles_topo 0.25 71
Map Names|1|tiles_topplus 0.25 61
Map Names|1|tiles_esrisat 0.25 98
Map Names|1|tiles_landscape 0.25 69
Map Names|1|tiles_transport 0.25 62
Map Names|1|tiles_outdoors 0.25 75
Map Names|1|tiles_transport-dark 0.25 94

The Map listed on top will be the first one to show up.

For Thunderforest maps sign up free at their website to get api-key and insert it into the links above.


   

Maps can be selected in Tools / Choose Maps, and some adjustment options in Config / Brightness.

All Maps Tiles can be saved for Offline usage.

Note's:
Aprsmap has a setting that should not be used. Config, Map Parameter, Trackfilter - Leave it unchecked.!

More about the regular functions and options from APRS-Map read the Wiki:
http://wiki.oevsv.at/index.php?title=DXL_-_APRSmap_englisch

GPS2APRS


Setup GPS:

Make sure you have the right Port number and Baudrate which the GPS is connected to:

Modified DFM GPS Script for - Binary 2 NMEA mode

dmesg | grep ttyUSB

./gps2aprs -t /dev/ttyUSB0:4800 -I CAR -i /k -D -0 30 -b 2 -v -r 127.0.0.1:9002

gps2aprs -h

 -t <tty>:<baud>            (/dev/ttyUSB0:4800)
 -I <mycall>                   Mycall with SSID like NOCALL-15
 -D                                DAO Extension on for 20cm Resolution
 -b <s>                          Driving Beacon Time in Seconds (15)
 -r <x.x.x.x:destport>      Use AXUDP (to Soundmodem)
 -v                                 Verbous-Mode
 -i                                  Ballon /O, Car /> -i /k



Goto APRS-Map Config / Rf-Ports Tab:

Check RF-Port 1 and make sure its UDP1(ip:send:listen)|1|127.0.0.1:9001:9002
And NMEA data from your local GPS-Mouse should roll in.

The Car position should be Visible and every 30 Seconds updated.
In DxlAPRS gps start script is included and runs on start in tabbed terminal.

RS-Decoder with APRS-Map.


It is also possible to use the NMEA output of the RS-Decoders and feed data into APRSMap via UDP thru the Perl pos2aprs script.
-U UDP Ip and Port.
-d generates APRS frames with DAO (and thus finer position resolution).
-i  Sonde ID E.g. i-Met.

POS2APRS:

Download pos2aprs script's.

For DFM:

rtl_fm:

rtl_fm -p 0 -g 49.6 -M fm -F9 -s 15K -f402870000 2>/dev/null | sox -t raw -r 15k -e s -b 16 -c 1 - -r 48000 -b 8 -t wav - lowpass 2600 2>/dev/null | ./dfm09mod --dist -v --ptu --auto 2>&1 | ./pos2aprs.pl RASPI 0 "Radiosonde" -d -U 127.0.0.1:9002 > /dev/null

Gqrx:

sox -t alsa default -t wav - 2>/dev/null | ./dfm09mod --dist -v --ptu --auto 2>&1 | ./pos2aprs.pl RASPI 0 "Radiosonde" -d -U 127.0.0.1:9002 > /dev/null

For RS-41:

rtl_fm:

rtl_fm -p -1 -g 49.6 -M fm -F9 -s 9K -f403500000 2>/dev/null | sox -t raw -r 9k -e s -b 16 -c 1 - -r 48000 -b 8 -t wav - lowpass 2600 2>/dev/null | ./rs41mod --ecc2 --crc -vx --ptu 2>&1 | ./pos2aprs.pl RASPI 0 "Radiosonde" -d -U 127.0.0.1:9002 > /dev/null

Gqrx:

sox -t alsa default -t wav - 2>/dev/null | ./rs41mod --ecc2 --crc -vx --ptu 2>&1 | ./pos2aprs.pl RASPI 0 "Radiosonde" -d -U 127.0.0.1:9002 > /dev/null

For i-Met4:

rtl_fm:

rtl_fm -p -1 -g 49.6 -M fm -F9 -s 9K -f403000000 2>/dev/null | sox -t raw -r 9k -e s -b 16 -c 1 - -r 48000 -b 8 -t wav - lowpass 2600 2>/dev/null | imet1rsb 2>&1 | ./pos2aprs.pl RASPI 0 "Radiosonde" i-Met4 -d -U 127.0.0.1:9002 > /dev/null

Gqrx:

sox -t alsa default -t wav - 2>/dev/null | ./imet1rsb 2>&1 | ./pos2aprs.pl RASPI 0 "Radiosonde" i-Met4 -d -U 127.0.0.1:9002 > /dev/null


The paths to the programs and the exact parameters must of course be adjusted accordingly!

Goto APRS-Map Config / Rf-Ports Tab:



Check RF-Port 1 in APRS-Map and make sure its UDP1(ip:send:listen)|1|127.0.0.1:9001:9002
And NMEA data from rs-decoder should roll in:



SondeFinder


This program can decode radiosondes: RS41, DFM, PilotSonde, iMet and M10.
Interface via touch screen, optional GPS input.



Installation instructions.

Note:

Full installer from www.om3bc.com/docs/SF/install_all.sh will overwrite RTL-SDR drivers, not recommend on Buster.
Manual install:

sudo apt-get install cmake build-essential python-pip libusb-1.0-0-dev python-numpy git pandoc sox -y
sudo pip install pyrtlsdr

sudo wget www.om3bc.com/docs/SF/sondefinder.tar.gz
tar -zxf sondefinder.tar.gz

cd Desktop
cp sondefinder.desktop /home/pi/Desktop

If the program is properly installed, a SondeFinder icon must appear on the the Desktop.



GPS Connection, use USB GPS Mouse, and set proper Baudrate 4800.

Multi-SDR Script


   

Multi-SDR is a script that bundle several SDR applications and their command line's.
Included are pre-compiled binaries: DumpVDL2, Retrogram, rtl_433, RTTY-Decoder, Multi-mon, Qt-DAB and Vortrack.

Download Binaries and Script.
 
chmod 755 the script, edit to your own needs.
Maybe not all Binaries will run without Dependencies, read github author site which dependencies are needed.

Direwolf

Dire Wolf is a software "soundcard" AX.25 packet modem/TNC and APRS encoder/decoder.
It can be used stand-alone to observe APRS traffic, as a tracker, digipeater, APRStt gateway, or Internet Gateway (IGate).
For more information, look at https://github.com/wb2osz/direwolf/blob/dev/doc/README.md

Optional Requirements:
sudo apt-get install libudev-dev libhamlib-dev libasound2-dev

git clone https://github.com/wb2osz/direwolf.git
cd direwolf
git checkout dev
mkdir build && cd build
cmake ..
make
make install
make install-conf

Examples:

RS-41 Modified APRS 70CM:

rtl_fm -p -1 -g 29.6 -f 432500000 - | direwolf -c /home/pi/Radio/Direwolf/sdr-1200bps.conf -r 24000 -D 1 -

Terrestrial APRS 2 Mtr:
 
rtl_fm -p -1 -g 29.6 -f 144800000 - | direwolf -c /home/pi/Radio/Direwolf/sdr-1200bps.conf -r 24000 -D 1 -

ISS APRS 2Mtr:
 
rtl_fm -p -1 -g 29.6 -f 145825000 - | direwolf -c /home/pi/Radio/Direwolf/sdr-1200bps.conf -r 24000 -D 1 - 

sdr-1200bps.conf:

ACHANNELS 1
ADEVICE null null
CHANNEL 0

MODEM 1200

AGWPORT 8000
KISSPORT 8001

IGFILTER m/700
IGTXLIMIT 6 10

Dump VDL2

Dumpvdl2 is a VDL Mode 2 message decoder and protocol analyzer.



./dumpvdl2 --rtlsdr 0 --gain 29.6 --correction 0 136725000 136775000 136875000 136975000 2>&1 | tee /home/pi/tmp/vdl2_`date +%Y%m%d%H`.txt

https://github.com/szpajder/dumpvdl2

FM-Transmitter


Use Raspberry Pi as FM transmitter, works on every Raspberry Pi board.

https://github.com/markondej/fm_transmitter

This project uses the general clock output to produce frequency modulated radio communication.
The radiofrequency signal is emitted on GPIO 4 (pin 7 on header P1).

How to use it
To use this project You will have to build executable.
First, clone this repository, then use "make" command as shown below:

git clone https://github.com/markondej/fm_transmitter
cd fm_transmitter
make

After successful build You can start transmitting by executing "fm_transmitter" program:

sudo ./fm_transmitter -f 88.9 acoustic_guitar_duet.wav

sox -t alsa default -r 48000 -c 1 -b 16 -t wav - | sudo ./fm_transmitter -f 88.9 -


Connect 20 - 40 cm plain wire to Raspberry Pi's GPIO 4, means Pin 7 of the GPIO header (header P1).
This acts as the antenna.
The optimal length of the wire depends the frequency you want to transmit, but it works with a few centimeters for local testing.


Pinout of the Pi:

sudo apt-get install python3-gpiozero python-gpiozero -y



Terminal: type pinout

HeatMap

Heatmap:



rtl-gopow, Render tables from rtl_power to a nice heat map.



rtl_power -f 400M:450M:8k -p 0 -g 29.6 -i 10 -e 60m -d 0 > /home/pi/tmp/$(date +%Y-%m-%d_%H-%M)_400-450MHz_8k.csv
./gopow -i /home/pi/tmp/*.csv

This will perform a scan over the frequency range of 400-450MHz range 5kHz in 60 minutes  -e 1h / 60m
-p =ppm -g = gain -i = interval -e = duration -d = dongle

./gopow -i *.csv

https://github.com/dhogborg/rtl-gopow

Multimon


Multimon-ng is the successor of multimon and decodes the following digital transmission modes:
POCSAG, FLEX, AFSK, DTMF, MORSE CW and many more.

        

    


Example AX-25, Flex, Pocsag and Morse:

rtl_fm -p -1 -g 29.6 -f 432500000 -s 22050 - | multimon-ng -a AFSK1200 -t raw /dev/stdin 2>&1 | tee /home/pi/tmp/ax25_`date +%Y%m%d%H`.txt

rtl_fm -f 169.65M -M fm -s 22050 -p 0 -g 29.6 | multimon-ng -a FLEX -t raw /dev/stdin 2>&1 | tee /home/pi/tmp/C2000_`date +%Y%m%d%H`.txt

rtl_fm -p 0 -g 29.6 -f 172.45M -s 22050 - | multimon-ng -a POCSAG1200 -t raw /dev/stdin 2>&1 | tee /home/pi/tmp/POCSAG_`date +%Y%m%d%H`.txt

rtl_fm -M usb -p 0 -g 29.6 -f 432650000 -s 22050 - | multimon-ng -a MORSE_CW -t raw /dev/stdin 2>&1 | tee /home/pi/tmp/CW_`date +%Y%m%d%H`.txt

git clone https://github.com/EliasOenal/multimon-ng.git
cd multimon-ng
mkdir build && cd build
cmake ..
make

Qt-DAB

Very good DAB Receiver, all info overhere.

        

Selecting upmix as audio source did work on the audio jack of the Pi.            

       

Appimage from Stretch do not work on Buster, so build from source:

sudo apt-get update
sudo apt-get install git cmake qt5-qmake build-essential g++ libsndfile1-dev qt5-default libfftw3-dev portaudio19-dev
sudo apt-get install libfaad-dev zlib1g-dev rtl-sdr libusb-1.0-0-dev mesa-common-dev libgl1-mesa-dev libqt5opengl5-dev libsamplerate0-dev libqwt-qt5-dev qtbase5-dev

git clone https://github.com/JvanKatwijk/qt-dab.git
cd qt-dab
You can select which devices will have support for Qt-DAB in qt-dab.pro file.
qmake qt-dab.pro
make

cd linux-bin
mv qt-dab* qt-dab
sudo cp qt-dab /usr/local/bin
sudo chmod 755 /usr/local/bin/qt-dab

qt-dab in terminal to run.

Shortcut:

Qt-DAB.desktop

[Desktop Entry]
Name=Qt-DAB
Exec=qt-dab
Terminal=false
Type=Application
Icon=/usr/share/pixmaps/qt-dab.png
Categories=GTK;Utility;

Download pre-compiled Qt-DAB Binary

For Qt-DAB Binary only:
sudo apt-get install libfaad-dev -y

Retrogram

Retrogram, Spectrum analyzer on your terminal/ssh console with ASCII art ~ RTLSDR



Example:
retrogram --rate 1.4e6 --freq 403.5e6 --step 1e5 --gain 32

* Center Frequency     using keys [f-F]
* Sampling rate        using keys [r-R]
* Gain                using keys [g-G]
* Reference level      using keys [l-L]
* Dynamic Range        using keys [d-D]
* Frame rate           using keys [s-S]
* Tuning step           using keys [t-T]
* Hide/Show Controls     using keys [c-C]
* Quit program        using keys [q-Q]

https://github.com/r4d10n/retrogram-rtlsdr           

RTL_433

RTL_433, Program to decode traffic from Devices that are broadcasting on 433.9 MHz like temperature sensors.



Example:
rtl_433 -G -p 0 -g 29.6 -f 433956000 -f 433948000 -f 434035000 -f 433960000 -f 433972000 -f 433912000 -f 433875000 -f 433920000 -f 433947000 -f 433757000 -H 20 2>&1 | tee /home/pi/tmp/433_`date +%Y%m%d%H`.txt

https://github.com/merbanan/rtl_433

rtl_tcp and Spyserver

rtl_tcp, Spyserver and USB-Reset Menu.



Option #1 starts a rtl_tcp instance.



Option #2 Starts Spyserver.

Download SPY Server – SDR Server for 32bit ARM boards.

Airspy R0, R2, Mini, Airspy HF+ and RTL-SDR can be used as a high performance SDR receiver capable of streaming separate chunks of the spectrum to multiple clients over the LAN or the Internet.
This build can be used with Raspberry Pi.

Option #3 Does Reset the SDR device when it hangs, so you do not need to reboot.

Check ID and Device index in script to match yours with lsusb command in terminal.
Also change in rtl_tcp.sh your IP-adres it currently set to rtl_tcp -a 127.0.0.1 which does not work on outside connections..!

Download rtl_tcp and Spyserver script

RTTY-Decoder

RTTY Decoder



This program expects 16-bit, signed, single-channel audio samples on stdin and outputs the decoded text to stdout.
Debug messages are output to stderr.

Usage: ./rtty <sample rate> <carrier frequency> <baud rate> <deviation>

Examples:
./rtty 48000 1000 45 170 can be used for amateur RTTY transmissions, while
./rtty 48000 1000 50 -450 would be useful for demodulating Deutscher Wetterdienst's RTTY broadcasts.
rtl_fm -M usb -p 0 -g 49.6 -f 432800000 -s 48000 - | ./rtty 48000 1400 75 570 /dev/stdin  would decode Hab Amateur RTTY broadcasts.

Compile with: gcc -O2 -Wall -Wextra rtty.c -o rtty -lm

https://gitlab.com/snippets/1812596

Vor-Track

Vortrack
A simple VOR receiver git the radial in degree from the VOR.



Example:
vortrack -p 0 -g 29.6 109.25

https://github.com/TLeconte/vortrack

RaspAP


A simple, responsive web interface to control wifi, hostapd and related services on the Raspberry Pi.
Used to set the Pi as a WiFi Access-point for clients connecting to various WebInterfaces E.g Auto-RX, Chasemapper, DxlAPRS and RPi-Monitor.



Install RaspAP
 
Update RaspAP - https://github.com/billz/raspap-webgui/wiki/FAQs#upgrade

Configure alternate port for RaspAP's web service:
Edit /etc/lighttpd/lighttpd.conf and change the following line:
server.port                 = 8080

sudo systemctl restart lighttpd.service

RPi-Monitor



RPI-Monitor, looks abandon project but works in Buster after a few tweaks:

sudo apt-get install dirmngr
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 2C0D3C0F
sudo wget http://goo.gl/vewCLL -O /etc/apt/sources.list.d/rpimonitor.list
sudo apt-get update
sudo apt-get install rpimonitor
sudo /etc/init.d/rpimonitor update


Remove RPi-Monitor repository:
Remove PPAs by deleting the .list files from /etc/apt/sources.list.d directory.
sudo apt-key list

Find RPI-Monitor PPA name and key and remove it:
It is the last 8 characters of the long hex.

sudo apt-key del <key>

Edit the file /etc/rpimonitor/template/network.conf

a. Comment those lines you want to left out (eg "To activate network monitoring ..." by inserting a # in front of the line.
b. Comment out those lines you want to view (eg "web.status.1.content.8.line.1="Ethernet Sent... ") by deleting the # in front of the line.

Restart the service by executing the following command:
sudo service rpimonitor restart

After reboot RPI-Monitor will not work on Buster fix:
To add the delay to the startup script, edit rpimonitor (sudo nano /etc/init.d/rpimonitor).

Add the instruction "sleep 10" immediately before the "start" instruction in the case structure at the end of the program.
This will be immediately after line 93 in the current release.
 
After editing, the section should look like this:

case "$1" in
    start)
        sleep 10
        start

Tweaks


Faster Startup:
Open Raspberry Pi Configuration



Uncheck wait network.

Open Folder As Root in Pcmanfm Filemanger:



Download Open Folder as Root File.

gksu package no longer available on the Buster feed.

There is a workarround but very dirty..
It has no wierd side affects ;)

Swap buster for stretch repository from sources.list in /etc/apt.
Updated the cache, sudo apt-get update && sudo apt-get install gksu -y

After installing gksu swap stretch for buster back in sources.list to avoid future problems of wrong versions being incorporated.
And sudo apt-get update after that.


Disable Bluetooth:

To completely disable the onboard Bluetooth from the firmware on the Pi3, add /boot/config.txt

dtoverlay=pi3-disable-bt
dtoverlay=pi3-disable-wifi  <-- Needed do not insert, Example.

64MB Video Memory:
Add to /boot/config.txt or thru Raspberry Pi Configuration:
gpu_mem=64

Update from Terminal:

#!/bin/bash
sudo apt update && sudo apt upgrade && sudo apt-get autoclean
Save as update in pi/.local/bin

Less Read and Writes on SD Card


These lines can all be added to /etc/fstab.
Note the use of the size= condition, which limits how much space each temporary folder should take up.


tmpfs /tmp tmpfs defaults,noatime,nosuid,size=256m 0 0
tmpfs /var/tmp tmpfs defaults,noatime,nosuid,mode=0755,size=256m 0 0
#System temp folder.
tmpfs /var/log tmpfs defaults,noatime,nosuid,mode=0755,size=100m 0 0
#System log folder
tmpfs /var/spool/mqueue tmpfs defaults,noatime,nosuid,mode=0755,gid=12,size=30m 0 0
#Spool
tmpfs /var/cache/apt/archives tmpfs defaults,noexec,nosuid,nodev,mode=0755,size=200m 0 0
#Apt cache
tmpfs /home/pi/tmp tmpfs defaults,noatime,nosuid,size=100m 0 0
# Need for Auto-RX, DxlAPRS and RS-Decoders.

Using tmpfs means that youll be using RAM instead of the SD card.
This will reduce the amount of writes in the SD card it will also increase the memory usage, take this into account.

Files located in /tmp should be temporary and not permanent.
These files are all deleted when your Raspberry PI restarts,
So anything you need to keep or persist across reboots shouldn't be stored in RAM.


After inserting for example:
tmpfs /home/pi/tmp tmpfs defaults,noatime,nosuid,size=100m 0 0
In /ect/fstab after reboot the tmp folder is accessible in the filemanager.



Auto-RX and Chasemapper log files are redirected via symlinks to a temp folder which runs in a virtual memory to make less SD writes as stated in fstab.
After program exit they are moved to /home/pi/Log/ for archive.


After saving, restart your Raspberry Pi.
This will mount the virtual file system, ready for use.

RS-Decoders Download includes a "clean-up" script for old log files:



Older Chromium Browser:

Install older Chromium due screen resolutions with small LCD.

Newer versions do not fit properly.

sudo apt-get install gdebi

wget https://archive.raspberrypi.org/debian/pool/main/c/chromium-browser/chromium-browser_65.0.3325.181-0+rpt4_armhf.deb
wget https://archive.raspberrypi.org/debian/pool/main/c/chromium-browser/chromium-codecs-ffmpeg-extra_65.0.3325.181-0+rpt4_armhf.deb

sudo gdebi chromium-browser_65.0.3325.181-0+rpt4_armhf.deb
sudo gdebi chromium-codecs-ffmpeg-extra_65.0.3325.181-0+rpt4_armhf.deb

Avoid auto updating:

sudo apt-mark hold chromium-browser
sudo apt-mark hold chromium-codecs-ffmpeg-extra

Annoyances:

Desktop icons asking permission to execute shortcuts.


Open pcmanfm go to Edit/Preferences/General, Check box for "Don't ask options on launch executable file" ref


xfce4-terminal dementia to remember closed tabs even if told so:

edit /home/pi/.config/xfce4/terminal/terminalrc change MiscConfirmClose=FALSE


Change rtl-sdr device serial number::

rtl_eeprom -s 00000003
#Found 1 device(s):
#  0:  Realtek, RTL2838UHIDIR, SN: 00000001
#Write new configuration to device [y/n]? y
#Configuration successfully written.
#Please replug the device for changes to take effect.

rtl_test
#Found 1 device(s):
#  0:  Realtek, RTL2838UHIDIR, SN: 00000003

WARNING: If running multiple RTLSDRs, do not use serial numbers 0, 1, or '00000001'.
This can lead to rtl_test getting confused and trying to test incorrect SDRs, leading to odd behaviour.
It is strongly suggested you program your RTLSDR serial numbers to '00000002', '00000003', etc...

rtl_eeprom -h
Usage:
    [-d device_index (default: 0)]
    [-s <str> set serial number string]
    [-h display this help text]

Backup Script's


PiShrink


PiShrink is a bash script that automatically shrink a pi image that will then resize to the max size of the SD card on boot.
This will make putting the image back onto the SD card faster and the shrunk images will compress better.



https://github.com/Drewsif/PiShrink

wget https://raw.githubusercontent.com/Drewsif/PiShrink/master/pishrink.sh
chmod +x pishrink.sh
sudo mv pishrink.sh /usr/local/bin

Example:
sudo pishrink.sh pi.img

Mount Raspberry Pi image:



Edit backup img files from Raspberry Pi.
./mount_pi.sh

This creates a temp-dir for you, auto-assigns the next loop-device and sets it up for you as p1 and p2 partition devices, and mounts boot and root.
The cleanup part is in an exit-trap, so if something fails you won't have dangling mounts/files.

Download script.