What's the easiest way of adding the choice of GAIN in Skyaware?

Good you checked before I even had time to distroy something :slight_smile:

I will ask again: does this script read data from any logs? I am browsing various commands, but there is nothing that would enable messages, positions and planes to be seen at the same time. Is there a command for that?

Even though I have an option of choosing gain now, I do not know how to check that for different values.

It reads data from dump1090-fa’s output at port 30003, accumulated for about 1 minutes for each read cycle. It uses set of python commands for segregating positions and planes. Unfortunately all these are outdated, wont work or wont give correct results on current version of python. It may also damage dump1090-fa’s config file /etc/default/dump1090-fa.

Use Skyaware map and note down on a paper the Total Aircraft and Message Rate for each gain setting. After tabulating these for vsriou gain values, compare ti see which gain gives best results.

1 Like

@chemitox
An easier way is to use Message Rate Graph.

(1) Install Graphs by @wiedehopf
sudo bash -c "$(wget -q -O - https://raw.githubusercontent.com/wiedehopf/graphs1090/master/install.sh)"

(2) Set gain to 60 by Set-Gain add-on if you have installed it
If you have NOT installed Set-Gain add-on, then do following:

sudo nano /etc/default/dump1090-fa

## In file opened, scroll down to find following settings 
## and set these as shown below:
RECEIVER_GAIN=60
ADAPTIVE_DYNAMIC_RANGE=no

 

(3) Save file (Ctrl+O) and Close file (Ctrl+x)

(4) Restart dump1090-fa

sudo systemctl restart dump1090-fa  

(5) Leave your Pi running for 24 hrs, the open the graphs and see the graph titled “ADS-B Message Rate”. At bottom of this graph you will see “Messages > -3dBFS”. If it is more than 5%, then do following:

(a) reduce gain to say 42
(b) restart dump1090-fa
(c) leave Pi running for 24 hrs, and check Graphs for “Messages > -3dBFS”. If it is still higher than 5%, reduce gain to say 32 and repeat the process. When you find a gain setting where “Messages > -3dBFS” is less than 5%, stop there.

 

 

1 Like

@chemitox

Just for academic interest, upgraded old Python 2 file optimize-gain-dump1090-fa-Jessie.py.

Now it works with Python 3 / dump1090-fa ver 6.1 / Buster & Bullseyse

CAUTION:

Wont work on Piaware SD Card image
Only for package install of dump1090-fa ver 6.1 on RaspiOS Buster & Bullseye.

https://github.com/abcd567a/optimize-gain/blob/main/README.md

 

HOW TO USE:

First command below is long.
Scroll rigt to see and copy it in full.

wget https://raw.githubusercontent.com/abcd567a/optimize-gain/main/optimize-gain-dump1090-fa.py  

sudo chmod +x optimize-gain-dump1090-fa.py   

sudo ./optimize-gain-dump1090-fa.py  

 

The script will start collecting data (Messages, Positions, Aircraft) from dump1090-fa port 30003, accumulated for 1 minute for each gain setting, and plot it like this:

READING AND SAVING SETTINGS BEFORE STARTING THE TEST
THESE SETTINGS WILL BE RESTORRED AT THE END OF THE TEST

RECEIVER_GAIN=60
ADAPTIVE_DYNAMIC_RANGE=yes

test 1 of 3
gain= 49.6 messages= 15355 positions= 2246 planes= 64
gain= 48.0 messages= 14567 positions= 2134 planes= 66
… …
… …
gain= 22.9 messages= 12550 positions= 1761 planes= 50
gain= 20.7 messages= 11623 positions= 1493 planes= 42

test 2 of 3
gain= 49.6 messages= 14568 positions= 2303 planes= 75
gain= 48.0 messages= 16294 positions= 2527 planes= 83
… …
… …
gain= 22.9 messages= 6526 positions= 970 planes= 36
gain= 20.7 messages= 4939 positions= 716 planes= 29

test 3 of 3
gain= 49.6 messages= 13931 positions= 2069 planes= 70
gain= 48.0 messages= 14354 positions= 2206 planes= 68
… …
… …
gain= 22.9 messages= 8225 positions= 1221 planes= 38
gain= 20.7 messages= 4584 positions= 744 planes= 31

===Totals===
Gain, Messages, Positions, Aircraft
49.6 62144 9687 223
48.0 62857 9809 225
44.5 59248 9281 233
43.9 57458 9058 221
43.4 58986 9212 227
42.1 61277 9380 234
40.2 61272 9640 223
38.6 60738 9487 217
37.2 61570 9359 213
36.4 59260 9004 210
33.8 60864 8987 214
32.8 59858 8921 212
29.7 57424 8505 199
28.0 55515 8273 187
25.4 51750 7437 169
22.9 46061 6549 158
20.7 37763 5143 131

SETTINGS RESTORED AT END OF TEST:
RECEIVER_GAIN=60
ADAPTIVE_DYNAMIC_RANGE=yes

 

image

 

image

 

1 Like

Hello,
I was actually hoping you would do that :slight_smile: I’m really grateful, as it works!

Unfortunately, the results are so chaotic that I don’t know which gain would be most suitable. I was testing the script at various times and days, but the results differ.

pi@raspberrypi:~ $ sudo ./optimize-gain-dump1090-fa.py

READING AND SAVING SETTINGS BEFORE STARTING THE TEST
THESE SETTINGS WILL BE RESTORRED AT THE END OF THE TEST

RECEIVER_GAIN=48.0
ADAPTIVE_DYNAMIC_RANGE=no

test 1 of 3
gain= 49.6 messages= 13170 positions= 1193 planes= 19
gain= 48.0 messages= 13024 positions= 1173 planes= 18
gain= 44.5 messages= 13174 positions= 1202 planes= 18
gain= 43.9 messages= 14494 positions= 1308 planes= 17
gain= 43.4 messages= 16466 positions= 1445 planes= 17
gain= 42.1 messages= 16632 positions= 1467 planes= 17
gain= 40.2 messages= 16662 positions= 1546 planes= 17
gain= 38.6 messages= 16727 positions= 1518 planes= 18
gain= 37.2 messages= 16976 positions= 1482 planes= 17
gain= 36.4 messages= 17136 positions= 1508 planes= 16
gain= 33.8 messages= 16105 positions= 1455 planes= 16
gain= 32.8 messages= 15443 positions= 1340 planes= 16
gain= 29.7 messages= 14171 positions= 1243 planes= 16
gain= 28.0 messages= 11282 positions= 1038 planes= 15
gain= 25.4 messages= 10548 positions= 949 planes= 13
gain= 22.9 messages= 8696 positions= 771 planes= 12
gain= 20.7 messages= 7332 positions= 614 planes= 7
test 2 of 3
gain= 49.6 messages= 13240 positions= 1213 planes= 15
gain= 48.0 messages= 12036 positions= 1156 planes= 16
gain= 44.5 messages= 10073 positions= 953 planes= 14
gain= 43.9 messages= 9880 positions= 936 planes= 14
gain= 43.4 messages= 9897 positions= 934 planes= 12
gain= 42.1 messages= 10137 positions= 942 planes= 10
gain= 40.2 messages= 10831 positions= 936 planes= 11
gain= 38.6 messages= 10443 positions= 940 planes= 11
gain= 37.2 messages= 10286 positions= 939 planes= 10
gain= 36.4 messages= 9555 positions= 869 planes= 10
gain= 33.8 messages= 9266 positions= 867 planes= 10
gain= 32.8 messages= 8899 positions= 837 planes= 11
gain= 29.7 messages= 7448 positions= 735 planes= 11
gain= 28.0 messages= 5997 positions= 599 planes= 9
gain= 25.4 messages= 4368 positions= 445 planes= 5
gain= 22.9 messages= 3919 positions= 402 planes= 5
gain= 20.7 messages= 2601 positions= 284 planes= 6
test 3 of 3
gain= 49.6 messages= 6745 positions= 757 planes= 10
gain= 48.0 messages= 7129 positions= 811 planes= 10
gain= 44.5 messages= 6563 positions= 780 planes= 11
gain= 43.9 messages= 7434 positions= 875 planes= 10
gain= 43.4 messages= 7038 positions= 826 planes= 11
gain= 42.1 messages= 6052 positions= 716 planes= 10
gain= 40.2 messages= 5085 positions= 604 planes= 10
gain= 38.6 messages= 4624 positions= 545 planes= 10
gain= 37.2 messages= 5115 positions= 629 planes= 11
gain= 36.4 messages= 5486 positions= 639 planes= 12
gain= 33.8 messages= 5832 positions= 728 planes= 12
gain= 32.8 messages= 6969 positions= 875 planes= 10
gain= 29.7 messages= 7372 positions= 863 planes= 11
gain= 28.0 messages= 6565 positions= 816 planes= 13
gain= 25.4 messages= 5887 positions= 732 planes= 13
gain= 22.9 messages= 5855 positions= 742 planes= 11
gain= 20.7 messages= 4201 positions= 538 planes= 10

===Totals===
Gain, Messages, Positions, Aircraft
49.6 33155 3163 29
48.0 32189 3140 29
44.5 29810 2935 29
43.9 31808 3119 28
43.4 33401 3205 29
42.1 32821 3125 28
40.2 32578 3086 28
38.6 31794 3003 30
37.2 32377 3050 29
36.4 32177 3016 30
33.8 31203 3050 30
32.8 31311 3052 30
29.7 28991 2841 31
28.0 23844 2453 31
25.4 20803 2126 28
22.9 18470 1915 25
20.7 14134 1436 21
SETTINGS RESTORED AT END OF TEST:
RECEIVER_GAIN=48.0
ADAPTIVE_DYNAMIC_RANGE=no

pi@raspberrypi:~ $ sudo ./optimize-gain-dump1090-fa.py

READING AND SAVING SETTINGS BEFORE STARTING THE TEST
THESE SETTINGS WILL BE RESTORRED AT THE END OF THE TEST

RECEIVER_GAIN=43.4
ADAPTIVE_DYNAMIC_RANGE=no

test 1 of 3
gain= 49.6 messages= 22979 positions= 2266 planes= 30
gain= 48.0 messages= 21682 positions= 2090 planes= 31
gain= 44.5 messages= 21952 positions= 2027 planes= 29
gain= 43.9 messages= 20276 positions= 1918 planes= 28
gain= 43.4 messages= 20451 positions= 1934 planes= 28
gain= 42.1 messages= 22009 positions= 2004 planes= 29
gain= 40.2 messages= 24104 positions= 2133 planes= 28
gain= 38.6 messages= 24668 positions= 2237 planes= 30
gain= 37.2 messages= 25902 positions= 2286 planes= 31
gain= 36.4 messages= 26792 positions= 2463 planes= 31
gain= 33.8 messages= 26103 positions= 2361 planes= 31
gain= 32.8 messages= 26891 positions= 2377 planes= 32
gain= 29.7 messages= 24914 positions= 2242 planes= 32
gain= 28.0 messages= 25430 positions= 2161 planes= 30
gain= 25.4 messages= 23788 positions= 2067 planes= 27
gain= 22.9 messages= 20858 positions= 1748 planes= 25
gain= 20.7 messages= 16508 positions= 1370 planes= 24
test 2 of 3
gain= 49.6 messages= 27935 positions= 2515 planes= 31
gain= 48.0 messages= 27006 positions= 2455 planes= 31
gain= 44.5 messages= 27095 positions= 2490 planes= 30
gain= 43.9 messages= 26668 positions= 2475 planes= 30
gain= 43.4 messages= 26484 positions= 2454 planes= 32
gain= 42.1 messages= 26615 positions= 2435 planes= 32
gain= 40.2 messages= 25475 positions= 2306 planes= 32
gain= 38.6 messages= 24281 positions= 2231 planes= 32
gain= 37.2 messages= 24097 positions= 2226 planes= 32
gain= 36.4 messages= 22645 positions= 2131 planes= 32
gain= 33.8 messages= 21507 positions= 2042 planes= 33
gain= 32.8 messages= 20422 positions= 1902 planes= 33
gain= 29.7 messages= 19920 positions= 1894 planes= 30
gain= 28.0 messages= 20255 positions= 1916 planes= 28
gain= 25.4 messages= 18053 positions= 1653 planes= 26
gain= 22.9 messages= 15845 positions= 1471 planes= 24
gain= 20.7 messages= 12782 positions= 1067 planes= 20
test 3 of 3
gain= 49.6 messages= 25081 positions= 2334 planes= 31
gain= 48.0 messages= 25190 positions= 2362 planes= 32
gain= 44.5 messages= 24304 positions= 2300 planes= 32
gain= 43.9 messages= 23962 positions= 2232 planes= 32
gain= 43.4 messages= 25169 positions= 2315 planes= 33
gain= 42.1 messages= 24830 positions= 2211 planes= 31
gain= 40.2 messages= 24022 positions= 2069 planes= 31
gain= 38.6 messages= 22929 positions= 2049 planes= 28
gain= 37.2 messages= 23068 positions= 2047 planes= 28
gain= 36.4 messages= 22648 positions= 1974 planes= 28
gain= 33.8 messages= 22337 positions= 1931 planes= 24
gain= 32.8 messages= 21309 positions= 1830 planes= 24
gain= 29.7 messages= 19642 positions= 1691 planes= 21
gain= 28.0 messages= 17596 positions= 1531 planes= 19
gain= 25.4 messages= 14343 positions= 1165 planes= 16
gain= 22.9 messages= 13489 positions= 1099 planes= 15
gain= 20.7 messages= 10325 positions= 807 planes= 15

===Totals===
Gain, Messages, Positions, Aircraft
49.6 75995 7115 64
48.0 73878 6907 63
44.5 73351 6817 61
43.9 70906 6625 60
43.4 72104 6703 61
42.1 73454 6650 61
40.2 73601 6508 60
38.6 71878 6517 58
37.2 73067 6559 59
36.4 72085 6568 59
33.8 69947 6334 58
32.8 68622 6109 58
29.7 64476 5827 57
28.0 63281 5608 53
25.4 56184 4885 47
22.9 50192 4318 46
20.7 39615 3244 43
SETTINGS RESTORED AT END OF TEST:
RECEIVER_GAIN=43.4
ADAPTIVE_DYNAMIC_RANGE=no

sudo ./optimize-gain-dump1090-fa.py

READING AND SAVING SETTINGS BEFORE STARTING THE TEST
THESE SETTINGS WILL BE RESTORRED AT THE END OF THE TEST

RECEIVER_GAIN=43.4
ADAPTIVE_DYNAMIC_RANGE=no

test 1 of 3
gain= 49.6 messages= 5794 positions= 586 planes= 7
gain= 48.0 messages= 5159 positions= 526 planes= 6
gain= 44.5 messages= 5308 positions= 535 planes= 8
gain= 43.9 messages= 5423 positions= 577 planes= 8
gain= 43.4 messages= 5377 positions= 565 planes= 7
gain= 42.1 messages= 4030 positions= 446 planes= 9
gain= 40.2 messages= 5250 positions= 576 planes= 10
gain= 38.6 messages= 4482 positions= 520 planes= 7
gain= 37.2 messages= 4314 positions= 503 planes= 8
gain= 36.4 messages= 4527 positions= 475 planes= 8
gain= 33.8 messages= 4390 positions= 444 planes= 6
gain= 32.8 messages= 4343 positions= 433 planes= 6
gain= 29.7 messages= 4454 positions= 414 planes= 6
gain= 28.0 messages= 4276 positions= 387 planes= 5
gain= 25.4 messages= 3276 positions= 290 planes= 4
gain= 22.9 messages= 3394 positions= 289 planes= 4
gain= 20.7 messages= 2927 positions= 224 planes= 3
test 2 of 3
gain= 49.6 messages= 4893 positions= 458 planes= 6
gain= 48.0 messages= 4031 positions= 372 planes= 5
gain= 44.5 messages= 4348 positions= 378 planes= 4
gain= 43.9 messages= 4331 positions= 357 planes= 4
gain= 43.4 messages= 4462 positions= 373 planes= 4
gain= 42.1 messages= 4678 positions= 412 planes= 4
gain= 40.2 messages= 4973 positions= 454 planes= 4
gain= 38.6 messages= 4982 positions= 447 planes= 5
gain= 37.2 messages= 4737 positions= 400 planes= 4
gain= 36.4 messages= 4044 positions= 339 planes= 5
gain= 33.8 messages= 4208 positions= 372 planes= 5
gain= 32.8 messages= 4690 positions= 419 planes= 5
gain= 29.7 messages= 4798 positions= 425 planes= 4
gain= 28.0 messages= 4156 positions= 349 planes= 4
gain= 25.4 messages= 3679 positions= 307 planes= 4
gain= 22.9 messages= 4140 positions= 360 planes= 4
gain= 20.7 messages= 3839 positions= 324 planes= 3
test 3 of 3
gain= 49.6 messages= 4801 positions= 448 planes= 5
gain= 48.0 messages= 4661 positions= 449 planes= 5
gain= 44.5 messages= 4433 positions= 416 planes= 4
gain= 43.9 messages= 4485 positions= 417 planes= 5
gain= 43.4 messages= 4865 positions= 461 planes= 5
gain= 42.1 messages= 4816 positions= 475 planes= 6
gain= 40.2 messages= 5050 positions= 515 planes= 5
gain= 38.6 messages= 5800 positions= 639 planes= 7
gain= 37.2 messages= 5759 positions= 653 planes= 7
gain= 36.4 messages= 5495 positions= 606 planes= 8
gain= 33.8 messages= 5676 positions= 585 planes= 10
gain= 32.8 messages= 5316 positions= 565 planes= 10
gain= 29.7 messages= 4678 positions= 494 planes= 8
gain= 28.0 messages= 5019 positions= 528 planes= 8
gain= 25.4 messages= 4544 positions= 419 planes= 6
gain= 22.9 messages= 4369 positions= 433 planes= 8
gain= 20.7 messages= 2890 positions= 277 planes= 6

===Totals===
Gain, Messages, Positions, Aircraft
49.6 15488 1492 13
48.0 13851 1347 11
44.5 14089 1329 13
43.9 14239 1351 14
43.4 14704 1399 13
42.1 13524 1333 14
40.2 15273 1545 14
38.6 15264 1606 13
37.2 14810 1556 14
36.4 14066 1420 15
33.8 14274 1401 15
32.8 14349 1417 15
29.7 13930 1333 13
28.0 13451 1264 12
25.4 11499 1016 10
22.9 11903 1082 11
20.7 9656 825 8
SETTINGS RESTORED AT END OF TEST:
RECEIVER_GAIN=43.4
ADAPTIVE_DYNAMIC_RANGE=no

Do you see the best setting here?

Maybe I would better leave it the way it is, install the Message Rate Graph and then try to find a below 5% “Messages > -3dBFS” gain setting?

Could you explain just one thing? In your script results there is a line:

ADAPTIVE_DYNAMIC_RANGE=yes

As you see I have a line like this:

ADAPTIVE_DYNAMIC_RANGE=no

Does it mean i have something not configurated here?

If for message graph I need to have

ADAPTIVE_DYNAMIC_RANGE=no

does it mean these two things exclude one another?

Possibly this line of “Totals” (gain 37.2):
37.2 14810 1556 14

 

That is preferred way, easier. Script optimize-gain.py was used before @wiedehopf suggested “Messages > -3dBFS” method.

 

No, you have everything configured properly. The difference is caused because you ran test on a Pi with “Set Gain” add-on installed, while I ran the test on a Pi which did not has “Set Gain” add-on installed. Please see explanation below.

My Pi does not have “Set Gain” installed, and therefore has the the following default setting:
ADAPTIVE_DYNAMIC_RANGE=yes

Your Pi has “Set Gain” indtalled. As the “Set Gain” add-on wont work with above default setting, so its installation script changes this setting to following:
ADAPTIVE_DYNAMIC_RANGE=no

That is what your Pi has, and this is necessary for “Set Gain” to work properly.

 

The Graphs will function OK with both following settings:
ADAPTIVE_DYNAMIC_RANGE=yes
ADAPTIVE_DYNAMIC_RANGE=no

However setting it “yes” will cause dump1090-fa to keep on adjusting the gain at regular intervals, so it will change settings you make by “Set Gain” button without you knowing it.

To conclude:

(1) Leave this setting as it is, i.e. as below:
ADAPTIVE_DYNAMIC_RANGE=no

(2) Install graph, and try to find a below 5% “Messages > -3dBFS” gain setting. When trying different values of gain, use “Set Gain” button to change gain setting.

 

Just read it somewhere.
Actually the original suggestion was 0.1 to 1 % … it really depends on the priorities and traffic.

If you prioritize local traffic it doesn’t hurt to go lower in gain.

So you mean that 60 in 6.1 (and 7.1) sets dump1090-fa to AGC mode?

Currently my dump1090-fa is set as follows:

Initial receiver gain, in dB. If adaptive gain is enabled (see below) the actual gain

may change over time

RECEIVER_GAIN=20.7

Adjust gain to try to achieve optimal dynamic range / noise floor?

ADAPTIVE_DYNAMIC_RANGE=no

Target dynamic range in dB (leave blank to autoselect based on SDR type)

ADAPTIVE_DYNAMIC_RANGE_TARGET=

Reduce gain when loud message bursts from nearby aircraft are seen?

ADAPTIVE_BURST=yes

Should i set it to
RECEIVER_GAIN=60 with ADAPTIVE_DYNAMIC_RANGE=yes ?

Consider that my antenna is placed on my condo’s rooftop, and is connected to a 30meters long cable (10mt indoor with uputronics filter + 20 outdoor with bias tee).

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.