[OUTDATED] Piaware ver 6 with Adaptive Gain Control - Install it on x86_64 Machines with Ubuntu 20, Debian 10 &11, and on RPi 2, 3, 4 with Raspbian Buster (32-bit and 64-bit) and DietPi Bullseye (32-bit & 64-bit)

Piaware 6 (or latest) with Adaptive Gain Control

The scripts below have been tested to successfully built & install piaware, dump1090-fa, dump978-fa, and piaware-web on following:

(1) PC x86_64: Ubuntu 20 amd 64, Debian 10 amd64, Debian 11 amd64, Kali 2021 amd64

(2) RPi Models 2, 3 & 4: Raspbian Buster (32-bit and 64-bit)

(3) OrangePI PC: Armbian Buster

(4) Raspberry Pi Desktop for PC ( Debian Buster with Raspberry Pi Desktop)

(5) PC x86_64: Arch Linux amd64 (Click Here)

 

CAUTION: Do NOT use these scripts on Piaware SD Card image. It will break your installation.

 

IMPORTANT NOTE:

The scripts first run command to update. It may display following notice. Please say yes (press y key). It may ask this more than once, and every time say yes. If you say no, the update will not take place and installation may fail

N: Repository 'https://deb.debian.org/debian buster InRelease' changed its 'Version' value from '10.9' to '10.10'
E: Repository 'https://deb.debian.org/debian buster InRelease' changed its 'Suite' value from 'stable' to 'oldstable'
N: This must be accepted explicitly before updates for this repository can be applied. See apt-secure(8) manpage for details.
Do you want to accept these changes and continue updating from this repository? [y/N] 

 

A Useful Tip

The bash-scripts below save the source-code folder and build .deb packages in the directory from where bash-scripts are run. After running all these bash-scripts, you will see a large number of folders and built packages in that directory (usually in /home/pi/ or /home/username/).

This can be avoided and all source-code folders & built packages can be saved in a dedicated directory by first creating a dedicated directory, then moving into that directory, then running the bash-scripts from there:

sudo mkdir Flightaware  
#instead of Flightaware, you may choose
#any other name you like

Now every time you want to run any of bash-scripts, first enter the directory Flightaware (or whatever name you have chosen to create it),

cd Flightaware  

Now copy-paste the bash-script in terminal and press Enter key to run the bash-script. All source-code folders and built packages will be saved inside folder “Flightaware”.

Next time when you want to run the bash-scripts again (to rebuilt or to upgrade to a newer version), first move into folder “Flightaware”, and then run the bash-scripts from there.

 

(1) PIAWARE (latest version)

Copy-paste following script in terminal:

sudo bash -c "$(wget -O - https://raw.githubusercontent.com/abcd567a/piaware-ubuntu20-amd64/master/piaware.sh)"

(2) DUMP1090-FA (latest version)

Copy-paste following script in terminal:

sudo bash -c "$(wget -O - https://raw.githubusercontent.com/abcd567a/piaware-ubuntu20-amd64/master/dump1090-fa.sh)"

(3) piaware-web

Copy-paste following script in terminal:

sudo bash -c "$(wget -O - https://raw.githubusercontent.com/abcd567a/piaware-ubuntu20-amd64/master/install-piaware-web.sh)"

Items (4) (5) & (6) below are for USA only:

(4) DUMP978-FA (latest version)

Copy-paste following script in terminal:

sudo bash -c "$(wget -O - https://raw.githubusercontent.com/abcd567a/piaware-ubuntu20-amd64/master/dump978-fa.sh)"

(5) Serialize 2 dongles (8 digit numbers): 00001090 & 00000978

How-to Serialize Dongles for ES1090 + UAT978

(6) Configure dump1090-fa and dump978-fa to use respective serialized dongles:

Copy-paste following 4 commands in terminal:
SCROLL RIGHT TO SEE & COPY COMMANDS IN FULL
 

sudo sed -i 's/^RECEIVER_SERIAL=.*/RECEIVER_SERIAL=00001090/' /etc/default/dump1090-fa     

sudo sed -i 's/driver=rtlsdr[^ ]* /driver=rtlsdr,serial=00000978 /' /etc/default/dump978-fa     

sudo piaware-config uat-receiver-type sdr   

sudo systemctl restart piaware   

 

 

CONFIGURATION OF ADAPTIVE GAIN

7 Likes

Upgrading from Ver 5.0 to Ver 6.0

IMPORTANT NOTE: These scripts are designed to upgrade package install. Please do NOT try to upgrade piaware SD Card image using these scripts, as you will end up in a broken install.

(1) If you already have built & installed a previous version, then running scripts in first post of this thread will upgrade previous version to current version 6.0.

EDIT: Item (2) below edited as per advise of @obj

(2) If on upgrading dump1090-fa you get a notice that Adaptive Gain Control has been blocked, then manually uninstall dump1090-fa and then reinstall it

sudo dpkg --purge dump1090-fa  
sudo dpkg -i dump1090-fa_6.0_*.deb

(2) If on upgrading dump1090-fa you get a notice that Adaptive Gain Control has been blocked, then manually edit file /etc/default/dump1090-fa and edit the config if you want to enable it.

Below is the adaptive gain part of the file

# Initial receiver gain, in dB. If adaptive gain is enabled (see below) the actual gain 
# may change over time RECEIVER_GAIN=60 
# Adjust gain to try to achieve optimal dynamic range / noise floor? 
ADAPTIVE_DYNAMIC_RANGE=no 
# Target dynamic range in dB (leave blank to autoselect based on SDR type) 
ADAPTIVE_DYNAMIC_RANGE_TARGET= 
# Reduce gain when loud message bursts from nearby aircraft are seen? 
ADAPTIVE_BURST=no 
# Gain range to allow when changing gain, in dB (empty = no limit) 
ADAPTIVE_MIN_GAIN= 
ADAPTIVE_MAX_GAIN= 

(3) The configuration file /etc/default/dump1090-fa has different format than in previous versions. If using both dump1090-fa and dump978-fa, for version 6.0 configure them to use respective serialized dongles by following 2 commands:

 

sudo sed -i 's/^RECEIVER_SERIAL=.*/RECEIVER_SERIAL=00001090/' /etc/default/dump1090-fa

 

sudo sed -i 's/driver=rtlsdr[^ ]* /driver=rtlsdr,serial=00000978 /' /etc/default/dump978-fa

 

 

IMPORTANT NOTE:

The scripts first run command to update. It may display following notice. Please say yes (press y key). It may ask this more than once, and every time say yes. If you say no, the update will not take place and installation may fail

N: Repository 'https://deb.debian.org/debian buster InRelease' changed its 'Version' value from '10.9' to '10.10'
E: Repository 'https://deb.debian.org/debian buster InRelease' changed its 'Suite' value from 'stable' to 'oldstable'
N: This must be accepted explicitly before updates for this repository can be applied. See apt-secure(8) manpage for details.
Do you want to accept these changes and continue updating from this repository? [y/N] 

1 Like
1 Like

Thanks @LawrenceHill for relaying @obj 's post from ver 5.0 thread.

Thanks @obj for the advice.
Corrected my post in both threads (v 5.0 & v 6.0) to replace recommendation to purge by recommendarion to edit the config file.

Ran into an issue upgrading an SD image install from 5.0 to 6.0. I ran the commands mentioned in steps 2 and 3 in the original post of this thread. PiAware seems to complete successfully, but dump1090-fa gives the following errors:

As suggested, I ran sudo apt - - fix-broken install which results in this:

I didn’t say yes because removing piaware-release seems like a bad idea. RPi-Monitor reports that version 5.0 of dump1090-fa is still installed, so the upgrade to 6.0 was not successful.

Can anyone help me resolve this?

The scripts in this thread are designed to upgrade piaware and dump1090-fa which were package installed by user, and NOT those in piaware SD Card image.

Please do not try to upgrade piaware SD Card image by these scripts as you may end up in a broken install.

I understand that now, although that was not mentioned above. What can I do at this point to repair my installation?

I have really no idea, never encountered this situation. May be @obj can give some advise about fixing it.

As I am not aware of solution, the only thing I can tell is that you re-image your microSD card.

Sorry for that. I never realized someone can attempt to upgrade SD Card image using these scripts.

I have now added a note under upgrade heading to caution members not to attempt upgrading of piaware SD Card iimage.

Try this;

sudo apt update
sudo apt install --reinstall dump1090-fa piaware dump978-fa

Thanks for the suggestion. This is what those commands result in:

If all else fails, I’ll just re-image my SD card as @abcd567 suggested.

If all else fails and you decide to re-image, then instead of re-imaging with piaware SD Card image, reimage with Raspbery Pi OS Lite (Buster) from raspberrypi foundation, then run the scripts in first post of this thread to have fresh install of ver 6.0 of everything

1 Like

issue the following command as suggested

sudo apt --fix-broken install

That should fix the package that has an error

When I run that command, I get this:

I don’t think I want to remove piaware-release…

I think you might have to resort to reimaging then as suggested by abcd567

I’m getting status messages such as

Sep 02 15:29:42 mxdesktop dump1090-fa[29060]: rtlsdr_demod_write_reg failed with -9
Sep 02 15:29:42 mxdesktop dump1090-fa[29060]: r82xx_write: i2c wr failed=-9 reg=05 len=1
Sep 02 15:29:42 mxdesktop dump1090-fa[29060]: rtlsdr: failed to disable tuner AGC
Sep 02 15:29:43 mxdesktop dump1090-fa[29060]: adaptive: available dynamic range (38.5dB) < required 
Sep 02 15:29:43 mxdesktop dump1090-fa[29060]: adaptive: changing gain from 42.1dB (step 23) to 40.2d
Sep 02 15:29:43 mxdesktop dump1090-fa[29060]: rtlsdr_demod_write_reg failed with -9
Sep 02 15:29:43 mxdesktop dump1090-fa[29060]: r82xx_write: i2c wr failed=-9 reg=05 len=1
Sep 02 15:29:43 mxdesktop dump1090-fa[29060]: rtlsdr: failed to disable tuner AGC

What does this mean? AFAIK I didn’t enable the AGC in the first place.

My settings:

# dump1090-fa configuration
# This is sourced by /usr/share/dump1090-fa/start-dump1090-fa as a
# shellscript fragment.

# dump1090-fa won't automatically start unless ENABLED=yes
ENABLED=yes

# SDR device type. Use "none" for a net-only configuration
RECEIVER=rtlsdr
# serial number or device index of device to use (only needed if there is more than one SDR connected)
RECEIVER_SERIAL=00001000
# Initial receiver gain, in dB. If adaptive gain is enabled (see below) the actual gain
# may change over time
RECEIVER_GAIN=49.6

# Adjust gain to try to achieve optimal dynamic range / noise floor?
ADAPTIVE_DYNAMIC_RANGE=yes
# Target dynamic range in dB (leave blank to autoselect based on SDR type)
ADAPTIVE_DYNAMIC_RANGE_TARGET=49.6
# Reduce gain when loud message bursts from nearby aircraft are seen?
ADAPTIVE_BURST=yes
# Gain range to allow when changing gain, in dB (empty = no limit)
ADAPTIVE_MIN_GAIN=12.5
ADAPTIVE_MAX_GAIN=49.6

# Turn on options to reduce load on slower CPUs, at the expense of slightly worse decoder performance.
# Setting "auto" will enable these options only if the CPU appears to be a slow CPU (currently this
# means armv6 only, e.g. Pi Zero)
SLOW_CPU=auto
# Local wisdom file used to select DSP implementations; uses built-in ranking if the file is missing
WISDOM=/etc/dump1090-fa/wisdom.local

# Correct CRC errors where possible
ERROR_CORRECTION=yes

# Receiver location, used for some types of position decoding. Provide the location as
# signed decimal degrees. If not given here, dump1090 will also try to read a receiver
# location from /var/cache/piaware/location.env (written automatically by PiAware, if installed)
RECEIVER_LAT=
RECEIVER_LON=
# Maximum range, in NM. Positions more distant than this are ignored. No limit if not set.
MAX_RANGE=360

# Network ports to listen on for connections
NET_RAW_INPUT_PORTS=
NET_RAW_OUTPUT_PORTS=30002
NET_SBS_OUTPUT_PORTS=30003
NET_BEAST_INPUT_PORTS=30004,30104
NET_BEAST_OUTPUT_PORTS=30005

# Accuracy of location written to JSON output
JSON_LOCATION_ACCURACY=1

# Additional options can be added here:
EXTRA_OPTIONS=""

# If OVERRIDE_OPTIONS is set, only those options are used; all other options
# in this config file are ignored.
OVERRIDE_OPTIONS=""

# This is a marker to make it easier for scripts to identify a v6-style config file
CONFIG_STYLE=6

BTW I’m not on a Pi, I’m running dump1090-fa v.6 as a service in Debian on my PC.

Tuner AGC is turned on at the top-most gain step (previously this was “-10” gain) and turned off otherwise. dump1090 will always try to enable or disable the AGC bit in the tuner when changing the gain even if it’s not strictly necessary.

Error -9 is LIBUSB_ERROR_PIPE: the dongle signalled a USB endpoint stall in response to a control transfer. This is how USB devices signal that they can’t carry out a command. Generally this means you have hardware problems - possibly a problem on the I2C bus (the internal communication path between the RTL2832U and the R820T tuner chip) since it occurs while trying to talk to the tuner over I2C.

This is way too high. Adaptive gain will just end up turning the gain down as far as it will go if you ask it to provide 50dB of dynamic range. rtlsdrs can provide at best maybe 35-ish dB.

Ah, thanks. I wasn’t aware that 49.6 is the new -10. :slight_smile: And I have had some USB bus issues on this motherboard, particularly with the FlightAware orange dongle. I think it’s about time for a piece of Pi. :frowning:

Actually 60-ish is the new -10. 49.6 is still the highest gain with AGC disabled.

So I could put it back to the default setting of 60 and Adaptive Gain Control should be able to enable/disable AGC as needed? (BTW I resolved the USB issue for now by removing/reconnecting the dongle.)

If you don’t set an upper limit on the adaptive gain range (leave the ADAPTIVE_MAX_GAIN setting empty) then it is allowed to try the 60-ish setting, yeah.

In my experience the 60-ish setting is very noisy and usually adaptive gain will try it once then go back to 49.6