Gain Adjustment

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
# RECEIVER CONFIGURATION
#

# 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.

@w7psk

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

sudo ./optimize-gain.py

.
(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 ./optimize-gain.py
test 1 of 5
gain= 49.6 messages= 17257 positions= 1230 planes= 66
gain= 48.0 messages= 18778 positions= 1421 planes= 72
.......
.......

EDIT:

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

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

abcd567

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.

Hi guys,

Just upgraded to the RTL-SDR 3 dongle.
Removed the fA filter, as my Hab amp is already filtered.
Reporting c80 birds.

Adjusted optimize-gain.py to include all recognised gain settings (0.0…).

Running it for 20 cycles of 20 seconds per setting.

Stopped dump1090 mutability manually.

Oddly, the per gain reports (while it’s running) all show

Messages = positions= 0 planes=2

at each gain setting?

pi@orangepipc:~$ sudo service dump1090-mutability stop
pi@orangepipc:~$ sudo nano ./optimize-gain.py
pi@orangepipc:~$ sudo ./optimize-gain.py
test 1 of 20
[ ok ] Restarting dump1090-mutability (via systemctl): dump1090-mutability.service.
gain= 49.6 messages= 902 positions= 0 planes= 2
[ ok ] Restarting dump1090-mutability (via systemctl): dump1090-mutability.service.
gain= 48.0 messages= 919 positions= 0 planes= 2
[ ok ] Restarting dump1090-mutability (via systemctl): dump1090-mutability.service.
gain= 44.5 messages= 933 positions= 0 planes= 2
[ ok ] Restarting dump1090-mutability (via systemctl): dump1090-mutability.service.
gain= 43.9 messages= 891 positions= 0 planes= 2
[ ok ] Restarting dump1090-mutability (via systemctl): dump1090-mutability.service.
gain= 43.4 messages= 813 positions= 0 planes= 2
[ ok ] Restarting dump1090-mutability (via systemctl): dump1090-mutability.service.
gain= 42.1 messages= 809 positions= 0 planes= 2
[ ok ] Restarting dump1090-mutability (via systemctl): dump1090-mutability.service.
gain= 40.2 messages= 838 positions= 0 planes= 2
[ ok ] Restarting dump1090-mutability (via systemctl): dump1090-mutability.service.
gain= 38.6 messages= 784 positions= 0 planes= 2
[ ok ] Restarting dump1090-mutability (via systemctl): dump1090-mutability.service.
gain= 37.2 messages= 802 positions= 0 planes= 2
[ ok ] Restarting dump1090-mutability (via systemctl): dump1090-mutability.service.
gain= 36.4 messages= 746 positions= 0 planes= 2
[ ok ] Restarting dump1090-mutability (via systemctl): dump1090-mutability.service.
gain= 33.8 messages= 784 positions= 0 planes= 2
[ ok ] Restarting dump1090-mutability (via systemctl): dump1090-mutability.service.
gain= 32.8 messages= 821 positions= 0 planes= 2
[ ok ] Restarting dump1090-mutability (via systemctl): dump1090-mutability.service.
gain= 29.7 messages= 752 positions= 0 planes= 2
[ ok ] Restarting dump1090-mutability (via systemctl): dump1090-mutability.service.
gain= 28.0 messages= 737 positions= 0 planes= 2
[ ok ] Restarting dump1090-mutability (via systemctl): dump1090-mutability.service.
gain= 25.4 messages= 693 positions= 0 planes= 2
[ ok ] Restarting dump1090-mutability (via systemctl): dump1090-mutability.service.
gain= 22.9 messages= 647 positions= 0 planes= 2
[ ok ] Restarting dump1090-mutability (via systemctl): dump1090-mutability.service.
gain= 20.7 messages= 663 positions= 0 planes= 2

Reset to the original range of gains from the script - still the same - positions=0, planes=2

Strange…

You could also try lower gain settings.

yup - just had the optimize-gain.py script testing the full range…

available gain settings are 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

, script reports positions=0 planes=2 at all gains, although showing a realistic number of messages… not sure whats going on there.

Live map shows c80 planes.

some gain optimization scripts delete - inadvertently - the dump1090-mutability in /etc/default, happened to me in the past
what is the output from sudo cat /etc/default/dump1090-mutability ?
should be a file with many lines.

After 5 runs we get the totals and I would expect the cumulative sum for messages, positions and airplanes.
It seems that the airplanes are calculated differently because they don’t add up as they should, why?

I’m having trouble obtaining & deploying the optimize-gain-piaware3.py script.I am running PiAware 3.6.3 on an SD card, with a FA Pro stick.

When I type in

wget https://raw.githubusercontent.com/wittrup/piawarebash/master/pyh/optimize-gain-piaware3.py

I get “Cannot write to ‘optimize-gain-piaware3.py’ (Permission denied).”

I’m a real newb when it comes to all this - can someone help point me in the right direction so I can try to determining the optimum gain for my setup?

you are in a folder where you don’t have write permission.

use

cd

to get back to the home directory you should have write permissions there.
then run the wget command again and follow the instructions.

i don’t particularly like the gain script.
i would use the tabular display of your local map
Screenshot%20from%202018-11-09%2022-38-21

Sort the planes by RSSI by clicking on the column head (twice or until it’s sorted with values closer to 0 at the top)
The closer to 0 a value is the stronger the signal.

Make sure not too many have a value > -3

If you have no planes > -6 or so just go ahead and increase the gain.

Now if you have sometimes low traffic coming close by (general aviation for example)
their signal might become too strong.

So if on the map you use the button “show all track” and some low level tracks are interrupted near the receiver that’s a good hint that your gain was too high to receive them.
(assuming they didn’t duck behind a hill or something)

@mblacklin

looking at your stats and assuming you have been running with gain -10 until now.

pretty sure -10 is the best setting for you already.

Which antenna are you using and is it indoors?

I’m using the 26” FA antenna, mounted outside, about 12’ off the ground.

you are close to an airport. that’s always complicated.
also it could be that weaker signals from further away are being drowned in cell phone noise.

anyways what’s your current gain and why don’t you make a screenshot of the table i mentioned?

what also is a consideration are there hills around you that are higher than your position?
or buildings?
i mean in all directions most people will have hills in some directions :wink:

Here’s a snippet of what I’ve got. Values run all the way to -30. Gain is currently set to 20. I had it at 40, without much change.