From da4d89f2daca05cf9296f694bdc72eb4aaad3265 Mon Sep 17 00:00:00 2001 From: Corey Shields Date: Thu, 26 Jan 2017 08:36:35 -0500 Subject: [PATCH] waterfall fm_demod script fm_demod script that also writes waterfall data (credit to surligas, I'm just committing) Also FFT needs to be added to CMakeLists.txt to build in some conditions. see also satnogs/gr-satnogs#42 --- CMakeLists.txt | 2 +- apps/flowgraphs/fm_demod.grc | 108 +++++++++++++++++++++++++++- apps/flowgraphs/satnogs_fm_demod.py | 18 ++++- 3 files changed, 122 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 578a050..c59725c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -137,7 +137,7 @@ endif() # components required to the list of GR_REQUIRED_COMPONENTS (in all # caps such as FILTER or FFT) and change the version to the minimum # API compatible version required. -set(GR_REQUIRED_COMPONENTS RUNTIME) +set(GR_REQUIRED_COMPONENTS RUNTIME FFT) find_package(Gnuradio "3.7.7" REQUIRED) if(NOT CPPUNIT_FOUND) diff --git a/apps/flowgraphs/fm_demod.grc b/apps/flowgraphs/fm_demod.grc index 35abf0b..461cf59 100644 --- a/apps/flowgraphs/fm_demod.grc +++ b/apps/flowgraphs/fm_demod.grc @@ -557,11 +557,11 @@ TX sampling rate _coordinate - (736, 984) + (744, 988) _rotation - 0 + 180 id @@ -2329,6 +2329,104 @@ we shift the LO a little further 1000 + + satnogs_waterfall_sink + + alias + + + + center_freq + 0.0 + + + comment + + + + affinity + + + + _enabled + True + + + fft_size + 1024 + + + filename + waterfall_file_path + + + _coordinate + (1488, 248) + + + _rotation + 0 + + + id + satnogs_waterfall_sink_0 + + + mode + 1 + + + pps + 10 + + + samp_rate + audio_samp_rate + + + + parameter + + alias + + + + comment + + + + _enabled + True + + + _coordinate + (872, 988) + + + _rotation + 0 + + + id + waterfall_file_path + + + label + + + + short_id + + + + type + string + + + value + /tmp/waterfall.dat + + analog_quadrature_demod_cf_0 blocks_wavfile_sink_0 @@ -2341,6 +2439,12 @@ we shift the LO a little further 0 0 + + blks2_rational_resampler_xxx_1 + satnogs_waterfall_sink_0 + 0 + 0 + freq_xlating_fir_filter_xxx_0 blks2_rational_resampler_xxx_1 diff --git a/apps/flowgraphs/satnogs_fm_demod.py b/apps/flowgraphs/satnogs_fm_demod.py index b8d85ed..f97acc4 100755 --- a/apps/flowgraphs/satnogs_fm_demod.py +++ b/apps/flowgraphs/satnogs_fm_demod.py @@ -5,7 +5,7 @@ # Title: FM Generic Demodulation # Author: Manolis Surligas (surligas@gmail.com) # Description: A generic FM demodulation block -# Generated: Fri Jan 20 15:58:24 2017 +# Generated: Mon Jan 23 20:10:12 2017 ################################################## from gnuradio import analog @@ -24,7 +24,7 @@ import time class satnogs_fm_demod(gr.top_block): - def __init__(self, doppler_correction_per_sec=1000, file_path='test.wav', lo_offset=100e3, rigctl_port=4532, rx_freq=100e6, rx_sdr_device='usrpb200'): + def __init__(self, doppler_correction_per_sec=1000, file_path='test.wav', lo_offset=100e3, rigctl_port=4532, rx_freq=100e6, rx_sdr_device='usrpb200', waterfall_file_path='/tmp/waterfall.dat'): gr.top_block.__init__(self, "FM Generic Demodulation") ################################################## @@ -36,6 +36,7 @@ class satnogs_fm_demod(gr.top_block): self.rigctl_port = rigctl_port self.rx_freq = rx_freq self.rx_sdr_device = rx_sdr_device + self.waterfall_file_path = waterfall_file_path ################################################## # Variables @@ -53,6 +54,7 @@ class satnogs_fm_demod(gr.top_block): ################################################## # Blocks ################################################## + self.satnogs_waterfall_sink_0 = satnogs.waterfall_sink(audio_samp_rate, 0.0, 10, 1024, waterfall_file_path, 1) self.satnogs_tcp_rigctl_msg_source_0 = satnogs.tcp_rigctl_msg_source("127.0.0.1", rigctl_port, False, 1000, 1500) self.satnogs_coarse_doppler_correction_cc_0 = satnogs.coarse_doppler_correction_cc(rx_freq, samp_rate_rx) self.osmosdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + satnogs.hw_rx_settings[rx_sdr_device]['dev_arg'] ) @@ -84,6 +86,7 @@ class satnogs_fm_demod(gr.top_block): self.msg_connect((self.satnogs_tcp_rigctl_msg_source_0, 'freq'), (self.satnogs_coarse_doppler_correction_cc_0, 'freq')) self.connect((self.analog_quadrature_demod_cf_0, 0), (self.blocks_wavfile_sink_0, 0)) self.connect((self.blks2_rational_resampler_xxx_1, 0), (self.analog_quadrature_demod_cf_0, 0)) + self.connect((self.blks2_rational_resampler_xxx_1, 0), (self.satnogs_waterfall_sink_0, 0)) self.connect((self.freq_xlating_fir_filter_xxx_0, 0), (self.blks2_rational_resampler_xxx_1, 0)) self.connect((self.osmosdr_source_0, 0), (self.satnogs_coarse_doppler_correction_cc_0, 0)) self.connect((self.satnogs_coarse_doppler_correction_cc_0, 0), (self.freq_xlating_fir_filter_xxx_0, 0)) @@ -135,6 +138,12 @@ class satnogs_fm_demod(gr.top_block): self.osmosdr_source_0.set_antenna(satnogs.hw_rx_settings[self.rx_sdr_device]['antenna'], 0) self.set_audio_gain(satnogs.fm_demod_settings[self.rx_sdr_device]['audio_gain']) + def get_waterfall_file_path(self): + return self.waterfall_file_path + + def set_waterfall_file_path(self, waterfall_file_path): + self.waterfall_file_path = waterfall_file_path + def get_samp_rate_rx(self): return self.samp_rate_rx @@ -205,6 +214,9 @@ def argument_parser(): parser.add_option( "", "--rx-sdr-device", dest="rx_sdr_device", type="string", default='usrpb200', help="Set rx_sdr_device [default=%default]") + parser.add_option( + "", "--waterfall-file-path", dest="waterfall_file_path", type="string", default='/tmp/waterfall.dat', + help="Set waterfall_file_path [default=%default]") return parser @@ -212,7 +224,7 @@ def main(top_block_cls=satnogs_fm_demod, options=None): if options is None: options, _ = argument_parser().parse_args() - tb = top_block_cls(doppler_correction_per_sec=options.doppler_correction_per_sec, file_path=options.file_path, lo_offset=options.lo_offset, rigctl_port=options.rigctl_port, rx_freq=options.rx_freq, rx_sdr_device=options.rx_sdr_device) + tb = top_block_cls(doppler_correction_per_sec=options.doppler_correction_per_sec, file_path=options.file_path, lo_offset=options.lo_offset, rigctl_port=options.rigctl_port, rx_freq=options.rx_freq, rx_sdr_device=options.rx_sdr_device, waterfall_file_path=options.waterfall_file_path) tb.start() tb.wait()