# GNU Radio flow graph for Spectrum sensing

**URL:** <https://www.ruby-forum.com/t/gnu-radio-flow-graph-for-spectrum-sensing/231496>\
**Category:** GNU Radio\
**Created:** [August 12, 2014, 1:31am UTC](https://www.ruby-forum.com/t/gnu-radio-flow-graph-for-spectrum-sensing/231496 "2014-08-12T01:31:17Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![addis\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@addis\_a](https://www.ruby-forum.com/u/addis_a)\
**Post date:** [August 12, 2014, 1:31am UTC](https://www.ruby-forum.com/t/gnu-radio-flow-graph-for-spectrum-sensing/231496/1 "2014-08-12T01:31:17Z")

</div>

Hi guys,

I’m trying to configure a spectrum analyzer with GNU Radio and I had a  
many  
problems. I tried a lot of ways to do it but all of them failed.

More specifically, I need to get information about the FFT and store it.

I tried the following:

- I get data from the block RTL2832 and store it: this is generates a  
very  
big file data end a can’t open. In a file of a few seconds of storage  
(50Mb) I can’t recognize the power values.

- I try to store and after open it on a editor, but not work.

I think that there is any problem in the format of the data stored. Can  
you  
help? Anyone already can do it?

---

<div class="post-metadata">

**Author:** ![Rodrigo\_RozSSrio](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e19b73/32.png) [@Rodrigo\_RozSSrio](https://www.ruby-forum.com/u/Rodrigo_RozSSrio)\
**Post date:** [August 13, 2014, 2:01pm UTC](https://www.ruby-forum.com/t/gnu-radio-flow-graph-for-spectrum-sensing/231496/2 "2014-08-13T14:01:20Z")

</div>

How are you generating those files?

---

<div class="post-metadata">

**Author:** ![Rodrigo\_RozSSrio](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e19b73/32.png) [@Rodrigo\_RozSSrio](https://www.ruby-forum.com/u/Rodrigo_RozSSrio)\
**Post date:** [August 13, 2014, 11:30pm UTC](https://www.ruby-forum.com/t/gnu-radio-flow-graph-for-spectrum-sensing/231496/3 "2014-08-13T23:30:02Z")

</div>

Hi Martin,

I am generating by the following flowgraph:

RTL2832 source → FFT → File Sink

I tried too:

RTL2832 → File Sink

Is it right?

2014-08-13 9:00 GMT-03:00 Martin B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![Rodrigo\_RozSSrio](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e19b73/32.png) [@Rodrigo\_RozSSrio](https://www.ruby-forum.com/u/Rodrigo_RozSSrio)\
**Post date:** [August 14, 2014, 11:31am UTC](https://www.ruby-forum.com/t/gnu-radio-flow-graph-for-spectrum-sensing/231496/4 "2014-08-14T11:31:00Z")

</div>

Hi Rodrigo,  
both is right, due to Parseval’s Theorem stating that energy of a  
signal in time and frequency domain is equivalent.

Regarding “File is large”: of course it is; I don’t know what sampling  
rate you’re using, but assume you have 1MS/s of complex float, that will  
be  
2_32bit_10^6/s = 8MB/s of data.

Regarding “it cannot be opened”: Opened by what? Maybe you’re not aware  
of:  
[http://gnuradio.org/redmine/projects/gnuradio/wiki/FAQ#What-is-the-file-format-of-a-gr\_file\_sink-How-can-I-read-files-produced-by-a-file-sink](http://gnuradio.org/redmine/projects/gnuradio/wiki/FAQ#What-is-the-file-format-of-a-gr_file_sink-How-can-I-read-files-produced-by-a-file-sink)

Greetings,  
Marcus

---

<div class="post-metadata">

**Author:** ![Rodrigo\_RozSSrio](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e19b73/32.png) [@Rodrigo\_RozSSrio](https://www.ruby-forum.com/u/Rodrigo_RozSSrio)\
**Post date:** [August 14, 2014, 2:57pm UTC](https://www.ruby-forum.com/t/gnu-radio-flow-graph-for-spectrum-sensing/231496/5 "2014-08-14T14:57:46Z")

</div>

Hi Rodrigo (once again),

one of the wise elders reminded me that in the FFT, power is but  
proportional to the input power in time domain, due to a factor of  
fft\_length occuring when forward-backward transforming.

Greetings,  
Marcus

---

<div class="post-metadata">

**Author:** ![Rodrigo\_RozSSrio](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e19b73/32.png) [@Rodrigo\_RozSSrio](https://www.ruby-forum.com/u/Rodrigo_RozSSrio)\
**Post date:** [August 16, 2014, 1:55am UTC](https://www.ruby-forum.com/t/gnu-radio-flow-graph-for-spectrum-sensing/231496/6 "2014-08-16T01:55:39Z")

</div>

Hi Marcus,

Thanks for your reply. Now I understand the size of the file :D.  
I really used 1MS/s for sample rate.

Folowing what you said, I take directly form the source. I tried as you  
can  
see in the attachment (before I will save the values in the file).

With the filter FIR and looking for FFT, the values of the power seen  
different.

Is there other implementation to get the value of the power?

2014-08-14 9:56 GMT-03:00 Marcus Müller [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):
