For Beginners - How to Set / Change Gain


#1

CASE-1

Piaware SD Card image written to microSD card

(Piaware Image downloaded from https://flightaware.com/adsb/piaware/build )

(a) In this example gain is set to 30. Instead of 30 use the gain value you want to set
(b) Gain is set to 29.7 instead of 30 as shown in last line. This is due to fact that dongle cannot be set to any value, but to one of the permissible values nearest to the value you specify in the gain setting command.

Step-1:
Set gain to value 30 by giving following command:

pi@piaware:~$ sudo piaware-config rtlsdr-gain 30

#The above command will output following:
Set rtlsdr-gain to 30 in /boot/piaware-config.txt:60

.
Step-2:
Restart dump1090-fa to implement the newly set gain value
pi@piaware:~$ sudo systemctl restart dump1090-fa

.
Step-3:
Verify that the new value of gain is actually implemented
pi@piaware:~$ sudo systemctl status dump1090-fa -l

Last line of output of above command
piaware dump1090-fa[1254]: rtlsdr: tuner gain set to 29.7 dB

.

CASE-2

Raspbian image written to microSD card, then Piaware Add-on Package and dump1090-fa Add-on package installed

(Raspbian image downloaded from https://www.raspberrypi.org/downloads/raspbian/
Piaware and dump1090-fa Add-on packages installed as per instructions on https://flightaware.com/adsb/piaware/install )

(a) In this example gain is set to 30. Instead of 30 use the gain value you want to set
(b) Gain is set to 29.7 instead of 30 as shown in last line. This is due to fact that dongle cannot be set to any value, but to one of the permissible values nearest to the value you specify in the gain setting command.

Step-1:
Open file /etc/default/dump1090-fa in nano to edit it
sudo nano /etc/default/dump1090-fa

Above command will open file /etc/default/dump1090-fa which has following content:

# dump1090-fa configuration
# This is read by the systemd service file as an environment file,
# and evaluated by some scripts as a POSIX shell fragment.

# If you are using a PiAware sdcard image, this config file is regenerated
# on boot based on the contents of piaware-config.txt; any changes made to this
# file will be lost.

RECEIVER_OPTIONS="--device-index 0 --gain -10 --ppm 0 --net-bo-port 30005"
DECODER_OPTIONS="--max-range 360"
NET_OPTIONS="--net --net-heartbeat 60 --net-ro-size 1000 --net-ro-interval 1 --net-ri-port 0 --net-ro-port 30002 --net-sbs-port 30003 --net-bi-port 30004,30104 --net-bo-port 30005"
JSON_OPTIONS="--json-location-accuracy 1"

.
Step-2:
In the line starting with RECEIVER_OPTIONS, change the gain value from -10 to the required value. In this example it will be changed to 30.

Line before change:
RECEIVER_OPTIONS="–device-index 0 –gain -10 --ppm 0 --net-bo-port 30005"

Line after change:
RECEIVER_OPTIONS="–device-index 0 –gain 30 --ppm 0 --net-bo-port 30005"

After changes are made as above, save changes (Ctrl+o) and close file (Ctrl+x)

Step-3:
Restart dump1090-fa to implement the newly set gain value
pi@raspberrypi:~ $ sudo systemctl restart dump1090-fa

.
Step4:
Verify that the new value of gain is actually implemented
pi@raspberrypi:~ $ sudo systemctl status dump1090-fa -l

The last line of output of above command will show gain actually set
piaware dump1090-fa[1254]: rtlsdr: tuner gain set to 29.7 dB


Local Municipal Airport
#2

I used ‘Case 2’ above because i installed piaware & dump1090-fa using apt-get etc. Is that correct?

Setting gain to 29.7 is what i did. But is the change from -10 to +29.7 that’s a change of 40dB. Is that going to cause problems? Should i set it to some other value?

I’m using a FA Pro dongle, an RPi3, and a 1/4 wave ground plane antenna set by the window indoors.

Thanks…


#3

Yes, you used the correct case.

Whenever you want to check if you have used correct method and the gain has actually set to the desired value, give following command and read the LAST line of output. It will show what gain value is actually set.

sudo systemctl status dump1090-fa -l
.

.

  1. The dongle gain can only be set to a value between 0 and 49.6
  2. The dongle does NOT accept any negative (-) value of gain.
  3. The gain value -10 is a special number. It does NOT sets gain to -10 . It SWITCHES dongle into AGC mode (Automatic Gain Control mode). In this mode the dongl dynamically adjusts gain according to received signal strength.

The -gain 30 given in the “How To” was an example only, and did not mean you adjust your dongle to it. The gain value to be used varies over a wide range, depending on antenna, location, dongle, amplifier etc. The optimum value for any setup is to be determined by trial and error i.e. try different values of gain and watch performance for each value of gain.

For your setup with 1/4 wave ground plane antenna indoors, the best is to keep it at the default setting of AGC (i.e. at --gain -10)