SDR USB stick arrived, getting first spectra

SDR USB stick arrived, getting first spectra

Due to whatever I have now 2 RTL2832 USB sticks ./xpsa xpsa: start_sdr(): executing rtl_sdr -f 1575420000 -s 2048000 -d 0 -g 0 -b

262144 -n 0 - Found 1 device(s): 0: Generic, RTL2832U Using device 0: Generic RTL2832U (e.g. hama nano) Found Elonics E4000 tuner Tuned to 1575420000 Hz.

That tuner is ebay item 221146636395. Very small, and very good.

./xpsa xpsa: start_sdr(): executing rtl_sdr -f 1575420000 -s 2048000 -d 0 -g 0 -b

262144 -n 0 - Found 1 device(s): 0: Realtek, RTL2838UHIDIR Using device 0: ezcap USB 2.0 DVB-T/DAB/FM dongle Found Rafael Micro R820T tuner Tuned to 1575420000 Hz. Reading samples in async mode...

That one with the R820T tuner chip was bought locally...

The 4000 tuner chip seems to be a better choice for spectrum analysis. Also seems to be more sensitive at around 1500 MHz.

All this software will need a lot of work... My program simply calls rtl_sdr, and does FFT over the samples in real time. Note the aliasing, and the mirror image, that needs to be fixed. This is L1 GPS spectrum from the main oscillator of my pseudo satellite, without modulation:

formatting link
and with DPSK modulation:
formatting link
It shows how the stability changes because of feedback from the ring modulator into the oscillator (pulling). Those are real dBs, not linear, so the effect is minimal.

Lots of work ahead on this. I have rtl_fm (Linux) working to receive FM radio too.

So.. spectrum analysers do not have to be expensive. I have a RF converter now too, to go from DC and now up to > 2GHz, have not had a chance to test it yet (bought as a kit, connector was missing).

I wonder if the 4000 tuner chip can receive real GPS signals, I only see 1 bit noise ..... (hexeditor on rtl_srd output file). :-)

Maybe it needs a pre-amp. Somebody seems to have done it with some stick:

formatting link
Dont ask me how...

Hey, just having fun playing :-)

Reply to
Jan Panteltje
Loading thread data ...

I tried some FFT routines I once wrote, but fftw3 is a lot faster. Think I have that fftw_complex correct now.

The bottom green field added to show offset of received from set frequency. You can see the SDR stick is about 200 kHz off at GPS L1, mine is correct (Rubidium reference).

formatting link

When looking at a 105 MHz un-modulated FM stereo signal from my car FM transmitter, you can see the 18 kHz pilot components (and a lot of other sh*t too):

formatting link

Again this difference field is very handy to get the exact frequency, it updates on a mouse click in the graph, with a crosshair.

When modulating with an 1kHz tone, the spectrum fills up:

formatting link

And with music at lower volume:

formatting link

Hey, this is a nice toy, and I am sure I can have a year of coding fun with this :-)

These are only first tests, already a very useful thing to have. The display updates every 20 ms, neat speed for an FFT over about 130000 samples.. So it is just 'alive'. There is a 2 to 5 seconds delay between input signal changing and display changing, likely due to Linux caching all data. I had same problem with cameras..

Later, ? I will release source (Linux). Only libraries used so far are libc, libforms, fftw3, libmath.

Now this was very interesting:-)

Reply to
Jan Panteltje

Yup. What tuner are you using, the E4000 or the newer R820T? They say the R820T performs better, also allowing a wider range of frequencies to be received. Someone also managed to receive the entire HF band without using any upconverter, just bypassing the tuner and injecting the rf into the RTL2832 which happens to have enough s/r for the task.

formatting link
formatting link
formatting link

Reply to
asdf

On a sunny day (Tue, 15 Jan 2013 00:00:32 +0000 (UTC)) it happened asdf wrote in :

I am most fortunate I have now 2 of these sticks, one with the 4000 tuner, and one with the R820T. I bought the R820T because the 4000 from ebay never arrived, of course then the 4000 arrived almost the same day.... I like the 4000 tuner more, because it is very very small, much smaller than the R820T one, but that is just how it is build. The 4000 seems a bit more sensitive around 1.5 GHz, also it is supposed to go up to 2 GHz.

That Sharp software seems really really nice, I have it, but only have Linux (burned my XP disk) so.. And I could not get gnu radio to work in Linux Slackware, maybe I will try gnuradio on my laptop with Ubuntu...

So anyways, writing your own soft is fun. The spectral resolution you can get is stunning,

Both tuners also seem to put out all sort of mirror frequencies, or aliases. Not so strange as these have no real LC filters, so a lot of software processing is needed. But already with simple soft this is great as a tool to test stuff I build.

Interesting, pity the Sharp GUI is too un-sharp (the video) to see his exact settings, and if those are the same.

Very good reception.

I am a bit prudent about soldering anything directly to the RTL chip, need to cut out the tuner too then I think. Also you need protection circuits. I bought a RF converter locally from here:

formatting link
it is a kit, I assembled it, but have not had time for testing. Came without circuit diagram, would you believe that? I have drawn that diagram from the board, and it basically a low pass filter, ring diode mixer, and 100MHz oscillator. His claim of from 'DC" falls with a 470nF input cap... :-) But the extra converter protects the stick, especially if you have a large antenna you can get several volts of signal, I has a LED burning on my 27 MHz GPA when the guy next doors was transmitting, so be careful.

Reply to
Jan Panteltje

Jan,

If you want to write something cool, write a pure spectrum analysis app for the dongle. I love being able to tune it as a SDR, but I'd like a pure sweep too,

Steve

Reply to
Owen Roberts

On a sunny day (Wed, 16 Jan 2013 11:59:14 -0800 (PST)) it happened Owen Roberts wrote in :

You mean from 0 to 2 GHz on one screen?

Reply to
Jan Panteltje

On a sunny day (Wed, 16 Jan 2013 11:59:14 -0800 (PST)) it happened Owen Roberts wrote in :

PS I just wrote some test routines for the 4000 tuner chip. I managed to get librtlsdr do a scan in 1 MHz (bandwidth) increments from 52 MHz to 2 GHz. That took 2 minutes 19 seconds.

One restriction applies with the 4000 tuner, is has a dead band from 1109 MHz to

1242 MHz tuning range is from 52,000,000 to 1,109,000,000 and 1,242,000,000 to 2,217,000,000 Hz

I used 512 samples (buffer) per 1 MHz section. The end result is a file 1082880 bytes long (it should be 512 x ( (2217000000 - 52000000) ) / 1000000) = 1,108,4080 bytes, but due to that missing section I get 1,082,880 bytes IQ samples.

Now you can run wfft on that and display it.

When using hexedit (hex editor) on file q1 I see lots and lots of data! Also, for more resolution you could use more samples per section, things get slower then of course. Simpler just to 'zoom in'. I added zoom functions to my program already. So it is possible, and it takes 2 minutes for a full scan (52 MHz to 2 GHz). If you put the usable result of the FFT in an aray, then you would get about

250,000 points, so resolution would be fenominal.

Other tuners may have no missing section, but less range on the high end than the 4000 chip.

Interested?

The code is really simple, I had to dig a bit in librtlsdr.c as no documentation...

Maybe later I will incorporate this into my xpsa (X Pantelje's Spectrum Analyzer) program. But you can run the test code from the command line and use perhaps mathlab or some otehr program to process the output file. Variations are endless... :-)

Reply to
Jan Panteltje

On a sunny day (Tue, 15 Jan 2013 00:00:32 +0000 (UTC)) it happened asdf wrote in :

PS, running rtl_test find the 4000 tuner goes from 52 MHz to 2217 MHz, with a small gap from 1109 MHz to 1242 MHz. I can get no tuning range from the R820T tuner, but that one has more gain level settings. Not sure if the number of gain levels make a lot of difference, I have run my tests with gain auto, and added auto gain in software on top of that. If the numbers are correct then one would think the R820T tuner has 7.2 dB more gain, but it says nothing about the noise, and that is what counts.

panteltje: ~/compile/pantel/xpsa # rtl_test -t Found 1 device(s): 0: Generic RTL2832U (e.g. hama nano)

Using device 0: Generic RTL2832U (e.g. hama nano) Found Elonics E4000 tuner Supported gain values (14): -1.0 1.5 4.0 6.5 9.0 11.5 14.0 16.5 19.0 21.5 24.0

29.0 34.0 42.0 Benchmarking E4000 PLL... [E4K] PLL not locked for 51000000 Hz! [E4K] PLL not locked for 2218000000 Hz! [E4K] PLL not locked for 1109000000 Hz! [E4K] PLL not locked for 1242000000 Hz! E4K range: 52 to 2217 MHz E4K L-band gap: 1109 to 1242 MHz

panteltje: ~/compile/pantel/xpsa # rtl_test -t Found 1 device(s): 0: ezcap USB 2.0 DVB-T/DAB/FM dongle

Using device 0: ezcap USB 2.0 DVB-T/DAB/FM dongle Found Rafael Micro R820T tuner Supported gain values (29): 0.0 0.9 1.4 2.7 3.7 7.7 8.7 12.5 14.4 15.7 16.6 19.7

20.7 22.9 25.4 28.0 29.7 32.8 33.8 36.4 37.2 38.6 40.2 42.1 43.4 43.9 44.5 48.0 49.6 No E4000 tuner found, aborting.
Reply to
Jan Panteltje

I just bought a RT820 and was going to try HDSDR software.

Wow, great scan range but really slow. How long does it it take to do say a 10 Mhz bandwidth in 30 Khz steps?

Steve

Reply to
Owen Roberts

Jan, also I'll be using "Zadig" to install the drivers.

Steve

Reply to
Owen Roberts

On a sunny day (Thu, 17 Jan 2013 06:54:36 -0800 (PST)) it happened Owen Roberts wrote in :

Depends on how you configure, default sample rate is 2048000 smples per second. default buffer length = 16 * 16384 = 262144 bytes.

minium buffer size is 512 bytes.

So, in that case to read one buffer takes 262144/ 2048000 = .00128 seconds, say

13 mS. If bandwidth is about 1 MHz you need 10 reads at incrementing frequency, makes the stunning long wait of 130 ms.

But now you have to do a 262144 point FFT, and then display the result scaled to how many pixels you have available in your GUI in horizontal direction.

I actually slow down things with a sleep statement to reduce processor cycles for 1MHz bandwidth, as 25 updates per second is enough (anfd far fewer too).

You do need fast FFT routines.

30 kHz, that is sooo much, I can see Hz...
Reply to
Jan Panteltje

On a sunny day (Thu, 17 Jan 2013 06:55:44 -0800 (PST)) it happened Owen Roberts wrote in :

Is that MS windows? I have no clue about MS windows... Burned my xp disk...

Reply to
Jan Panteltje

This is just a quick hack to demonstrate you can actually scan the whole spectrum from 52 Mhz to 2GHz.

Source code, for instructions how to compile and run it, see top source file:

formatting link

Output file q3.dat displayed in gnuplot from running ./rtl_sdr_scan -b 16384 > q3.dat

formatting link
scale is log, change the log10 in the source if you want linear, gnuplot will autoscale.

In this case there is the usual heavy short wave noise on the left, folowed by some strong signal around 50 MHz, folowed by my first FM transmitter at 105 MHz, my second FM transmitter at 107.2 MHz, and GPS artificial satellite at 1575420000 Hz (big p[eak on the right). Of course a 16384 size buffer per MHz is not much resolution, and gnuplot uses crosses here that overlap so no resolution either in that display. The generated output file q3.dat is however 127959152 bytes (7794691 frequency entries), so you could use a section of it to 'zoom in'.

The white space in the middle is the tuning range where the 4000 tuner chip cannot lock (cannot go), I use zeros for that so the frequency scale stays consistent.

Guess you could do an EMC test with this....

Again, this is just a quick hack to see how long it takes, and if at all possible to scan the whole spectrum. I read buffer_size samples at the time, do an FFT with fftw3 over that, and add all the FFTs together into an output file.

You need: libusb librtlsdr libfftw3 libc

and gnuplot

There realy is much better resolution if you specify a larger buffer size, but output filesize increases with that.

This is the other program I am working on displaying 105 MHz FM transmitter with

19 kH stereo pilot tone sidebands:
formatting link

And this with mono 3kHz sine wave audio modulation:

formatting link

Would you have expected the pilot tone sidebands to have sidebands too?

formatting link

Stereo info is at 38 kHz sidebands....

formatting link
(note zoom factor setting is now only 8 to get the 38 kHz stereo info in view, and I have changed to log display to show the lower level stereo data).

The botton green field in the middle shows the difference in frequency of the last mouse click in the graph to the one you clicked before that, this makes it easy to get sideband frequencies wherever you are in the display relative to the main carrier, simply by clicking main carrier and then any other frequency component.

Note the 'zoom' button setting, and the 'display shift' slider, can take you all over the acquired spectrum.

xpsa code, nothing to do with MS xp, it is X (as in Linux X) Panteltje's Spectrum Analyzer. Tthis code has still a year of work needed, so it won't be released yet just now. I still have to bring plenty of good stuff into it, some I just discovered writing the scan program.

PS the math is probably totally wrong, but will fix that too when I get around to it. For my wrong math it works very well though :-). Why spend a fortune on an expensive spectrum anayzer box if you can have it for

Reply to
Jan Panteltje

for

Reply to
jdc

On a sunny day (Fri, 18 Jan 2013 06:13:59 -0800 (PST)) it happened snipped-for-privacy@teleport.com wrote in :

for

spurious testing and you'll know!

Of course I have done that. And I stand by my remark:

And I have done a lot more complied testing too. Sorry if it hit you money maker. :-)

Reply to
Jan Panteltje

leport.com wrote in : >On Friday, January 18, 2013 4:11:57 AM UTC-8, Jan Panteltje wrote: > > >

it for > >Well, perhaps you should do some simple two tone testing , noise floor and spurious testing and you'll know! > >gl and have fun. Of course I have done that. And I stand by my remark: And I have done a lot mo re complied testing too. Sorry if it hit you money maker. :-)

re money maker: ah no problem.

i was in a round about way, pointing out that there's a big difference in c ost of a s/a with a 70db dynamic range in a wide analysis bw, vs one with s ay 55db in the same bw for a reason.

i have no idea what your targeted specs are, but i have looked at the e4000 before. if i recall, it's a direct conversion arch. not really conducive to wideband spectrally pure analysis. so i wasn't surprised by your commen ts re the spectral output.

where you able to clean up the output for a single tone?

anyway, not here to argue, but to encourage, continue with the updates.

good luck

Reply to
jdc

On a sunny day (Fri, 18 Jan 2013 09:35:20 -0800 (PST)) it happened snipped-for-privacy@teleport.com wrote in :

OK. As to your question, the output file this test code produces is simple ASCII format, and for a full scan with a buffer size of 16384 (smallish), the length is: -rw-r--r-- 1 root root 127959152 Jan 18 12:08 q3.dat Too much to be displayed on a normal monitor, unless you average over many points, that is among other reasons why gnuplot does not show a clear picture. This is the data format:

formatting link
frequency in Hz followed by some amplitude for the component at that frequency. So I simply took a text editor, and saved only the part from 92 to 94 MHz, that displays like this:
formatting link

Now you see already a lot more detail. Most carriers are modulated radio, but there are some single ones. Of course this is just demo.

My program does it a lot better:

formatting link
This is a spike at 1547088 Hz, with a bigger one to the left at 2432 Hz lower. Probably harmonics of my open FPGA board on the table. You can now see the noise play up too, these signals are WEAK. And remember we are now looking in the GHz range.

You may think why the 'triangular' display form? Well I had to do something to make it visible in the 780 pixels of the GUI. Note the 'zoom factor' 32. In fact it is the reverse, it means it is averaged over 256 / 32 = 8 FFT samples. Zoomfactor 256 is direct.

You can specify a vertical bar graph too, but I find this much easier and quiet to work with.

When going to zoom 256 you can see carrier instability in about anything, in fact the resolution is then 4000 / 780 = 5.28 Hz (at any frequency). Enough? All measurements now are done with the DVB-T antenna that came with the USB unit, Great for EMC testing!

Reply to
Jan Panteltje

@te=

ve =

ing=

Of =

mo=

n c=

h s=

000=

ive=

men=

CII

y points,

uency.

,

ower.

I.

T samples.

quiet

SB unit,

your program seems pretty cool. good start.

a few questions:

are your test sigs all off air?

does the 0dB represent a -43dBm input? i see -43dB to the right, center.

all the displays are ave?

in one of your previous posts you had a display of a single tone. the pede stal about the carrier is most likely due to phase noise. based on the dis play i was guessing the ticks are 400k to 500k wide? and the noise appears to be at least one tick wide at the -70dB mark. the carrier it self appea red to be pretty wide close in, but that could be an artifact of the displa y, (number of pts).

so that's what i was asking about before. if you're using off the air sigs that explains it.

great project.

Reply to
jdc

dc@te=

have =

sting=

. Of =

ot mo=

in c=

ith s=

e4000=

ucive=

ommen=

.

ASCII

any points,

equency.

Hz,

lower.

GUI.

FFT samples.

nd quiet

g,

).

USB unit,

destal about the carrier is most likely due to phase noise. based on the d isplay i was guessing the ticks are 400k to 500k wide? and the noise appea rs to be at least one tick wide at the -70dB mark. the carrier it self app eared to be pretty wide close in, but that could be an artifact of the disp lay, (number of pts).

gs that explains it.

actually re the phase noise, i just went back and looked it's more like -55 dB. anyway just curious.

Reply to
jdc

On a sunny day (Fri, 18 Jan 2013 12:25:04 -0800 (PST)) it happened snipped-for-privacy@teleport.com wrote in :

For now yes, I have a nice cable that has SMA connector so I can screw it to some stuff I have build. But as I pointed out, this is a 1 year software project, and I got the sticks only before last weekend.

Note the 'AGC' button pressed in the GUI. What it does is normalize the highest amplitude in the spectrum to the top of the display, both in log and linear mode. On top of that the tuner AGC is enabled.

So the dB scale is largely bogus for now, and it is not even switched over to a linear scale in linear mode. Later I will use an attenuator to figure out what exactly the sensitivity of the

2 different sticks I have is in dbm (or say uv in 50 Ohm). Then I will add some calibration constants in the software. Sensitivity is rather good, you can listen FM radio with it too, but the USB thing gets some noise from the PC. My HTC android's FM receiver noise level is 100 x better.

There is an opportunity for more digital processing there too.

ave? What is that? Average? No, you have to average over 1000 points if you want to display those in 100 pixels... Scaling:

formatting link
that could be done with FFT too....

No 'zoom in' and you get about 5 Hz resolution.

The sticks own oscillator stability is pretty good, probably because it is all integrated, no coil microphonics, but if I for example tap my car FM transmitter, I see the carrier swing all over the screen and then go back approx. where it was, PLL, mechanical coil.. :-) It is also fun to see the Rubidium frequency reference I have locking, moves left, moves right, and then finally locks. As to absolute frequency accuracy of the sticks, that can be hundreds of kHz off at > 1GHz. PLL multiplies any crystal tolerances. But I can make good markers with the Rubidium unit.

I already find this what it does now very useful for some stuff I am building.

Reply to
Jan Panteltje

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.