FlightAware Discussions

Gain Adjustment


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.



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

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)



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.


you need do restart dump1090-fa or the gain doesn’t actually change

systemctl restart dump1090-fa


Yes, I restart dump1090-fa each time.


changing between 20 and 40 you should see a change.
try 1 then.

how are you changing gain?

you need to use

sudo piaware-config rtlsdr-gain 10

you need a sudo for the dump1090-fa restart as well (or it will show you an error)

this command will show you the current gain dump1090-fa was started with:

journalctl -u dump1090-fa -e --no-pager


That works only for the case that he has flashed the SD card image from FA.
If he installed Piaware and dump1090-fa as add-on (via commands), then the gain needs to be changed directly:

sudo nano /etc/default/dump1090-fa

Followed by
sudo systemctl restart dump1090-fa

And the check:
sudo systemctl status dump1090-fa -l