Funcube spectrum analyzer

10.12.2011 11:49

I've written before about the Funcube Dongle Pro. Apart from receiving satellite telemetry and amateur narrow-band FM, it can also be useful as a poor man's spectrum analyzer.

I'm not talking about doing a Fourier transform on the baseband data. At around 80 kHz that's not really useful if you want to see the big picture, for instance when measuring spectrum of a DVB-T transmitter with a channel width of around 6 MHz.

What you can do however is to emulate a swept-tuned spectrum analyzer. You sweep the Funcube's tuner through the range of frequencies using steps of several tens of kHz and pipe the baseband stream to a software power detector. Then you can plot the received signal strength against the frequency and get a fancy graph like this:

Spectrum of a DVB-T transmitter measured using FCD

Of course, there's a catch. Funcube Dongle uses an audio codec that is connected to the user space through the ALSA interface. This means that after you change the tuner frequency the sampled data needs to go through plenty of big buffers before it gets to the detector.

So while the actual hardware might settle very quickly to the new frequency (I don't have data for the E4000 chip used in FCD, but other comparable tuners have channel change times in the order of milliseconds), software buffers limit the minimum sweep time.

For instance, this is what becomes of the picture above when you are not waiting enough time for the buffers to flush between (random, in this particular case) frequency hops.

Noisy spectrum of a DVB-T transmitter measured using FCD

It takes around 5 minutes to draw such a persistence plot with the bandwidth of 20 MHz, 50 kHz hops and 10 passes. So don't expect to get anywhere near the theoretical limit for sweep time versus resolution bandwidth.

You can get the Python source from the git repository below. It requires a recent GNU Radio installation, FCD source block and matplotlib.

$ git clone https://www.tablix.org/~avian/git/fcd_scanner.git
$ python fcd_scanner/fcd_scanner.py --help
Usage: fcd_scanner.py: [options]

Options:
  -h, --help            show this help message and exit
  -d DEV, --device=DEV  Use Alsa DEVICE for FCD access
  -c FREQ, --center=FREQ
                        Center frequency in kHz
  -s SPAN, --span=SPAN  Scanning bandwidth in kHz
  -t ST, --sweep-time=ST
                        Time for one frequency sweep in s
  -g GAIN, --lna-gain=GAIN
                        LNA gain in dB (default 10)
  -p STEP, --step=STEP  Frequency step in kHz (default 25)
  -n N, --pass=N        Number of passes (default 1)
  -o FILE, --output=FILE
                        Write measurements to FILE
  -l, --line-plot       Draw a real-time line plot
  -e, --pers-plot       Draw a real-time persistence plot
Posted by Tomaž | Categories: Code

Comments

Hello Avian,

my result in the command line is

ulli@Ulli-Laptop:~/fcd_scanner$ python fcd_scanner.py -c 200000 -s 50000 -p 1000
Traceback (most recent call last):
File "fcd_scanner.py", line 588, in <module>
main()
File "fcd_scanner.py", line 554, in main
options=options
File "fcd_scanner.py", line 219, in __init__
import fcd
ImportError: No module named fcd

file hierarchie: fcd_scanner is located at same level as gnuradio

As I am a beginner in Python, can you look for my error? Many thanks.
Next I wouldt look for mount the stream far from /media to avoid buffers... or what can I do to be faster?

Ullrich (ullrichkunze@gmx.de , if needed)

Posted by Ullrich

Ullrich, that was a bug. Fun Cube support has been integrated into GNU radio in the recent releases while FCD scanner still expected it to be packaged separately. It should be fixed now - fetch the last version from the git repository and try your command line again.

Posted by Tomaž

Hello Tomaž

Does your Spectrum Analyzer has limits in the frequency settings?
When I set the center-frequency over 40 MHz I get a segmentation fault.
I am using the funcube dongle pro.

Best regards,
Selina

Posted by Selina

Selina, fcd_scanner application should be able to work with arbitrary frequencies. The only limits are those imposed by Funcube Dongle's hardware.

A segmentation fault usually means a problem with your GNU Radio installation.

Posted by Tomaž

Add a new comment


(No HTML tags allowed. Separate paragraphs with a blank line.)