DISTANCES are only calculated for TYPE 2 and TYPE 3 MESSAGES with lat/lon positions
TYPE 2 SURFACE MESSAGES are counted in 2 categories if they include lat/lon and all TYPE 2
TYPE 3 AIRBORN MESSAGES are counted in 2 categories if they include lat/lon and all TYPE 3
NOTES RUNNING EXAMPLE
I personally run at 5dB steps using short intervals (10s) and do a final verify with a long interval (62s)
RUN 1: passes 5, duration 10, gain gain_setp_5
RUN 2: passes 5, duration 62, gain gain_setp_5
I then run using all gains in the 10-20 dB span around what the first 2 runs tell me to find the best gain
RUN 3: passes 5, duration 10, gain gain_all_20
RUN 4: passes 5, duration 62, gain gain_all_20
CHANGE LOG (MOST RECENT VERSION ONLY)
# 3.3
# add in 2 columns for types 2 and 3 with lat/lon
# add in pos_ll or positions with LATLON ranking
# updated install instructions thanks to (abcd567)
# fix issue with categories if set contains no values (issue found by (gavin323))
# categories naming updated to be more clear
# update script header display
# update script final header display to include script_name, script_version, and script_author
# remove distance change from miles for now because of all hardcoded categories and columns
# update script documentation to be more clear
# update formatting to use variables instead of hardcodes
# add additional formatting
# cleanup config line variable naming
# fix config_setting and config_setting_after to make it actually work for other than PIAWARE SD
# update color display to work with all colors
# update to display table with values within color_top_percentage of best value
USER SETTINGS IN SCRIPT DESCRIPTIONS
# REQUIRED GAIN_CHECK SETTINGS DESCRIPTIONS
# antenna_lat location of your antenna for distance calcs in xxx.xxx form) (use at least 3 decimal places for accuracy)
# antenna_lon location of your antenna for distance calcs in xxx.xxx form) (use at least 3 decimal places for accuracy)
# pass_duration seconds for each gain (default 62)
# pass_number number of passes to aggregate for totals (default 5)
# gain_choice variable of gains to use (gains_step_5) or list of gains separated by space
# ----------------------------------------------------------------------------------------------------------------------
# REQUIRED DUMP1090 SETTINGS DESCRIPTIONS
# host url of dump1090 (default PIAWARE SD)
# port 30003 = SBS port (default PIAWARE SD)
# config_file path and filename of where gain settings are stored (default PIAWARE SD)
# config_setting gain setting before the gain number
# (ex. "rtlsdr-gain 49.6" the config_setting is "rtlsdr-gain" no space after)
# config_setting_after gain setting after the gain number
# (ex. "rtlsdr-gain 49.6 something" the config_setting_after is "something" no space before)
# (ex. "rtlsdr-gain 49.6" the config_setting_after is "")
# service_restart_cmd command to restart service to apply changed gain (default PIAWARE SD)
# ----------------------------------------------------------------------------------------------------------------------
# OPTIONAL SETTINGS DESCRIPTIONS
# distance_unit mile or km (don't change off miles as it doesn't update categories and columns)
# color_top_percent 5 values in same column within this percentage of the best value will also be highlighted in a different color
pi@raspberrypi:~ $ sudo apt install python3-venv python3-pip
... ... ...
... ... ...
Setting up python3-setuptools (52.0.0-4) ...
Setting up python3-wheel (0.34.2-1) ...
Setting up python3-pip (20.3.4-4+rpt1+deb11u1) ...
Processing triggers for man-db (2.9.4-2) ...
pi@raspberrypi:~ $ sudo pip3 install beautifultables
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
ERROR: Could not find a version that satisfies the requirement beautifultables
ERROR: No matching distribution found for beautifultables
whoops i put a s at the end when i should not have.
looks like i didn’t do a great job with the install instructions on that or python. I technically have python 3.7 installed on my test piaware so any python 3 should work.
BTW this is based on your script I put your username and original post in the notes. If you want me to update anything or a different call out let me know.
script_name = "gain_check_v3.py"
script_version = "3.3"
script_release = "RELEASED"
script_author = "sxb1n9 or b1n9"
print(line_break) #-----------------------------------------------------------------------------------------------------
print("SCRIPT: ", white + script_name + nocolor)
print("VERSION:", white + script_version + space + script_release + nocolor)
print("AUTHOR: ", white + script_author + nocolor)
print(line_break + white) #---------------------------------------------------------------------------------------------
print("GOAL:" + nocolor)
print(" * script should help you chooose a STATIC GAIN setting that maximizes receiption using more categories")
print(" * ALL MESSAGE TYPES 1-8")
print(" * you also want to maximize type 2 and type 3 messages")
print(" * DISTNACE of RECEPTION including CLOSE, NORMAL, FAR")
print(" * you want to be able to receive (CLS or CLOSE) DISTANCES & FAR_1 or FAR_2 DISTANCES at the same time")
print(line_break + white) #---------------------------------------------------------------------------------------------
print("NOTES:" + nocolor)
print(" * my (b1n9) take and maybe/hopefully an improvement of the optimize_gain.py script by (abcd567)")
print(" * https://discussions.flightaware.com/t/tweaks/20339/36")
print(" * REQUIRES PYTHON 3 for better table display")
print(" * DISTANCES are in MILES")
print(" * DISTANCES are only calculated for TYPE 2 and TYPE 3 MESSAGES with lat/lon positions")
print(" * TYPE 2 GND or SURFACE MESSAGES are counted in 2 categories if they include lat/lon and all TYPE 2")
print(" * TYPE 3 AIR or AIRBORN MESSAGES are counted in 2 categories if they include lat/lon and all TYPE 3")
print(line_break + white) #---------------------------------------------------------------------------------------------
print("RUNNING:" + nocolor)
print(" * I personally run at 5dB steps using short intervals (10s) and do a final verify with a long interval (62s)")
print(" * RUN 1: passes 5, duration 10, gain gain_setp_5")
print(" * RUN 2: passes 5, duration 62, gain gain_setp_5")
print(" * I then run using all gains in the 10-20 dB span around what the first 2 runs tell me to find the best gain")
print(" * RUN 3: passes 5, duration 10, gain gain_all_20")
print(" * RUN 4: passes 5, duration 62, gain gain_all_20")
print(line_break + red) #------------------------------------------------------------------------------------------------
print("WARNING: " + nocolor)
print(" * if script exits before the end it does not reset the original gain and you must do it manually")
print(line_break) #-----------------------------------------------------------------------------------------------------
INSTRUCTIONS
# ----------------------------------------------------------------------------------------------------------------------
# PREREQUISITE INSTALLS
# PYTHON 3 sudo apt install python3
# PYTHON 3 PIP sudo apt install python3-pip
# BEAUTIFULTABLE sudo pip3 install beautifultable
# ----------------------------------------------------------------------------------------------------------------------
# INSTALL / UPDATE SCRIPT
# WGET SCRIPT sudo wget https://github.com/sxb1n9/ADSB/raw/main/GAIN_CHECK/gain_check_v3.py
# ----------------------------------------------------------------------------------------------------------------------
# MODIFY SETTINGS sudo nano gain_check_v3.py
# ----------------------------------------------------------------------------------------------------------------------
# REQUIRED GAIN_CHECK SETTINGS DESCRIPTIONS
# antenna_lat location of your antenna for distance calcs in xxx.xxx form) (use at least 3 decimal places for accuracy)
# antenna_lon location of your antenna for distance calcs in xxx.xxx form) (use at least 3 decimal places for accuracy)
# pass_duration seconds for each gain (default 62)
# pass_number number of passes to aggregrate for totals (default 5)
# gain_choice variable of gains to use (gains_step_5) or list of gains seperated by space
# ----------------------------------------------------------------------------------------------------------------------
# REQUIRED DUMP1090 SETTINGS DESCRIPTIONS
# host url of dump1090 (default PIAWARE SD)
# port 30003 = SBS port (default PIAWARE SD)
# config_file path and filename of where gain settings are stored (default PIAWARE SD)
# config_setting gain setting before the gain number
# (ex. "rtlsdr-gain 49.6" the config_setting is "rtlsdr-gain" no space after)
# config_setting_after gain setting after the gain number
# (ex. "rtlsdr-gain 49.6 something" the config_setting_after is "something" no space before)
# (ex. "rtlsdr-gain 49.6" the config_setting_after is "")
# service_restart_cmd command to restart service to apply changed gain (default PIAWARE SD)
# ----------------------------------------------------------------------------------------------------------------------
# OPTIONAL SETTINGS DESCRIPTIONS
# distance_unit mile or km (don't change off miles as it doesn't update categories and columns)
# color_top_percent 5 values in same column within this percentage of the best value will also be highlighted in a different color
# ----------------------------------------------------------------------------------------------------------------------
# RUN sudo python3 gain_check_v3.py
# ----------------------------------------------------------------------------------------------------------------------
CHANGE LOG
# ----------------------------------------------------------------------------------------------------------------------
# CHANGELOG
# 3.0
# initial
# 3.1
# fix distance min
# save original value or gain and restore
# additional starting notes for users
# show all 8 types msg count
# second count for ground and air with lat/lon
# added other configs for other setups so that it can be used anywhere
# choose distance unit (mile, km)
# cleanup and document for release to others
# GAIN DESCION MAKING
# add top gain per category
# add color highlight at end for each column best on the table
# keep aircraft distance between all passes
# add seconds while receiving gain info
# 3.2
# not detecting minimums correctly
# not counting distance msgs correctly
# updated version and screenshots
# 3.3
# add in 2 columns for types 2 and 3 with lat lon
# add in pos_ll or positions with LATLON ranking
# updated install instructions thanks to (abcd567)
# fix issue with categories if set contains no values (issue found by (gavin323))
# categories naming updated to be more clear
# update script header display
# update script final header display to include script_name, script_version, and script_author
# remove distance change from miles for now because of all hardcoded categories and columns
# update script documentation to be more clear
# update formatting to use variables instead of hardcodes
# add additional formating
# cleanup config line variable naming
# fix config_setting and config_setting_after to make it actually work for other than PIAWARE SD
# update color display to work with all colors
# update to display table with values within color_top_percentage of best value
# ----------------------------------------------------------------------------------------------------------------------
I am unsure how to control readsb so you would need to fill out the config with the proper values as in the instructions
# ----------------------------------------------------------------------------------------------------------------------
# REQUIRED DUMP1090 SETTINGS DESCRIPTIONS
# host url of dump1090 (default PIAWARE SD)
# port 30003 = SBS port (default PIAWARE SD)
# config_file path and filename of where gain settings are stored (default PIAWARE SD)
# config_setting gain setting before the gain number
# (ex. "rtlsdr-gain 49.6" the config_setting is "rtlsdr-gain" no space after)
# config_setting_after gain setting after the gain number
# (ex. "rtlsdr-gain 49.6 something" the config_setting_after is "something" no space before)
# (ex. "rtlsdr-gain 49.6" the config_setting_after is "")
# service_restart_cmd command to restart service to apply changed gain (default PIAWARE SD)
# ----------------------------------------------------------------------------------------------------------------------
Glad to hear it worked out well for you. Hope it helps give some more clarity into gain settings.
It does matter when you run this tool as to how many planes are in the sky you should try to run it at peak time if possible as you will get the best results.
Example I live in downtown Phoenix, Arizona, and my antenna is 200 ft above the ground facing west with the building in between myself and the east direction, however i am about 3-4 miles from Phoenix Sky Harbor Airport to the east, so I get a lot of super close planes as they fly by my highrise about 1 mile away and if my gain is too high it will overload. So I used the tool to find the best compromise between distance and close.
I can pick up planes about 275-300 miles away on full gain, however i lose tons of close planes if i do that. With my settings now I can get the close ones and the ones at the ground at the airport while still getting a 225-275 distance max range.
hope this helps.
b1n9
here are 3 screenshots right now at 8:38 local AZ time of range and ground planes at the same time.
This is my current range since running the script. I’m about 4.5 miles from my airport so can’t get ground coverage but get them right to the end of the runway