Add IQ Input Support with RSSI/SNR Metrics#628
Open
guido57 wants to merge 8 commits into
Open
Conversation
- Implement FM demodulator using csdr-compatible quadrature discriminator - Add IQ input mode via 'iq:RATE' device specification (reads complex float32 from stdin) - Numerical stability: mag_sq threshold, isfinite checks, output clamping - Successfully decodes APRS packets from 48kHz IQ samples - Tested with iq48k_cfloat.raw: all 3 packets decoded correctly
- Add IQ input feature to main README.md - Enhance IQ_INPUT.md with: - Quick start examples - Command line usage without config file - Multiple SDR usage examples (rx_sdr, rtl_sdr) - Detailed troubleshooting section - Technical details and algorithm description - Performance notes and validation info
- Added iq_metrics module to calculate RSSI and SNR from IQ samples - RSSI in dBFS with S-meter conversion (S1-S9, S9+dB) - SNR using noise floor tracking algorithm - Configurable via IQMETRICS config option (default: off) - Command line option -M to enable metrics - Metrics displayed at end of decoded packet lines - Only active for IQ input mode
Updated command to receive APRS from SDR using a Python script.
Updated the instructions for receiving APRS using SDRplay, replacing the rx_sdr command with a Python script. Adjusted examples and descriptions for clarity and consistency.
… into iq_input_added
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add IQ Input Support with RSSI/SNR Metrics
Summary
This pull request adds native IQ (In-phase/Quadrature) sample input support to Direwolf, enabling direct integration with Software Defined Radios (SDRs) and providing real-time signal quality metrics (RSSI and SNR) for received packets.
Motivation
Currently, Direwolf requires audio input (either from a sound card or piped audio stream). To use SDR hardware, users must:
This PR eliminates these limitations by:
What's New
Core Features
IQ Input Mode (
iq:RATEsyntax)iq:48000for 48 kHz)cat samples.cf32 | direwolf -r 48000 -n 1 iq:48000Signal Quality Metrics
[RSSI=-10.5 dBFS (S9+35), SNR=52.3 dB]IQMETRICS ON/OFFin config fileFM Demodulation Module (
fm_demod.c/h)Files Added/Modified
New Files:
src/iq_metrics.c/h- RSSI/SNR calculation enginesrc/fm_demod.c/h- FM demodulation from IQ samplesIQ_INPUT.md- Comprehensive usage documentationtest/iq/- Test files and validation scriptsModified Files:
src/audio.c- IQ input integrationsrc/direwolf.c- Command-line parsing, metrics displaysrc/config.c/h-IQMETRICSconfiguration optionsrc/CMakeLists.txt- Build system updatesREADME.md- Feature documentationUsage Examples
Basic IQ Input
Configuration File
Technical Details
IQ Metrics Calculation
RSSI (Received Signal Strength Indicator):
RSSI = 20 * log10(sqrt(I² + Q²))SNR (Signal-to-Noise Ratio):
SNR = 20 * log10(signal_level / noise_floor)FM Demodulation Algorithm
Quadrature demodulation with proper signal conditioning:
Performance Characteristics
Testing
Test Environment
Validation Results
Test Scripts
test-iq-signal.sh- Automated validation with test filestest/iq/test_fmdemod.py- FM demod unit teststest/iq/IQMETRICS_USAGE.md- Testing documentationBackward Compatibility
✅ 100% Backward Compatible
-,stdin, audio devices)IQMETRICScontinue to workBuild System
Documentation
Complete documentation in
IQ_INPUT.mdcovers:Future Enhancements (Not in this PR)
Potential follow-up features:
Breaking Changes
None. This PR is fully additive.
Checklist
Related Issues
This addresses common user requests for:
Credits
Developed by: Guido Notari (IW5ALZ) / guido57
Based on: Direwolf by John Langner (WB2OSZ)
Tested with: APRS network traffic on 144.800 MHz
License
This code is released under the same license as Direwolf (GPLv2+).
Example Output
Questions?
Please feel free to ask questions or request changes. I'm happy to:
Thank you for considering this contribution!