Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.8.1-beta2 - KA9Q Channel Filter, RS41/DFM Estimator BW Tweaks #962

Merged
merged 2 commits into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ Improvements from the upstream RS codebase will be merged into this codebase whe
Please consider joining the Google Group to receive updates on new software features:
https://groups.google.com/forum/#!forum/radiosonde_auto_rx

We also have a channel in the SondeHub Discord server: https://sondehub.org/go/discord

## Presentations
* Linux.conf.au 2019 - https://www.youtube.com/watch?v=YBy-bXEWZeM
* UKHAS Conference 2019 - [Presented via Skype](https://youtu.be/azDJmMywBgw?t=643) which had some audio issues at the start. Slides [here](https://rfhead.net/sondes/auto_rx_presentation_UKHAS2019.pdf).
Expand Down
2 changes: 1 addition & 1 deletion auto_rx/autorx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# MINOR - New sonde type support, other fairly big changes that may result in telemetry or config file incompatability issus.
# PATCH - Small changes, or minor feature additions.

__version__ = "1.8.1-beta1"
__version__ = "1.8.1-beta2"

# Global Variables

Expand Down
35 changes: 21 additions & 14 deletions auto_rx/autorx/decode.py
Original file line number Diff line number Diff line change
Expand Up @@ -829,9 +829,10 @@ def generate_decoder_command_experimental(self):
_baud_rate = 4800
_sample_rate = 48000 # 10x Oversampling

# Limit FSK estimator window to roughly +/- 10 kHz
_lower = -10000
_upper = 10000
# Limit FSK estimator window to roughly +/- 5 kHz
_lower = -5000
_upper = 5000


demod_cmd = get_sdr_iq_cmd(
sdr_type = self.sdr_type,
Expand All @@ -844,14 +845,17 @@ def generate_decoder_command_experimental(self):
ppm = self.ppm,
gain = self.gain,
bias = self.bias,
dc_block = True
dc_block = True,
channel_filter = 5000 # +/- 5 kHz channel filter.
)

# Add in tee command to save IQ to disk if debugging is enabled.
if self.save_decode_iq:
demod_cmd += f" tee {self.save_decode_iq_path} |"

demod_cmd += "./fsk_demod --cs16 -b %d -u %d -s --stats=%d 2 %d %d - -" % (
# Use a 4800 Hz mask estimator to better avoid adjacent sonde issues.
# Also seems to give a small performance bump.
demod_cmd += "./fsk_demod --cs16 -b %d -u %d -s --mask 4800 --stats=%d 2 %d %d - -" % (
_lower,
_upper,
_stats_rate,
Expand Down Expand Up @@ -949,15 +953,16 @@ def generate_decoder_command_experimental(self):
_baud_rate = 2500
_sample_rate = 50000 # 10x Oversampling

# Limit FSK estimator window to roughly +/- 10 kHz
_lower = -10000
_upper = 10000
# Limit FSK estimator window to roughly +/- 5 kHz
_lower = -5000
_upper = 5000

if (abs(403200000 - self.sonde_freq) < 20000) and (self.sdr_type == "RTLSDR"):
# Narrow up the frequency estimator window if we are close to
# the 403.2 MHz RTLSDR Spur.
_lower = -8000
_upper = 8000
# Un-necessary.
# if (abs(403200000 - self.sonde_freq) < 20000) and (self.sdr_type == "RTLSDR"):
# # Narrow up the frequency estimator window if we are close to
# # the 403.2 MHz RTLSDR Spur.
# _lower = -8000
# _upper = 8000

demod_cmd = get_sdr_iq_cmd(
sdr_type = self.sdr_type,
Expand All @@ -970,14 +975,16 @@ def generate_decoder_command_experimental(self):
ppm = self.ppm,
gain = self.gain,
bias = self.bias,
dc_block = True
dc_block = True,
channel_filter = 5000
)

# Add in tee command to save IQ to disk if debugging is enabled.
if self.save_decode_iq:
demod_cmd += f" tee {self.save_decode_iq_path} |"

# NOTE - Using inverted soft decision outputs, so DFM type detection works correctly.
# No mask estimator - DFMs seem to decode better without it!
demod_cmd += "./fsk_demod --cs16 -b %d -u %d -s -i --stats=%d 2 %d %d - -" % (
_lower,
_upper,
Expand Down
18 changes: 14 additions & 4 deletions auto_rx/autorx/ka9q.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,29 @@ def ka9q_setup_channel(
sdr_hostname,
frequency,
sample_rate,
scan
scan,
channel_filter = None
):
if scan:
ssrc="04"
else:
ssrc="01"

# tune --samprate 48000 --frequency 404m09 --mode iq --ssrc 404090000 --radio sonde.local

if channel_filter:
_low = int(channel_filter * -1.0)
_high = int(channel_filter)
else:
_low = int(int(sample_rate) / (-2.4))
_high = int(int(sample_rate) / 2.4)

_cmd = (
f"{timeout_cmd()} 5 " # Add a timeout, because connections to non-existing servers block for ages
f"tune "
f"--samprate {int(sample_rate)} "
f"--mode iq "
f"--low {int(int(sample_rate) / (-2.4))} --high {int(int(sample_rate) / 2.4)} "
f"--low {_low} --high {_high} "
f"--frequency {int(frequency)} "
f"--ssrc {round(frequency / 1000)}{ssrc} "
f"--radio {sdr_hostname}"
Expand Down Expand Up @@ -120,15 +129,16 @@ def ka9q_get_iq_cmd(
sdr_hostname,
frequency,
sample_rate,
scan
scan,
channel_filter = None
):
if scan:
ssrc="04"
else:
ssrc="01"

# We need to setup a channel before we can use it!
_setup_success = ka9q_setup_channel(sdr_hostname, frequency, sample_rate, scan)
_setup_success = ka9q_setup_channel(sdr_hostname, frequency, sample_rate, scan, channel_filter)

if not _setup_success:
logging.critical(f"KA9Q ({sdr_hostname}) - Could not setup rx channel! Decoder will likely timeout.")
Expand Down
10 changes: 6 additions & 4 deletions auto_rx/autorx/sdr_wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,8 @@ def get_sdr_iq_cmd(
sdr_hostname = "",
sdr_port = 5555,
ss_iq_path = "./ss_iq",
scan = False
scan = False,
channel_filter = None
):
"""
Get a command-line argument to get IQ (signed 16-bit) from a SDR
Expand All @@ -303,7 +304,8 @@ def get_sdr_iq_cmd(
Arguments for KA9Q SDR Server / SpyServer:
sdr_hostname (str): Hostname of KA9Q Server
sdr_port (int): Port number of KA9Q Server
scan (bool): Create unique SSRC for scan attempts
scan (bool): Create unique SSRC for scan attempts (KA9Q Only)
channel_filter (int/float): Set a high/lowpass frequency for a KA9Q channel.

Arguments for SpyServer Client:
ss_iq_path (str): Path to spyserver IQ client utility.
Expand Down Expand Up @@ -361,9 +363,9 @@ def get_sdr_iq_cmd(
return _cmd

if sdr_type == "KA9Q":
_cmd = ka9q_get_iq_cmd(sdr_hostname, frequency, sample_rate, scan)
_cmd = ka9q_get_iq_cmd(sdr_hostname, frequency, sample_rate, scan, channel_filter)

if dc_block:
if dc_block and ("KA9Q" not in sdr_type):
_cmd += _dc_remove

return _cmd
Expand Down
5 changes: 2 additions & 3 deletions auto_rx/station.cfg.example
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@
#
# RTLSDR - Use one or more RTLSDRs
#
# EXPERIMENTAL / NOT IMPLEMENTED options:
# Network SDR Server options:
# SpyServer - Use an Airspy SpyServer
# KA9Q - Use a KA9Q-Radio Server
# WARNING: These are still under development and may not work correctly.
#
sdr_type = RTLSDR

Expand Down Expand Up @@ -140,7 +139,7 @@ always_decode = []
# STATION LOCATION #
####################
# Used by the Sondehub Uploader, APRS Uploader, and by Rotator Control
# Lat/Lon in decimal degrees, altitude in metres.
# Lat/Lon in decimal degrees, altitude in metres (AMSL).
# Note: You do not need to specify your home station accurately if you don't want to!
# Feel free to use a position somewhere near your general area, that doesn't identify your home location.
#
Expand Down
15 changes: 7 additions & 8 deletions auto_rx/station.cfg.example.network
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@
#
# RTLSDR - Use one or more RTLSDRs
#
# EXPERIMENTAL / NOT IMPLEMENTED options:
# Network SDR Server options:
# SpyServer - Use an Airspy SpyServer
# KA9Q - Use a KA9Q-Radio Server
# WARNING: These are still under development and may not work correctly.
#
sdr_type = SpyServer
sdr_type = KA9Q


#
Expand All @@ -38,7 +37,7 @@ sdr_type = SpyServer
# If SDR type is either KA9Q or SpyServer, this defines the maximum number of parallel
# decoding/scan tasks. On a RPi 4, ~5 tasks are possible.
#
sdr_quantity = 5
sdr_quantity = 10


#
Expand All @@ -48,7 +47,7 @@ sdr_quantity = 5
# Is using KA9Q-Radio, the hostname of the 'radio' server (e.g. sonde.local) needs to be
# defined, and the port number is unused.
#
sdr_hostname = localhost
sdr_hostname = sonde.local
sdr_port = 5555

#
Expand Down Expand Up @@ -141,7 +140,7 @@ always_decode = []
# STATION LOCATION #
####################
# Used by the Sondehub Uploader, APRS Uploader, and by Rotator Control
# Lat/Lon in decimal degrees, altitude in metres.
# Lat/Lon in decimal degrees, altitude in metres (AMSL).
# Note: You do not need to specify your home station accurately if you don't want to!
# Feel free to use a position somewhere near your general area, that doesn't identify your home location.
#
Expand Down Expand Up @@ -550,8 +549,8 @@ scan_delay = 10
quantization = 10000
# Decoder Spacing Limit - Only start a new decoder if it is separated from an existing decoder by at least
# this value (Hz). This helps avoid issues where a drifting radiosonde is detected on two adjacent channels.
# If you regularly encounter radiosondes on adjacent (10kHz) channels, then set this value to 5000.
decoder_spacing_limit = 15000
# For Network SDR systems, we set this to a lower value than the usual default of 15 kHz, as we have better channel filtering.
decoder_spacing_limit = 5000
# Temporary Block Time (minutes) - How long to block encrypted or otherwise non-decodable sondes for.
temporary_block_time = 120
# Upload when (seconds_since_utc_epoch%upload_rate) == 0. Otherwise just delay upload_rate seconds between uploads.
Expand Down
Loading