Log raw data from the usrp_spectrum_sense.py

I’m using the usrp_spectrum_sense.py to get the raw data for the wide
band
spectrum for FFT in the FPGA . The thing confused me is what the raw
data
is. Is that the complex signal before fft ?
As m.raw_data is a string that contains the binary floats, when i try
to
log it in a txt file, it outputs Garbled text, and it seems only take
few
millisecond, and how to control the time to do the spectrum sensing btw.
here is the code for exporting the m.raw_data

    text_file = open("Output.txt", "w")
    text_file.write("binary floats: %s" % m.raw_data)
    text_file.close()

Thanks a lot


View this message in context:
http://gnuradio.4.n7.nabble.com/Log-raw-data-from-the-usrp-spectrum-sense-py-tp51503.html
Sent from the GnuRadio mailing list archive at Nabble.com.

Hi Leo,

usrp_spectrum_sense actually has nothing to do with the FPGA – in fact,
it just gets complex samples from a USRP, and displays them in frequency
domain; so hopefully that answers your question :slight_smile:

Regarding writing the raw binary data to a file: These are binary
samples, and not text, and thus you won’t see anything useful in a text
file.

Best regards,
Marcus

When u say complex samples, i thought it should in time domain, and
after the
the fft block, it transfer to frequency domain. I just want use USRP to
collect the a wide band signal around and save the data to the txt file,
so
i use the usr_spectrum_sense.

and how to make the binary samples visualized and could be processed?
or the s2v is the thing I may consider?


View this message in context:
http://gnuradio.4.n7.nabble.com/Log-raw-data-from-the-usrp-spectrum-sense-py-tp51503p51506.html
Sent from the GnuRadio mailing list archive at Nabble.com.

when u said:save the signal from a USRP to a file, that’s a two
block flow graph in the GNU Radio companion: Just connect the USRP
Source to a File Sink, parameterize both to your likings, and you’re
done.

the two block flow graph can only use for narrow band, my idea is to
sensing
the wide band signal, such as Wi-Fi, and get the complex sample.


View this message in context:
http://gnuradio.4.n7.nabble.com/Log-raw-data-from-the-usrp-spectrum-sense-py-tp51503p51534.html
Sent from the GnuRadio mailing list archive at Nabble.com.

When u say complex samples, i thought it should in time domain,

yes, these are time domain samples.

I just want use USRP to
collect the a wide band signal around and save the data to the txt file,

Usually, there’s no good reason to save millions of samples in text
format – it’s not really useful, just big.
If you, for some reason, need that, you can either write your own sink
that does that, or use python, octave, matlab, C, C++, or whatever you
like to load the binaries and print out strings representing complex
numbers textually.

so i use the usr_spectrum_sense.
usrp_spectrum_sense is really a visualization demo.
If you just want to save the signal from a USRP to a file, that’s a two
block flow graph in the GNU Radio companion: Just connect the USRP
Source to a File Sink, parameterize both to your likings, and you’re
done.

If that sounds strange to you, I can really recommend going through the
guided tutorials 1, 2 and 3, and most of your questions will be answered
:slight_smile:
http://gnuradio.org/redmine/projects/gnuradio/wiki/Guided_Tutorials

Greetings,
Marcus

Hello Leo,

with the USRP source you can get as much bandwidth at once as your
sampling rate allows, and it will give you the complex samples. The USRP
source will give you all the instantaneous bandwidth the USRP delivers
to your PC. You won’t see more at once when using usrp_spectrum_sense,
as it internally uses the very same USRP source.

I don’t know which USRP model you are currently using, but all but the
USRP1/b100/e1x0 will do enough bandwidth to allow you to monitor a WiFi
channel at once, as long as your PC is fast enough.

Greetings,
Marcus

Hi sir,
I’m using USRP2 now, as the sample rate is limited to 25MHz for 16bit
sample, I thought it can only sweep 25MHz at one time, but when u said
USRP
source can get as much bandwidth at once, it confused me.
The Wi-Fi frequency is from 2.38GHz to 2.42GHz,which 25MHz is not enough
for
such large bandwidth. Or is there any misunderstanding of these concept?


View this message in context:
http://gnuradio.4.n7.nabble.com/Log-raw-data-from-the-usrp-spectrum-sense-py-tp51503p51539.html
Sent from the GnuRadio mailing list archive at Nabble.com.

Hi sir,
I have ran the uhd_msg_tune.grc,but its quiet hard to understand the
python
code for me.

I just set the sample rate to 40M, and centre frequency to 2.4G, it
comes
out power against the frequency of the signal and the graph seems more
static than dynamic.

I wonder how it achieved without fft, and how to export the raw complex
data
instead of power?

cuz I want to install the gnuradio into a embedded system instead of PC,
I’m
working on the data collection, after get the raw data, I will pass it
to
the FPGA for the fft, and the output will be further processed for
signal
classification.

Thanks a lot
Yang


View this message in context:
http://gnuradio.4.n7.nabble.com/Log-raw-data-from-the-usrp-spectrum-sense-py-tp51503p51545.html
Sent from the GnuRadio mailing list archive at Nabble.com.

Hi Leo,

thanks for following up on this!
I’ll just comment in your reply; I hope that is OK for you.

On 12/04/2014 06:05 PM, Leo Yang wrote:

Hi sir,
I’m using USRP2 now, as the sample rate is limited to 25MHz for 16bit
sample, I thought it can only sweep 25MHz at one time, but when u said USRP
source can get as much bandwidth at once, it confused me.
Yes, the instantaneous maximum bandwidth with 16bit over Gigabit
Ethernet is 25MHz. But: That is not “sweeping”, it’s just sampling that
much bandwidth at once.
The Wi-Fi frequency is from 2.38GHz to 2.42GHz,which 25MHz is not enough for
such large bandwidth. Or is there any misunderstanding of these concept?
I don’t think you’re misunderstanding :slight_smile:
A standard 802.11g channel is only rougly 20MHz wide, the 802.11n
transmissions might be twice as wide, so I guess this was my
misunderstanding.

I’m understanding now that you want to have a sweeping spectrum
analyzer; usrp_spectrum_sense implements that, but in a manner that does
not use timed commands, which is kind of undesirable for a
However, in the gr-uhd/example/grc folder, you will find an example,
called uhd_msg_tune.grc, which behaves a bit similar to
usrp_spectrum_sense, and you could connect a metadata file sink parallel
to the QT gui sink.

Greetings,
Marcus

Hi Yang,

the Power of the FFT is only calculated inside the graphical sink, the
connection between the USRP source and the graphical sink represents a
complex sample stream.

I’m still not quite understanding what you really want the USRP to do,
would you mind explaining that again?

Best regards,
Marcus

thank u sir,

now, i just want to export the complex stream that goes into the sink,
is
that possible? whats the format of the that complex stream?
cuz, in the my group design, USRP is in charge of signal collection, the
rest signal processing(FFT) work will pass to a FPGA.


View this message in context:
http://gnuradio.4.n7.nabble.com/Log-raw-data-from-the-usrp-spectrum-sense-py-tp51503p51562.html
Sent from the GnuRadio mailing list archive at Nabble.com.

Hello Yang,
On 12/05/2014 12:47 PM, Leo Yang wrote:

thank u sir,

now, i just want to export the complex stream that goes into the sink, is
that possible?
That is exactly what the file sink does, see the proposed solution I’ve
discussed in this thread.
whats the format of the that complex stream?
just pairs of 32bit floats, one after the other. [1]

Honestly, we’re starting to repeat ourselves; I think I don’t really
understand the issues you encounter, could you explain whether the
usrp_source->file_sink fits your needs or what is insufficient?

Greetings,
Marcus

[1]http://gnuradio.org/redmine/projects/gnuradio/wiki/FAQ#What-is-the-file-format-of-a-file_sink-How-can-I-read-files-produced-by-a-file-sink