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
This commit is contained in:
Corey Shields 2017-01-26 08:36:35 -05:00
parent 7184f551a0
commit da4d89f2da
3 changed files with 122 additions and 6 deletions

View File

@ -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)

View File

@ -557,11 +557,11 @@ TX sampling rate</value>
</param>
<param>
<key>_coordinate</key>
<value>(736, 984)</value>
<value>(744, 988)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
<value>180</value>
</param>
<param>
<key>id</key>
@ -2329,6 +2329,104 @@ we shift the LO a little further</value>
<value>1000</value>
</param>
</block>
<block>
<key>satnogs_waterfall_sink</key>
<param>
<key>alias</key>
<value></value>
</param>
<param>
<key>center_freq</key>
<value>0.0</value>
</param>
<param>
<key>comment</key>
<value></value>
</param>
<param>
<key>affinity</key>
<value></value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
<key>fft_size</key>
<value>1024</value>
</param>
<param>
<key>filename</key>
<value>waterfall_file_path</value>
</param>
<param>
<key>_coordinate</key>
<value>(1488, 248)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
<param>
<key>id</key>
<value>satnogs_waterfall_sink_0</value>
</param>
<param>
<key>mode</key>
<value>1</value>
</param>
<param>
<key>pps</key>
<value>10</value>
</param>
<param>
<key>samp_rate</key>
<value>audio_samp_rate</value>
</param>
</block>
<block>
<key>parameter</key>
<param>
<key>alias</key>
<value></value>
</param>
<param>
<key>comment</key>
<value></value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
<key>_coordinate</key>
<value>(872, 988)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
<param>
<key>id</key>
<value>waterfall_file_path</value>
</param>
<param>
<key>label</key>
<value></value>
</param>
<param>
<key>short_id</key>
<value></value>
</param>
<param>
<key>type</key>
<value>string</value>
</param>
<param>
<key>value</key>
<value>/tmp/waterfall.dat</value>
</param>
</block>
<connection>
<source_block_id>analog_quadrature_demod_cf_0</source_block_id>
<sink_block_id>blocks_wavfile_sink_0</sink_block_id>
@ -2341,6 +2439,12 @@ we shift the LO a little further</value>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>blks2_rational_resampler_xxx_1</source_block_id>
<sink_block_id>satnogs_waterfall_sink_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>freq_xlating_fir_filter_xxx_0</source_block_id>
<sink_block_id>blks2_rational_resampler_xxx_1</sink_block_id>

View File

@ -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()