Thoughts on optimizing gain

There’s an awful lot of new posts in here since I last looked at it. Without having to read every single one… That’s a pretty graph and quite interesting. Can I get this on a feeder with an Airspy? What do I need to do to draw it?

Check this post:
Thoughts on optimizing gain - #176 by wiedehopf

Yeah the discussion got a bit cluttered and off topic.

I’ve removed some of my off topic posts, but there are quite a few more to go around :wink:

Cool! What period is this over?

My external receiver (Airspy)

My loft receiver (RTL-SDR)

Martello Tower receiver (Airspy)

1 Like

The script uses data 7 days worth of data, going backwards from the last date change.

Interesting pattern.

I moved the atenna during the week to a place where the recption is worse, maybe that influences it a bit.

Thanks for the information.
Have you also tried the blue FA dongle with that same setup?

I know I can’t keep up with you, the “big guys” with Airspy’s, LNA’s and $$$ coax :rofl: but I was expecting a bit better than this:

Based on the RRD’s from the ADS-B Receiver Project setup.
My antenna was outside from Friday - Sunday, reaching 1000 msg/s sometimes. Currently it’s doing app. 500 msg/s inside.

The data points are averaged over much larger timeframe, that will change the graph somewhat.
(ads-b receiver project has much less granular data points, i tweaked that somewhat when i tried improving on those graphs)

Also it’s averaged over the last Tuesday to this Monday.

Thanks - I’ve edited the post to show which ones are using which receivers. I guess the low data points on the bottom graph are when we get dropouts due to the SSTV repeater transmitting,

My original thought for this was to use it as a tool for evaluating changes in receiver configuration rather than just produce a plot.

To do this, it’s necessary to have a baseline for comparison. I extracted a weeks worth of data, during which no changes were made to the receiver, either physically or in software.

I then plotted that, together with data from yesterday, which is after I’ve run wiedehopf’s gain script, and that has adjusted the gain down by 2 settings, from 42.1 to 38.6.

This is actually useful, because it shows not only that there was a change in performance, but you can see where the improvement is happening. With the current lower gain setting, I’m seeing higher message rates when there are more aircraft than previously. It also implies that this reduction in gain does mean slightly worse performance when there are less than about 200 aircraft, however that is not a problem since we want the better performance when it’s busy.

This should show up performance changes when using different antennas as well.

3 Likes

This is very useful! I’ve tried something similar in Excel but with (probably) the wrong type of data (positions per day), but that didn’t provide any useful results.

@wiedehopf, is it possible to include this in your excellent script?

I’ll post the scripts I used a bit later - they aren’t particularly complicated, just modifications of the ones previously posted here, but they are a bit hacky so you need to modify the various parameters manually. I’ll try to clean them up a bit so that they are a bit easier to use.

2 Likes

I’d recommend just running the script and saving the graph.
Then change something and run the script again a week later or even a week and a day later, so the day it ran some time on the old and new setting is excluded.

Here are the scripts I used to get the comparison plot. I used a separate gnuplot script to draw the graph because I couldn’t get gnuplot to play nicely inside the bash script the way wiedehopf did it. There are probably lots of ways this could be improved, so if someone feels inclined, feel free.

Anyway, there are two scripts to run. The first called adsbbaseline.sh should be run after the receiver setup has been unchanged for a week, since it pulls a week of data and saves it for future reference. Ideally run this before you start making changes to your receiver.

The second script will pull the most recent complete day of data, and compare it to a reference file that you specify - this would be run on the day after your receiver has been up for at least a day.

So, example usage would be:

./adsbbaseline.sh <reference>

eg.

./adsbbaseline.sh 38.6

This will give an output file called for example : 2019-07-02-38.6-baseline

Once you make changes to your receiver and want to compare it against the previous setup, you can run:

./adsbcompare.sh <reference filename>

eg

./adsbcompare.sh 2019-07-02-38.6-baseline

This will produce a graph and save it in the location http://your.pi.ip/dump1090-fa/data/compare.png

adsbbaseline.sh:

#!/bin/bash

# Fetch data from rrds

date=$(date -I --date=yesterday)
echo "Creating baseline file:"$date-$1"-baseline ending $date"


rrdtool fetch /var/lib/collectd/rrd/localhost/dump1090-localhost/dump1090_messages-local_accepted.rrd AVERAGE -s end-7days -e midnight today -r 3m -a > /tmp/messages_l-base
rrdtool fetch /var/lib/collectd/rrd/localhost/dump1090-localhost/dump1090_messages-remote_accepted.rrd AVERAGE -s end-7days -e midnight today -r 3m -a > /tmp/messages_r-base
rrdtool fetch /var/lib/collectd/rrd/localhost/dump1090-localhost/dump1090_aircraft-recent.rrd AVERAGE -s end-7days -e midnight today -r 3m -a > /tmp/aircraft-base


# Remove headers and extraneous :


sed -i -e 's/://' -e 's/\,/\./g' /tmp/messages_l-base
sed -i -e 's/://' -e 's/\,/\./g' /tmp/messages_r-base
sed -i -e 's/://' -e 's/\,/\./g' /tmp/aircraft-base

sed -i -e '1d;2d' /tmp/messages_l-base
sed -i -e '1d;2d' /tmp/messages_r-base
sed -i -e '1d;2d' /tmp/aircraft-base


# Combine both files to create space separated data file for use by gnuplot


join -o 1.1 1.2 2.2 /tmp/aircraft-base /tmp/messages_l-base > /tmp/tmp
join -o 1.2 1.3 2.2 /tmp/tmp /tmp/messages_r-base > ${date}-$1-baseline

adsbcompare.sh

 #!/bin/bash

# Fetch yesterdays data from rrds

rrdtool fetch /var/lib/collectd/rrd/localhost/dump1090-localhost/dump1090_messages-local_accepted.rrd AVERAGE -e midnight today -s end-1day -r 3m -a > /tmp/messages_l
rrdtool fetch /var/lib/collectd/rrd/localhost/dump1090-localhost/dump1090_messages-remote_accepted.rrd AVERAGE -e midnight today -s end-1day -r 3m -a > /tmp/messages_r
rrdtool fetch /var/lib/collectd/rrd/localhost/dump1090-localhost/dump1090_aircraft-recent.rrd AVERAGE -e midnight today -s end-1day -r 3m -a > /tmp/aircraft

# Remove headers and extraneous :

sed -i -e 's/://' -e 's/\,/\./g' /tmp/messages_l
sed -i -e 's/://' -e 's/\,/\./g' /tmp/messages_r
sed -i -e 's/://' -e 's/\,/\./g' /tmp/aircraft

sed -i -e '1d;2d' /tmp/messages_l
sed -i -e '1d;2d' /tmp/messages_r
sed -i -e '1d;2d' /tmp/aircraft

# Combine files to create data usabel by gnuplot

# Combine both files to create space separated data file for use by gnuplot

join -o 1.1 1.2 2.2 /tmp/aircraft /tmp/messages_l > /tmp/tmp
join -o 1.2 1.3 2.2 /tmp/tmp /tmp/messages_r > /tmp/$(date -I --date=yesterday)-scatter

gnuplot -c adsbcompare.plot $1


sudo cp /tmp/compare.png /run/dump1090-fa/compare.png

and you also need this gnuplot definition file:

adsbcompare.plot

date = system("date -I --date=yesterday")
base = ARG1
set terminal pngcairo enhanced size 1280,1024
set output '/tmp/compare.png'
set title 'Comparison of '.date.' against '.base
set xlabel 'Aircraft'
set ylabel 'Messages rate /s'
set grid xtics ytics
f(x) = c*x/sqrt(d+x**2) + a*x**2 +b*x
g(x) = j*x/sqrt(k+x**2) + h*x**2 +i*x
c = 4000
d = 7000
a = 0.05
b = -20
h = 0.05
i = -20
j = 4000
k = 7000
fit f(x) '/var/cache/fetch/'.date.'-scatter' via a,b,c,d
fit g(x) base using 1:($2+$3) via h,i,j,k
plot    base using 1:($2+$3) with points linecolor rgb "grey" notitle, g(x) title base, \
        '/var/cache/fetch/'.date.'-scatter' with points linecolor rgb "blue" notitle, f(x) title "Current"

Assuming all goes well, you should end up with a graph such as:

6 Likes

Hey All! Im pretty close to Multiple airports, I have 4 Major airports, (EWR, JFK, LGA, PHL) all within 100 NM, the first 3 within probably 50nm.
I just used the ‘strong signal’ to test my gain setting (set at -10 right now, but found 10-15 seems just as good… but less ‘range’)
this is the output: Percentage of strong messages: 27.467
WHEW!
Im assuming this is probably far too high to really get the good signals of the planes near by, but i Do get pretty good results (over 100 planes pretty much all day).
I have a flightaware pro stick, 50M of coax cable, and the flightaware antenna on my roof.

Think i should lower my gain??
Lowered to 15db and it got 19%,
Dropped to 10db
Percentage of strong messages: 14.814 - ran it a second time, i got 16%
Still too high? Seems like i have far fewer aircraft than my AGC setting.

Do you have aircraft flying directly over you all the time? If so, you might find that you get a higher proportion of strong signals, but that seems excessively high.

With pro stick -10 is probably too high, especially with an external antenna. I would turn it down several steps and see what you get.

I have 4 major airports near me with a Heathrow approach stack right above my house and I have my gain at about 38, though with a pre amp and loft antenna.

I dropped it down to 15 and 10 as above, but I just ran a 5db and let it run for about 10 minutes. STILL getting 32.8% strong.29%20PM
Thats the flight path most planes take into EWR. Its not DIRECTLY over head, but pretty close and we Do have a number of smaller planes in and out of Morristown Muni which is even closer.

Cross-modulation by strong Interference, possibly cell towers.

Carryout the scan as described here:

Do I Need A Filter?

Went all the way to 0db and let it run for half hour.
27% strong signals.
Ordered another filter (ADS-B LNA High Performance Triple Filter Low NF Amplifier by RTL-SDR Blog https://www.amazon.com/dp/B078TBG4H8/ref=cm_sw_r_cp_api_i_ClShDbM1DH935)
Maybe that will get me more range. I am across the street from a cell tower to. Guess the Fa filter in the pro stick just isn’t enough for me

I use cavity filters. Way too may cell towers in Brooklyn.