discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss-gnuradio] how to show dB instead of dBFS in the FFT-Plot Sink


From: Markus Feldmann
Subject: [Discuss-gnuradio] how to show dB instead of dBFS in the FFT-Plot Sink
Date: Wed, 04 Mar 2009 14:10:46 +0100
User-agent: Mozilla-Thunderbird 2.0.0.19 (X11/20090103)

Hi All,

and thank you All for your Answers in my last thread.

Now i want to know, how i can convert the showing
values in the Y-Axis of the FFT-Plot Sink to dB, so that
i can interpret this correctly.

Do i have to define the max and min input value first ?
Results an input voltage 3.3V in the max Value(0dBFS)
i can watch in the FFT-Plot sink ?
Results an input voltage 0V in the min Value i can
watch in the FFT-Plot sink ?

As Stefan BrĂ¼ns said in my last Thread:
"The reference point is 0dbFS - FS meaning Full Scale,
-32768...32767. The signal power you need to get this
readings from the ADC, or more exactly from the FPGA
depends on the daughterboard, PGA setting on the daughterboard,
decimation ...

You have to calibrate your USRP to get from the sampling
values to input power in Watts."

So if i read for example the value +7.079 from my FFT-Plot
Sink, what does this mean ?
Is this higher than the reference(0dBFS) Point ?
I thouht the reference is the highest point.

How can i calibrate my USRP to get from the sampling values
to input power in dBW ?

I experimented with an example(See Attachment), but
this example use a virtual signal(software generated signal)
Amplitude of Signal:    Value of FFT-Plot:
10e-3                   -12.921
100e-3                  7.079
1000e-3                 27.079

So inreasing the Value with the multiply of 10 let the
y-Axis of the FFT-Plot increase by 20dB.
This behaves like dBW not dBV ?

Regards Markus
<?xml version='1.0' encoding='ASCII'?>
<flow_graph>
  <timestamp>Wed Mar  4 13:13:25 2009</timestamp>
  <block>
    <key>options</key>
    <param>
      <key>id</key>
      <value>course_fine</value>
    </param>
    <param>
      <key>_enabled</key>
      <value>True</value>
    </param>
    <param>
      <key>title</key>
      <value>Course - Fine</value>
    </param>
    <param>
      <key>author</key>
      <value>example</value>
    </param>
    <param>
      <key>description</key>
      <value>gnuradio flow graph</value>
    </param>
    <param>
      <key>window_size</key>
      <value>1280, 1024</value>
    </param>
    <param>
      <key>generate_options</key>
      <value>wx_gui</value>
    </param>
    <param>
      <key>category</key>
      <value>Custom</value>
    </param>
    <param>
      <key>realtime_scheduling</key>
      <value></value>
    </param>
    <param>
      <key>_coordinate</key>
      <value>(10, 10)</value>
    </param>
    <param>
      <key>_rotation</key>
      <value>0</value>
    </param>
  </block>
  <block>
    <key>variable_slider</key>
    <param>
      <key>id</key>
      <value>freq_fine</value>
    </param>
    <param>
      <key>_enabled</key>
      <value>True</value>
    </param>
    <param>
      <key>label</key>
      <value>Freq Fine (hz)</value>
    </param>
    <param>
      <key>value</key>
      <value>0</value>
    </param>
    <param>
      <key>min</key>
      <value>-1000</value>
    </param>
    <param>
      <key>max</key>
      <value>1000</value>
    </param>
    <param>
      <key>num_steps</key>
      <value>1000</value>
    </param>
    <param>
      <key>slider_length</key>
      <value>200</value>
    </param>
    <param>
      <key>slider_type</key>
      <value>horizontal</value>
    </param>
    <param>
      <key>grid_pos</key>
      <value></value>
    </param>
    <param>
      <key>_coordinate</key>
      <value>(226, 53)</value>
    </param>
    <param>
      <key>_rotation</key>
      <value>0</value>
    </param>
  </block>
  <block>
    <key>variable_slider</key>
    <param>
      <key>id</key>
      <value>freq_course</value>
    </param>
    <param>
      <key>_enabled</key>
      <value>True</value>
    </param>
    <param>
      <key>label</key>
      <value>Freq Course (khz)</value>
    </param>
    <param>
      <key>value</key>
      <value>0</value>
    </param>
    <param>
      <key>min</key>
      <value>-samp_rate/2e3</value>
    </param>
    <param>
      <key>max</key>
      <value>samp_rate/2e3</value>
    </param>
    <param>
      <key>num_steps</key>
      <value>1000</value>
    </param>
    <param>
      <key>slider_length</key>
      <value>200</value>
    </param>
    <param>
      <key>slider_type</key>
      <value>horizontal</value>
    </param>
    <param>
      <key>grid_pos</key>
      <value></value>
    </param>
    <param>
      <key>_coordinate</key>
      <value>(221, 237)</value>
    </param>
    <param>
      <key>_rotation</key>
      <value>0</value>
    </param>
  </block>
  <block>
    <key>variable</key>
    <param>
      <key>id</key>
      <value>freq</value>
    </param>
    <param>
      <key>_enabled</key>
      <value>True</value>
    </param>
    <param>
      <key>value</key>
      <value>freq_fine + freq_course*1e3</value>
    </param>
    <param>
      <key>_coordinate</key>
      <value>(109, 169)</value>
    </param>
    <param>
      <key>_rotation</key>
      <value>0</value>
    </param>
  </block>
  <block>
    <key>wxgui_fftsink2</key>
    <param>
      <key>id</key>
      <value>wxgui_fftsink2_0</value>
    </param>
    <param>
      <key>_enabled</key>
      <value>True</value>
    </param>
    <param>
      <key>type</key>
      <value>complex</value>
    </param>
    <param>
      <key>title</key>
      <value>FFT Plot</value>
    </param>
    <param>
      <key>samp_rate</key>
      <value>samp_rate</value>
    </param>
    <param>
      <key>baseband_freq</key>
      <value>0</value>
    </param>
    <param>
      <key>y_per_div</key>
      <value>10</value>
    </param>
    <param>
      <key>y_divs</key>
      <value>8</value>
    </param>
    <param>
      <key>ref_level</key>
      <value>50</value>
    </param>
    <param>
      <key>fft_size</key>
      <value>1024</value>
    </param>
    <param>
      <key>fft_rate</key>
      <value>30</value>
    </param>
    <param>
      <key>avg_alpha</key>
      <value>0</value>
    </param>
    <param>
      <key>average</key>
      <value>False</value>
    </param>
    <param>
      <key>peak_hold</key>
      <value>False</value>
    </param>
    <param>
      <key>grid_pos</key>
      <value></value>
    </param>
    <param>
      <key>_coordinate</key>
      <value>(639, 132)</value>
    </param>
    <param>
      <key>_rotation</key>
      <value>0</value>
    </param>
  </block>
  <block>
    <key>gr_throttle</key>
    <param>
      <key>id</key>
      <value>gr_throttle_0</value>
    </param>
    <param>
      <key>_enabled</key>
      <value>True</value>
    </param>
    <param>
      <key>type</key>
      <value>complex</value>
    </param>
    <param>
      <key>samples_per_second</key>
      <value>samp_rate</value>
    </param>
    <param>
      <key>vlen</key>
      <value>1</value>
    </param>
    <param>
      <key>_coordinate</key>
      <value>(479, 228)</value>
    </param>
    <param>
      <key>_rotation</key>
      <value>0</value>
    </param>
  </block>
  <block>
    <key>variable</key>
    <param>
      <key>id</key>
      <value>samp_rate</value>
    </param>
    <param>
      <key>_enabled</key>
      <value>True</value>
    </param>
    <param>
      <key>value</key>
      <value>16000</value>
    </param>
    <param>
      <key>_coordinate</key>
      <value>(10, 170)</value>
    </param>
    <param>
      <key>_rotation</key>
      <value>0</value>
    </param>
  </block>
  <block>
    <key>variable_slider</key>
    <param>
      <key>id</key>
      <value>vol_0</value>
    </param>
    <param>
      <key>_enabled</key>
      <value>True</value>
    </param>
    <param>
      <key>label</key>
      <value></value>
    </param>
    <param>
      <key>value</key>
      <value>1</value>
    </param>
    <param>
      <key>min</key>
      <value>10e-3</value>
    </param>
    <param>
      <key>max</key>
      <value>1</value>
    </param>
    <param>
      <key>num_steps</key>
      <value>100</value>
    </param>
    <param>
      <key>slider_length</key>
      <value>200</value>
    </param>
    <param>
      <key>slider_type</key>
      <value>horizontal</value>
    </param>
    <param>
      <key>grid_pos</key>
      <value></value>
    </param>
    <param>
      <key>_coordinate</key>
      <value>(365, 372)</value>
    </param>
    <param>
      <key>_rotation</key>
      <value>0</value>
    </param>
  </block>
  <block>
    <key>gr_sig_source_x</key>
    <param>
      <key>id</key>
      <value>gr_sig_source_x_0</value>
    </param>
    <param>
      <key>_enabled</key>
      <value>True</value>
    </param>
    <param>
      <key>type</key>
      <value>complex</value>
    </param>
    <param>
      <key>samp_rate</key>
      <value>samp_rate</value>
    </param>
    <param>
      <key>waveform</key>
      <value>gr.GR_COS_WAVE</value>
    </param>
    <param>
      <key>freq</key>
      <value>freq</value>
    </param>
    <param>
      <key>amp</key>
      <value>vol_0</value>
    </param>
    <param>
      <key>offset</key>
      <value>0</value>
    </param>
    <param>
      <key>_coordinate</key>
      <value>(438, 74)</value>
    </param>
    <param>
      <key>_rotation</key>
      <value>0</value>
    </param>
  </block>
  <connection>
    <source_block_id>gr_throttle_0</source_block_id>
    <sink_block_id>wxgui_fftsink2_0</sink_block_id>
    <source_key>0</source_key>
    <sink_key>0</sink_key>
  </connection>
  <connection>
    <source_block_id>gr_sig_source_x_0</source_block_id>
    <sink_block_id>gr_throttle_0</sink_block_id>
    <source_key>0</source_key>
    <sink_key>0</sink_key>
  </connection>
</flow_graph>
#!/usr/bin/env python
##################################################
# Gnuradio Python Flow Graph
# Title: Course - Fine
# Author: example
# Description: gnuradio flow graph
# Generated: Wed Mar  4 13:21:26 2009
##################################################

from gnuradio import gr
from gnuradio.wxgui import fftsink2
from grc_gnuradio import wxgui as grc_wxgui
import wx

class course_fine(grc_wxgui.top_block_gui):

        def __init__(self):
                grc_wxgui.top_block_gui.__init__(
                        self,
                        title="GRC - Executing: Course - Fine",
                )

                ##################################################
                # Variables
                ##################################################
                self.freq_fine = freq_fine = 0
                self.freq_course = freq_course = 0
                self.vol_0 = vol_0 = 1
                self.samp_rate = samp_rate = 16000
                self.freq = freq = freq_fine + freq_course*1e3

                ##################################################
                # Controls
                ##################################################
                _freq_fine_control = grc_wxgui.slider_horizontal_control(
                        window=self.GetWin(),
                        callback=self.set_freq_fine,
                        label="Freq Fine (hz)",
                        value=freq_fine,
                        min=-1000,
                        max=1000,
                        num_steps=1000,
                        slider_length=200,
                )
                self.Add(_freq_fine_control)
                _freq_course_control = grc_wxgui.slider_horizontal_control(
                        window=self.GetWin(),
                        callback=self.set_freq_course,
                        label="Freq Course (khz)",
                        value=freq_course,
                        min=-samp_rate/2e3,
                        max=samp_rate/2e3,
                        num_steps=1000,
                        slider_length=200,
                )
                self.Add(_freq_course_control)
                _vol_0_control = grc_wxgui.slider_horizontal_control(
                        window=self.GetWin(),
                        callback=self.set_vol_0,
                        label='vol_0',
                        value=vol_0,
                        min=10e-3,
                        max=1,
                        num_steps=100,
                        slider_length=200,
                )
                self.Add(_vol_0_control)

                ##################################################
                # Blocks
                ##################################################
                self.gr_sig_source_x_0 = gr.sig_source_c(samp_rate, 
gr.GR_COS_WAVE, freq, vol_0, 0)
                self.gr_throttle_0 = gr.throttle(gr.sizeof_gr_complex*1, 
samp_rate)
                self.wxgui_fftsink2_0 = fftsink2.fft_sink_c(
                        self.GetWin(),
                        baseband_freq=0,
                        y_per_div=10,
                        y_divs=8,
                        ref_level=50,
                        sample_rate=samp_rate,
                        fft_size=1024,
                        fft_rate=30,
                        average=False,
                        avg_alpha=None,
                        title="FFT Plot",
                        peak_hold=False,
                )
                self.Add(self.wxgui_fftsink2_0.win)

                ##################################################
                # Connections
                ##################################################
                self.connect((self.gr_throttle_0, 0), (self.wxgui_fftsink2_0, 
0))
                self.connect((self.gr_sig_source_x_0, 0), (self.gr_throttle_0, 
0))

        def set_freq_fine(self, freq_fine):
                self.freq_fine = freq_fine
                self.set_freq(self.freq_fine + self.freq_course*1e3)

        def set_freq_course(self, freq_course):
                self.freq_course = freq_course
                self.set_freq(self.freq_fine + self.freq_course*1e3)

        def set_vol_0(self, vol_0):
                self.vol_0 = vol_0
                self.gr_sig_source_x_0.set_amplitude(self.vol_0)

        def set_samp_rate(self, samp_rate):
                self.samp_rate = samp_rate
                self.wxgui_fftsink2_0.set_sample_rate(self.samp_rate)
                self.gr_sig_source_x_0.set_sampling_freq(self.samp_rate)

        def set_freq(self, freq):
                self.freq = freq
                self.gr_sig_source_x_0.set_frequency(self.freq)

if __name__ == '__main__':
        tb = course_fine()
        tb.Run()


reply via email to

[Prev in Thread] Current Thread [Next in Thread]