Adaptive burst mode

Other aircraft were decoded during this period. It’s just not fast enough reducing the gain.

Mar 16 16:42:46 dump1090-fa[1556906]: rtlsdr: tuner gain set to 49.6 dB (gain step 28)
Mar 16 16:42:47 dump1090-fa[1556906]: rtlsdr: tuner gain set to 48.0 dB (gain step 27)
Mar 16 16:42:48 dump1090-fa[1556906]: rtlsdr: tuner gain set to 44.5 dB (gain step 26)
Mar 16 16:42:49 dump1090-fa[1556906]: rtlsdr: tuner gain set to 43.9 dB (gain step 25)

In this case you need another receiver (antenna+filter+dongle+RPi+dump1090-fa) for nearby helicopters. In this receiver, set gain to low enough value manually (by trial and error) to keep track of very close flying helicopters.

You can have 2 independent receivers on one Pi also, if you want to save cost of 2nd RPi

https://github.com/abcd567a/two-receivers/blob/master/README.md

 

 

It’s not so important that it would justify two receivers. :slightly_smiling_face:
Now I changed adaptive.c so that it makes two gain steps at once instead of only one gain step. That works reasonably well.

2 Likes

Great! :+1:

Isn’t the file adaptive.c part of source-code of dump1090-fa?
If I am right, then not many users here will be able to modify it and then recompile dump1090-fa.

Yes, it’s in the source, I recompiled it.

static void adaptive_increase_gain(const char *why)
{
    if (adaptive_set_gain(sdrGetGain() + 2, why))
        adaptive_gain_changed();
}

static void adaptive_decrease_gain(const char *why)
{
    if (adaptive_set_gain(sdrGetGain() - 2, why))
        adaptive_gain_changed();
}
1 Like

Thanks @heliosh for providing the detail of modifications to file adaptive.c.
Based on details of modification provided by you, I did it as follows:

 

## STEP-1: Cloned dump1090 source-code
git clone https://github.com/flightaware/dump1090  

## STEP-2: Modified file adaptive.c using following two sed commands
## These commands are long. Please scroll right to see these in full.
sudo sed -i 's/adaptive_set_gain(sdrGetGain() + 1, why/adaptive_set_gain(sdrGetGain() + 2, why/' dump1090/adaptive.c  
sudo sed -i 's/adaptive_set_gain(sdrGetGain() - 1, why/adaptive_set_gain(sdrGetGain() - 2, why/' dump1090/adaptive.c   

## STEP-3: Installed Build-Tools & Build-Dependencies
sudo apt install -y build-essential  debhelper devscripts adduser lighttpd  
sudo apt install -y librtlsdr-dev libbladerf-dev libhackrf-dev liblimesuite-dev  
sudo apt install -y libusb-1.0-0-dev pkg-config libncurses5-dev libsoapysdr-dev  

## STEP-4: Build & installed dump1090-fa by compiling source code
cd dump1090  
./prepare-build.sh bookworm   
cd package-bookworm   
sudo dpkg-buildpackage -b --no-sign  
cd ../  

sudo dpkg -i dump1090-fa_9.0_*.deb  

File adaptive.c BEFORE modifications by sed command

image

 

File adaptive.c AFTER modifications by sed command

image

2 Likes

After modification of source-code file adaptive.c and recompiling, the dump1090-fa is changing gain in steps of 2 (see below, from step 29 to step 27)

Mar 16 22:21:53 ubuntu-24 dump1090-fa[10372]: adaptive: changing gain from 58.6dB (step 29) to 48.0dB (step 27) because: high rate of loud undecoded messages

1 Like

The gain steps are (except for the hardware-agc) not very big, often only 1-2 dB. So I think making 2 steps will not have disadvantages.

Supported gain values (29): 0.0 0.9 1.4 2.7 3.7 7.7 8.7 12.5 14.4 15.7 16.6 19.7 20.7 22.9 25.4 28.0 29.7 32.8 33.8 36.4 37.2 38.6 40.2 42.1 43.4 43.9 44.5 48.0 49.6

Maybe there is a better solution, if it could be detected how much too loud the messages are. But that’s beyond what i’m able to do.

1 Like

Yes, you are right. I agree with you.

Tried it today and seems to work as every step is now ~5dB. Will commit this to my fork.

Is there a setting such as “adaptive_burst_loud_signal_value = -2.0” that sets the trigger point for the gain reduction? the dump1090 readme says " The “burst” adaptive gain mode listens for loud bursts of signal that were not successfully decoded as ADS-B messages".

I’d like to have the gain reduction triggered before the signal gets too loud. I’m guessing this would require 100% sampling, correct?

You’re into ‘crystal ball’ territory there.
Because you are trying to detect both weak and strong signals at the same time, it’s a real juggeling act where to set the gain.
The trouble is, you can’t predict when one transmitter will become ‘un-decodable’.
Reducing the gain unnecessarily will reduce the distant / weak signals without improving local / strong signals.

The common work-around is a ‘better’ receiver (meaning wider dynamic range).
The second option is to setup two receivers - one with high-gain, the other with low-gain.

What is needed is an SDR dongle that has better dynamic range than an RTL-SDR V3 dongle (say with a 12-bit A/D converter), but doesn’t cost $100 like the Airspy mini.

@geckoVN , I have used the two receivers (high+low gain) in the past but I’m willing to give up distant / weak signals so I can continue to track the very close aircraft (100’ - 200’ away) on the ground at the airport. @VirusPilot was getting close to a solution - was curious if there were any other single receiver options other than keeping the gain very low (~15).

Oh - that close!
A 20dB attenuator in the feed might be a good start

1 Like

My goal for using adaptive gain and adaptive burst was to prefer local traffic (pattern and ground) for our traffic display when we are on duty as controllers on the tower. With my settings in my fork this works quite nicely, I recently doubled the gain increase/decrease step size which also helps: https://github.com/flightaware/dump1090/compare/master…VirusPilot:dump1090:master

@VirusPilot , what’s the process to switch from dump1090-fa to your fork of dump1090? I’m not an experienced programmer so a list of steps would be helpful.

Assuming that you have a well updated Raspberry Pi (sudo apt update) then the following steps to compile/install the dump1090-fa service should work:

cd ~
git clone https://github.com/VirusPilot/dump1090.git
cd dump1090
sudo dpkg-buildpackage -b --no-sign --build-profiles=custom,rtlsdr
cd ..
sudo dpkg -i dump1090-fa_*.deb
rm -f *.deb
rm -f *.buildinfo
rm -f *.changes

then you might have to edit the dump1090-fa config file as documented upstream:

sudo nano /etc/default/dump1090-fa

furthermore you may need to restart the service:

sudo service dump1090-fa restart

got one error and two warnings when I tried to build the package …

Any idea how to fix them?

First install package debhelper:

sudo apt install debhelper

After installing above package:

cd dump1090
sudo dpkg-buildpackage -b --no-sign --build-profiles=custom,rtlsdr