FlightAware Discussions

Gain Adjustment


#241

Thanks to the migration to new forum. All pre-migration links to posts and threads are broken. :frowning_face::cry:

Also I have noticed that in thread TWEAKS, if anyone makes a new post, it does not show up in “Latest” or “New” :grimacing:

Here are the updated links:

Start of Thread: TWEAKS

TWEAK #1: RANGE CIRCLES

TWEAK #2: REPLACING TWO-CLOCK MAP BY SKYVIEW MAP

TWEAK #3: Gain Optimization Scripts


Rtlsdr gain
Dongle not 100%
#242

Awesome! Thank you :slight_smile:


#243

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. :slight_smile:

<edit.
Nevermind, I found it and set it to “-10” for now. :slight_smile:


#244

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


#245

Thank you again abcd567.

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.


#246

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.


#247

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


#248

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.


#249

Try default
user: pi
passwd: flightaware for Piaware SD card image
OR
password: raspberry for Raspbian image.

Often people forget or ignore to change default password, and this proves to be a blessing :slight_smile: in situation like yours


#250

You, sir, are a genius! That worked!

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! :grinning:


#252

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.


#253

AGC is not necessarily the best value.

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.


#254

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!


#255

AGC is not needed for ADSB.

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.


#256

installation went great, now running. Recieved the following line but nothing else since. Is there something happening or ???

Mon Jan 15 23:04:08 UTC 2018 Starting with gain 36.4 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=None)


#258

The script should show output as file downloaded from Github has following line:

parser.add_argument('-v', dest='verbose', help="verbose output", action='count')

Try running the script with argument verbose as follows:

sudo ./optimize-gain-piaware3.py --verbose

#259

pi@piaware:~$ sudo ./optimize-gain-piaware3.py --verbose
usage: optimize-gain-piaware3.py [-h] [-t TESTTIME] [-n TESTSNUM] [-s SERVER]
[-p PORT] [-g GAINS] [-c CONFIG] [-r GAINSTR]
[-v] [-d] [–delim DELIM]
optimize-gain-piaware3.py: error: unrecognized arguments: --verbose


#260

It is not accepting verbose either internally or externally.

This means you won’t see the output as it progresses. It will output the whole chunk of result at once after the test has completed its run.

Run the script normally (I. e. without --verbose) and take a nap for an hour, then check your computer. Hopefully you will see the final output.


#261

It worked. looks like 48 is the best, will try again on a busy day. I tried this at near midnight
to keep counts from being messed too much.


#262

@w7psk

  1. Open file optimize-gain-piaware3.py for editing
    sudo nano optimize-gain-piaware3.py

  2. Scroll down to following line:
    parser.add_argument(’-v’, dest=‘verbose’, help=“verbose output”, action=‘count’)

  3. In above line, add default="-v" as shown in bold below:

    parser.add_argument(’-v’, dest=‘verbose’, default="-v", help=“verbose output”, action=‘count’)

    Important: There should be a comma before and after default="-v"

  4. Save (Ctrl+o) and close file (Ctrl+x)

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

    .

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