I successfully ran the test but when it finished it seemed to leave it on 20.7 and so I was seeing almost no aircraft.
I can’t [quickly] find the commands to reset the gain back to default (auto gain I think??), so I started the test again and ctrl+c to stop it. Range appears to be back to normal.
Any advice on how to check what gain setting it is on? I’d search more before asking but I’m in the middle of building myself a new antenna.
<edit.
Nevermind, I found it and set it to “-10” for now.
(1) The default value of gain is -10, as you have already discovered.
(2) How and where to set gain is as follows:
Piaware SD card image:
To see gain setting:
sudo piaware-config -show rtlsdr-gain
To set gain to a value x:
sudo piaware-config rtlsdr-gain x
Raspbian image + dump1090-fa
sudo nano /etc/default/dump1090-fa
Gain is in the line which starts with “RECEIVER OPTIONS”. Read/change value of gain.
Raspbian image + dump1090-mutability
sudo nano /etc/default/dump1090-mutability
Gain is in the line which starts with “RECEIVER OPTIONS”. Read/change value of gain.
I’m on Raspbian + dump1090-fa. I checked and found it had reset again to 49.6. Where ever the gain test script finishes seems to be where it leaves the gain setting.
I have set it again for -10 for now. It seems to be pretty close to the best setting for my setup but I may run the gain test again soon. I just put my new antenna up so I’ll gather some comparison data first.
Are these changes that can be made remotely, perhaps via the FA “My ADSB” page? Or do they need to be made by physically accessing the RPi or its SD Card?
I recently made a structural change to my setup. More specifically, switching from a 25 foot cable to a 5 foot cable of the same type in order to reduce feedline loss, and mounting the RPi/ProStickPlus onto my homebrewed antenna mast. My results have not been quite as expected though, and after reading some posts today, I’m wondering if a gain adjustment could help.
Only trouble is it is now much harder to physically access the RPi to make such a change, so I was hoping there might be a way to do so remotely.
(1) Gain adjustments can NOT be made from FA “My ADSB” page.
(2) Gain adjustments can be made remotely provided:
The computer/tablet/phone from which the commands are given is on the same Local network as the Pi.
SSH has been enabled by creating a file SSH in /boot directory of microSD card. To do this, you have to shutdown Pi, take out microSD card from Pi, slip the microSD card in card reader/adapter, and plug into desktop/laptop. After creating the file SSH, take out microSD card from laptop/desktop, slip into Pi and power up. SSH will be enabled. Click Here for details. Scroll to item “5(a) To enable SSH”
Unfortunately, to enable remote access by SSH, you need to access Pi twice, first to remove microSD card, then after creating file SSH, again access the Pi to slip in the microSD card.
Thank you very much for your reply! I may actually have made the SSH file for the SD Card when I initially set the system up last year, I wish I could remember. I see lots of great information in the link you sent, so I will try and connect remotely and see what happens. At the moment it is asking me for user id/password credentials (which I don’t ever remember setting up in the first place) so I cannot get in yet.
I performed the check and it showed my gain to be -10, which from what I have read would be the AGC setting. I’ll use your links and read up on how exactly to run the diagnostic tests and get it all optimized. Thanks again for all your help!
Greetings, I am just now reviewing this thread, curious how gain/agc was handled in the latest piaware. I’m a new user, noticed signal levels are reported as dBFS, meaning with respect to the max level given the current gain setting. The big ones are as high as -1.7dBFS, (not much room left), so I wondered. Since this thread is old, to help anyone else new with the latest installation (I am up to date today), I tried the query given above (sudo piaware-config -show rtlsdr-gain) (thanks!), and it reports -10, so I am happy to see this means AGC is running, which hopefully is the best way to go.
These dongles are originally TV receiver, so AGC finds the best gain value for a permanent signal. ADSB however, consists of many different short messages, so AGC ends up setting gain to the highest possible value, which incidentially is even higher than the max gain you can set manually.
Hmmm. I don’t have time at the moment to go research how the AGC setting is
implemented, but agree that it needs to be matched to the application. I
assumed this setting was affecting the behavior of either the piaware or
dump software, which is only used for this application. Strictly speaking,
AGC just means that some automatic software is running as a dynamic control
loop to constantly adjust the gain according to the current conditions,
which should generally be better than trying to set one fixed gain value
and leave it there. In this case AGC can have access to the effect of gain
on the message rate, dBFS signal levels, possibly errors in the decoded
data, etc. Hard to believe it doesn’t apply here as the best solution, but
it of course needs proper implementation, and that’s tricky!
The gain of the RTL dongles have a setting from 0 to 50. A quirk in the hardware is that the gain is higher with AGC on (gain set to -10) and effectively you gain a few more dB, This is equivalent to setting a gain of 53 or so. You aren’t talking a whole lot better but it is noticeable over days on most sites.
If you are in a low noise area you can improve your range by turning the gain down. Another quirk of the dongles.
You probably should try different settings to see the optimal gain setting.
Important: There should be a comma before and afterdefault=“-v”
Save (Ctrl+o) and close file (Ctrl+x)
Give following command pi@piaware:~$ ./optimize-gain-piaware3.py
You will see following output
#########################################################################
Tue Jan 16 07:59:53 UTC 2018 Starting with gain 48.0 and arguments Namespace(config='/boot/piaware-config.txt', delim='\t', dryrun=False, gains='-10 36.4 38.6 40.2 42.1 44.5 48.0 49.6', gainstr='rtlsdr-gain', port=30003, server='localhost', testsnum=5, testtime=62, verbose='-v')
GAIN MSG POS ADR TIME Test 1 of 5
Set rtlsdr-gain to 49.6 in /boot/piaware-config.txt:60
.
Wait for few minutes and progressive result will start displaying as below:
Tue Jan 16 07:59:53 UTC 2018 Starting with gain 48.0 and arguments Namespace(config='/boot/piaware-config.txt', delim='\t', dryrun=False, gains='-10 36.4 38.6 40.2 42.1 44.5 48.0 49.6', gainstr='rtlsdr-gain', port=30003, server='localhost', testsnum=5, testtime=62, verbose='-v')
GAIN MSG POS ADR TIME Test 1 of 5
Set rtlsdr-gain to 49.6 in /boot/piaware-config.txt:60
49.6 1462 281 4 62.04
Set rtlsdr-gain to 48.0 in /boot/piaware-config.txt:60
48.0 1236 240 4 62.06
Set rtlsdr-gain to 44.5 in /boot/piaware-config.txt:60