From www.AA6E.net
Jump to: navigation, search

E-mail from Ric, KF3EB:

Thanks for the excellent article on the Tiny Panadapter. I enjoyed it. It stimulated me to get a European TV dongle to play with, to start at least.

First, in playing with your code, I found a bug. In short, the default for "sample_rate" of 48000 is incompatible with librtlsdr on Linux.

I am using your Panadapter code on Slackware Linux along with librtlsdr. In "iq_opt.py" the default for "sample_rate" is set to 48000. Librtlsdr doesn't allow 48000. I dug around the guts of librtlsdr.c and found

##### Start librtlsdr.c code>>>>>:

	if ((samp_rate <= 225000) || (samp_rate > 3200000) ||
	   ((samp_rate > 300000) && (samp_rate <= 900000))) {

##### <<<<< End librtlsdr.py Code

So I made the following change to iq_opts.py:

##### Start iq_opts.py code, at line 131 >>>>>:

# The default sample rate, 48000, is a problem for RTL
# librtlsdr has sample rate limitaitons, :
#	if ((samp_rate <= 225000) || (samp_rate > 3200000) ||
#	   ((samp_rate > 300000) && (samp_rate <= 900000))) {
if opt.source=='rtl':
        opt.sample_rate=1024000

# Main module will use: options.opt to pick up this 'opt' instance.

##### <<<<< End iq_opt.py Code

...

Second, I decided to add a few new controls. I added an "F/f" key to change the frequency by 1 MHz steps, added a "G/g" key to change the dongle gain, and added a "S/s" key to change the dongle sample rate. There are a couple of "gotcha's" in both the gain and sample rate. Neither gain nor sample rate is a simple linear function in my dongle. I wound up using tuples and indexes to select specific values. I'm still looking at the sample rate stuff, I'm not sure I did it correctly, as the calibration of the graticule seems off.

...