Gain Adjustment


working like a champ, Busy time now so see what results I get. Plus I can just leave the window open as Ill be gone for hour or two :slight_smile:

So far it 48 still leads the way :slight_smile:

what really surprised me is I had power supply issues that took time to trouble shoot. One step I had performed is re-imaged the memory card. I didnt change the gain settins and had been running default -10 and so far that is showing the worst performance of the gain settings.


after running the script and making changes in /boot/piaware-config.txt, my receive hits drop to 2, any ideas why this would be ??? gain is currently set @ -10 in this file but a change to -44 has the above result.


This script was unstable on my device, causing me to have no way to get a complete test result. I currently use the -10 setting.


A negetive (-) value of gain results in gain set to zero. Only positive values between 0 and 49.6 are accepted by dongle.

The -10 gain value is the only negetive value accepted by dongle and is a special value. It does NOT set gain to -10. It switches the dongle to AGC mode (Automatic Gain Control mode).

Use gain setting 44 without minus sign.


Doh, what a fool.


Am I missing something? Instead of using the SUDO method of changing data, is it possible to do the same thing directly on the SD card for PiAware?


Yes, it is possible to change gain (and also other configurations) without console command (SUDO method as you have said), but only if you have burned your microSD card with Piaware SD card image. Even in this case, it is more difficult than console command.

  1. Shut down your PI
  2. Slip out microSD card and slip into card reader of your Desktop / Laptop
  3. Double click on the drive letter of microSD card to open it
  4. In the folder opened you will find a file named piaware-config.txt
  5. Open this file, scroll down till you see this text

# For a complete list of receiver types and their associated settings,
# see the Advanced Configuration page linked at the top of this file.

# For a receiver type of 'rtlsdr', this setting controls the dongle gain.
# -10 means AGC / maximum gain; other values mean a gain value in dB.
rtlsdr-gain -10

  1. In line starting with rtlsdr-gain, change -10 to the value you want to set for gain.

  2. Slip microSD card into Pi and power up.


Thanks for the answer!
Is it possible to set on the SD card all other settings available with the SUDO method?


Yes, all these listed on this page.

If any configuration is not already available in file piaware-config.txt, scroll down the file and add a line with required config entry at the bottom of file.


Thanks a lot abcd567!


Has anyone tried this on the new stretch version of flightaware?

I keep getting errors.



(1) you should use sudo to run the script. Without sudo it may give error message.

sudo ./

(2) If using sudo does not solve your problem, then copy-paste applicable script from this post:

Copy-Paste Gain Optimization Scripts From Here (4 versions for 4 different types of installs)


I have just now run script #3 on Raspbian Stretch with dump1090-mutability, and it is working fine.

pi@raspberrypi:~ $ sudo ./
test 1 of 5
gain= 49.6 messages= 17257 positions= 1230 planes= 66
gain= 48.0 messages= 18778 positions= 1421 planes= 72


Tested script # 1 on Piaware SD Card image 3.6.2 (which is Stretch), works ok.

pi@piaware:~ $ sudo ./
test 1 of 5
gain= 49.6 messages= 15376 positions= 1379 planes= 65
gain= 48.0 messages= 15609 positions= 1392 planes= 65



Looks like I got some bad code somewhere. That one works well. Checked back to command history and I did use sudo …
Seems to be running now with the one you just posted.