For Beginners: How to Change / Set Gain

How to Change / Set the Gain

The method of changing gain depends on the installed software, as detailed below.

(1) Piaware SD Card image with integral dump1090-fa

Do NOT change gain in file /etc/default/dump1090-fa. It will be overwritten at piaware restart and Pi reboot

  1. Set the gain by command:
    sudo piaware-config rtlsdr-gain xx.x

    OR

  2. Set the gain by editing file piaware-config.txt:
    Open file for editing by following command
    sudo nano /boot/piaware-config.txt

In above file scroll down till you find a line starting with rtlsdr-gain. Change value of gain there.
If the line does not exist, add a new line at bottom of page as shown below:
rtlsdr-gain xx.x
(replace xx.x by actual value of gain you want to use)

.

# 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   # updated by fa_piaware_config

#

.

(2) Raspbian + dump1090-fa (add-on)

Set the gain by editing file dump1090-fa:
Open file for editing by following command

sudo nano /etc/default/dump1090-fa
Change the value of gain in line starting with RECEIVER_OPTIONS=.
(replace xx.x by actual value of gain you want to use)

# 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 xx.x --lat aa.aaaa --lon bb.bbbb --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"

.

(3) Raspbian + dump1090-mutability

Set the gain by editing file dump1090-mutability:
Open file for editing by following command

sudo nano /etc/default/dump1090-mutability

In above file scroll down to line starting with GAIN="xx.x".
Change gain value in this line
(replace xx.x by actual value of gain you want to use)

# Receiver options
#

# RTLSDR device index or serial number to use
# If set to "none", dump1090 will be started in --net-only mode
DEVICE=""

# RTLSDR gain in dB.
# If set to "max" (the default) the maximum supported gain is used.
# If set to "agc", the tuner AGC is used to set the gain.
GAIN="xx.x"

2 Likes

Hi @abcd567,

It may not be worth worrying a beginner with this, but strictly speaking, unless the dongle/stick used has a TCXO, the PPM may be an important setting. No-name/generic dongles/sticks have PPM differences of over 100 sometimes.

.
Good point. Thanks for pointing out.
It was an oversight, two unrelevant extra lines were copy-pasted.
Removed these two lines now.
Thanks again.

1 Like

I wonder how would someone check that without a calibrated generator?

I would add the reset after this edit: sudo systemctl restart dump1090-fa

I plug it into a pc and run SDR# receiver software.

Tune to a station that you know is on frequency and then adjust the ppm setting in sdr# until it is receiving on frequency.

This will give you the ppm setting for that dongle to then use on Piaware.

S

There are a couple of ways of doing it. I used SDR# and SDRConsole. Tune to a known station, for ADS-B an FM station should be enough, and add subtract PPMs until the tuning matches the known station’s carrier frequency.

Since the stations are FM modulated, how precise can you find the central frequency?
100kHz standard FM stereo modulation on a 100MHz carrier means 1000 ppm.

Yes, that can be a problem, a talk station during a silent period should work. I prefer to use a shortwave station, but an upconverter is needed for that, since the dongles will not typically tune below 30-50 MHz, depending on the model.

Shortwave is now mostly silent. Most of the broadcasters have quit it. It used to be so crowded and lively in its peak days.

Visiting shortwaves now is like visiting a
cemetery. :frowning:

I agree, as far as variety and quality go, but for the purposes of calibration, there are enough religious and CRI stations out there. Too many of those in fact.

For us here in Canada, there are the CHU time stations. For our cousins in the US, WWV and WWVH.

And that crystal adds another uncertainty to the measurement chain.

Plus, don’t forget that even AM modulation has sidebands. Sure, smaller (10kHz or 5kHz), but the carrier frequency is lower too, so the ratio remains high.

The carrier frequency of a shortwave AM modulated station, as seen on SDR# or SDRConsole, is what matters. As for the uncertainty, this is why the dongle should be calibrated where it’s going to be installed, and only after a suitable warm up period.

This is not a major problem nowadays, unless the prospective user cannot affort an extra $15-20 to purchase a dongle with a TCXO: ProStick, ProStick Plus, RTL-SDR Blog v3, and others from NooElec etc etc.

I have a ProStick Plus, and a no-name clone (that one I was worried about).

Yep, I have one of those. It was the first with an R820T2 chip, my previous 3 have the R820T chip, and the 2 before that had the E4000 chip. I cannot say how much sample variations there are among the no-name dongles, one of mine is 75 PPM off frequency. If it did impair its performance, it was negligible.

Shortwave is now mostly silent. Most of the broadcasters have quit it. It used to be so crowded and lively in its peak days.

Hmmmm, there are over 700,000 hams just in the US. Not the best solar propagation just now but it is cyclical as you know. A Lot of the hobby has gone digital so just browsing will find nothing. Digital modes are more versatile, take less power, and cuts through noise better. So just because you don’t hear it does not mean it isn’t there. Give another listen with some new digital ears.

Bob

@biekerc
Thanks for correcting the typo in the title of this thread.

1 Like