Category Archives: R820T/RTL2832U USB SDR: Various hacks and measurements

The popular SDR USB stick, with the R820T tuner and RTL2832U demodulator inside – some investigations.

USB RTL SDR 28.8 MHz Reference: dividers, PLL, success

With the 28.8 MHz VCO design established, all we need to move this project on are divers for the 28.8 MHz (VCO) and 10 MHz (Reference) signals, a slow-acting PLL, and some auxilliary circuitry to feed the 28.8 MHz back to the RTL SDR.

The 28.8 MHz and 10 MHz signals are AC coupled with about 1 kHz input impedance, this is quite common for any 10 MHz reference signal input (used for various kinds of test equipment). These signals are then amplified/limited by unbuffered inverters, 74HCU04. This is a very cost-effective and easy solution, the HCU04 has push-pull outputs, and input clamping diodes. Still, some clamp diodes have been added for the 10 MHz input, just in case.

28.8 mhz divider chain schematic

Looking at 28800 kHz, and 10000 kHz, 400 kHz is the largest common denominator. Accordingly, we need :72, and :25 division factors.

Division of the 10 MHz down to 400 kHz is accomplished by two 74LS90, but you can use other TTL decade dividers, these were just the circuits I had in stock.
28.8 to 400, a bit more tricky, first, divided by 8, using a 74LS293, and another LS293 that has two diodes, acting as an “OR”, to reset the counter when count 9 is reached.

Both 400 kHz signals are then compared use a flip-flop phase comparator, conveniently packaged in a 4046 PLL. For convenience, and to avoid digital noise on the 12 V rail powering the VCO, the 4046 is powered only from 5 V. This somehow limits the tuning output range, from close to 0 V, to about 3.1 V.

The loop filter is very slow acting, tens of seconds, because the objective of this PLL is to correct long-term drift of the 28.8 MHz reference, introduced by temperature, Xtal drift, etc., but otherwise not to impact its noise and oscillation characteristics.

28.8 mhz pll and loop filter schematic

The VCO (see earlier post, VCO design) uses a fixed capacitor to set the tuning offset, this was changed to 4.4 pF, and finally to 2.2 pF, to properly center the tuning voltage (V_tune, output of the PLL loop filter buffer) within the 4046 output range, at roughly 1.7 V.
Extentensive testing was carried out the ensure that the VCO starts up properly, even if extreme V_tune voltages are applied; as the 28.8 MHz Xtals used in the USB RTL SDR devices may vary, you will need to check the required tuning range and pullability of the Xtal. Some Xtals oscillators will stop oscillating, if you pull to frequency up or down too much, which might happen during PLL start-up. This can lead to an undesirable lock-up condition.

Here are the tuning characteristics, for 2p2, and 4p4 pF VCO capacitor values.

28.8 mhz tuning

This is the divider and PLL board. Sure it would be much nicer to have everything completely separated, in shielded cans, etc., but I did not go to such effort. Later testing will reveal if it has any bad consequences for the 28.8 MHz phase noise, but so far, I don’t see much noise – will do a more in-depth comparison later.

28.8 mhz pll boad

USB RTL SDR 28.8 MHz Reference: VCO design established

A quick update on an earlier post, USB RTL SDR 28.8 MHz Reference: VCXO, development of a low-noise 28.8 MHz is now complete. A BB159 varicap has been selected for the voltage tuning control, and it works nicely, even within a 10 V tuning range. This is a UHF varicap diode, C_28V of about 2.1 pF, 9:1 ratio.

bb159 varicap

The updated schematic – the test setup still shown here still uses a few through-hole parts, put most of the RF caps are SMD 0805. J310 J-FETs are used, both for the oscillator, and the amplifier – mainly because of their low cost, and they are widely available.

28800 vco schematic

This is the test setup – test signal provided by a 8904A, and frequency measured by a 5372A Time and Frequency Analyzer, 4 s gate time.
28800 vco test

That’s the tuning curve, it happened to be at 28.800000 MHz, for about 5.5 Volt, nicely centered within the tuning range. No need to worry about the deviation from linear slope, the PLL will have a very long time constant, and the non-linearity of the tuning curve won’t have any impact on the VCO performance.
28800 vco tuning curve

A nice additional feature – this VCO circuit works with the default 28.8 MHz crystal (which is actually no so bad, it is quite stable over temperature, at least the samples I have tested here, taken from cheap USB RTL SDR sticks). +-700 Hz range, +-25 ppm, should be pretty much sufficient to keep the VCO locked over a wide range of temperatures. If not (for other 28.8 MHz that might be around out there), two of the varicaps can be used in parallel, and the C* capacitor adjusted a bit; pullability of the xtal is pretty good, +-1.8 kHz is easily possible. It is best not to use a trimmer cap, but to solder-in suitable capacitors, to keep noise down, and stability up.

USB RTL SDR 28.8 MHz Reference: VCXO

One of the shortcomings of the USB RTL SDR devices is the build-in oscillator. It is actually very stable and sufficient for all kinds of everyday uses, but I am using these SDR devices for narrowband applications, with down-converted microwave signals. So utmost frequency stability is a must.

Not only needs to frequency be stable, it is also a good idea lock all oscillators to a common reference, which typically is derived from a 10 MHz rubidium source (like in my lab), or a GPS-controlled VCXO.

How to get from 10 MHz to 28.8 MHz – well, not all that difficult, but needs quite a few parts. First, we need a circuit that can receive 10 Mhz signals, and clean them up and prepare them to be used by a PLL. Then, we need a VCXO (voltage controlled quarz oscillator) that can be tuned by the loop filter of the PLL to keep it at 28.8 MHz. The loop BW will be very very narrow, a few Hz at maximum. Comparator frequency can be up to 400 kHz, the largest common divider of 10000 and 28800; but I might select a value more like 100 kHz which can be readily derived from a 10 Mhz reference. There are plenty of programmable PLLs around, but I might just use a hardware solution here (only need to put together :288 and :100 dividers using some TTL logic).

The circuit-
rtl sdr 28-800 MHz ref pll

– nothing too fancy, and still needs some fine tuning. The xtal, it’s the original part de-soldered from the RTL SDR stick. These are actually pretty stable and well-behaved, at least for the devices I sourced from China.

The circuit employs a Pierce oscillator, build around a J310 FET. This is coupled into a common-bias amplifier, another J310, which provides the low output impedance. A matching network is added the make the circuit rather insensitive to changes in the load impedance. The circuits draws about 20 mA at 12 V. Not quite a power safer, hey, but this is not the objective here.

The items circled are just temporary parts, will need further optimization.

The big question – tuning range (pullability) of the xtal. Ideally, it should be a few 10s of ppm, to give the PLL some room to operate, and to account for aging effects over the years. Temperature-induced changes are on the order of a few ppm (see earlier post); but there is also drift, and other factors.

A quick test with some capacitors, and, stable oscillation can be found in a range of -1.8 to about 1.8 kHz around the 28.8 center frequency, this is quite satisfactory.

rtl sdr ref vcxo circuit

At the moment, still run with fixed capacitors, but I will add a varactor network to provide about 8 to 40 pF tuning capacity, by voltage input.
In an effort to keep phase noise down, I might employ a circuit used a lot for earlier projects, with anti-parallel varactor diodes.

rtl sdr ref 10 pf

rtl sdr ref 37 pF

The spectra look pretty clean, and the power is as expected, about -10..-6 dBm. I will use this output to drive the PLL, and add another amplifier to drive the RTL SDR R820T reference input – well shielded from everything else to avoid spurs from the divider and PLL circuits.

A quick test of the phase noise – hooked it up to a 3585A Spectrum Analyzer – there are some mains spurs, which will be reduced by adequate filtering once the circuit is fitted to a shielded box. Other than that, nothing really suspicious. All very close or at the noise floor of the 3585A.

10 pF sdr ref0

3585a noise floor

R820T, RTL2832U SDR USB stick: some more findings about temperature sensitivity.

Another hack you can do with the SDR USB sticks – mount the clock crystal (28.8 MHz) remotely, feed a stable RF signal at any frequency you desire, and use it a as a thermometer. This will work great at room temperature and up to about 50 deg C, but beware, the ready will be ambiguous at higher temperatures. Here is a quick experiment:

Signal was supplied at 1000 MHz, from a virtually perfectly stable source. At some point, the crystal was touched with a finger (making sure not to touch any of the traces or components, as this could capacitively affect the oscillator). Surprisingly, the frequency first goes down (-0.6 ppm), and then up (+2.5 ppm).
temp effect (hot to cold to hot) ppm

Why is this so surprising – let’s have a quick look at typical crystal oscillators, there are several types, AT-type (most common), SC-type, and closely related IT-type, and others, less common. Nearly exclusively have I come across AT-type so far, for all kinds of cheap clock application. AT type means: inversion point at room temperature, then the frequency decreases a bit with temperature, to about 60 degrees C, then it increases again. See the black curve in this diagram (note that the absolute values are just typical, arbitrary, and change with cut angle tolerance):
r820t quartz ref osc temp dependence
Red line shows the typical characteristics of a SC (or IT)-cut crystal.

Rather than the expected AT-typical transition through a minimum frequency, when going from about 60-70 deg C, down to 35 deg C (body temperature), we observe just the opposite behavior (more like SC-type) – reference frequency goes through a maximum (which is a minimum of the shown signal frequency, if the signal is a constant 1000 MHz).

So it seems, the manufacturer did actually consider a relatively high operating temperature of this device when selecting the crystal, which is running at about 60 degrees – just the rough temperature of the board/crystal.
An AT-type would have been much counter-productive, because this is optimized for constant frequency over a broad range of temperatures, say, -10 to 60 deg C. However, for the SDR USB stick, the temperature related frequency change should be minimal at and around the hot operating condition of the board – I don’t think this is just coincidence, but somebody acutally put some thought into getting a device frequency stable, without any ovens or other compensation devices.

R820T, RTL2832U SDR USB stick: gain accuracy tests

The R820T has the nice feature of a build in pre-amplifier, 0 dB to 49.6 dB nominal gain. Now, the question is, with all the nominal values, what is the acutal gain, and how does this change with frequency?

With the established setup, the frequency-stabilized SDR USB stick (28.8 MHz supplied by a HPAK 8662A, at 500 mV level), and the 8642B source, the gain of the R820T was set to the various values, step by step, and the RF input level varied to keep the SDRSharp FFT peak level at exactly -25 dB. The -25 dB reading can be taken to about +-0.2 dB, when looking at the FFT display.
The test was carried out at two frequencies, namely, 141 MHz and 1000 MHz. Don’t do such evaluation anywhere close to multiples of 28.8 MHz – there are some reference-related spurs that can affect the accuracy.

First, the RF input power needed to get a -25 dB reading:
r820t rf input power at -25 dB vs nominal gain
Interestingly, at 0 dB gain, a bit more power is needed at 141 MHz to get -25 dB, which means, the R820T is a little bit less sensitive at 141 MHz than it is at 1000 MHz, but only at the 0 dB gain setting. At higher gains, the data are more or less superimposed.

Note also that the 43.9 dB and 44.5 dB gain settings have actually identical gain! No idea why.

r820t acutal gain vs nominal gain
These are the acutal gains, calculated from above data, vs. the nominal gain. Pretty linear, but clearly some positive deviation at the low gains.

The full dataset:
r820t rtl2832u sdr usb gain check

This is even more clearly visible in the deviation plot:
r820t gain error vs nominal gain

Accordingly, the preamp provides a bit more gain at lower frequencies, say, 141 MHz, especially when set to high gain, above 35 dB nominal. Below 35 dB, gains for 141 and 1000 MHz are virtually identical.

If you have a SDR USB stick of a different type, and want to have some gains-levels etc measured, just let me know! I might be interested.

R820T, RTL2832U: narrow-range linearity

Some more linearity tests, now over a narrow range, with a precisely linear and calibrated source, measured at 1000 MHz, otherwise all the same is in the earlier post.

These tests were done at a 0 dB gain setting, and the input power was varied in 1 dBm steps.
r820t gain linearity (narrow range)

r820t linearity deviation (narrow range)
The results speak for themselves – the SDR USB stick is pretty accurate, if you want to do a relative comparison of power levels over a range of 10 dB or so. Accuracy might be in the range of +-0.5 dB, or better, provided that the slope has been determined for a given gain setting (don’t change the gain settings, if you need to do accurate measurements). If you want to measure insertion loss, the best way would be to vary the source power in calibrated steps (by a 1 dB high precision attenuator), and just use the SDR USB at a constant dB reading, over a narrow range of +-1 dB, then your measurement error will be limited to virtually the precision attentuator error only. For such tests, it is always good practice to have a 6 dB or 10 dB attenuator at the SDR USB input, to avoid artifacts caused by the non-negligible return loss (SWR) of the SDR USB stick input.

An open item – to go further, one would need to check linearity at various frequencies of interest, etc., but this is all beyond the scope of the SDR USB stick – if it comes to below 0.5 dB accuracy, that’s something better done in a cal lab anyway, nothing that is necessary too frequently out in the field.
For comparison, with a high precision dedicated level measurement receiver (like the Micro-Tel 1295), achievable relative level accuracy (not linearity) over 10 dB is about 0.03-0.05 dB – over a much wider frequency range. Also note that most commonly available spectrum analyzers (Rigol, etc.) aren’t all that linear, see their specs.

R820T, RTL2832U SDR USB stick: using it as a “poor man’s” spectrum analyzer – level linearity, level accuracy

There are some good reasons to always carry one of the SDR USB sticks around – it’s a great little spectrum analyzer. But hold, what does it have in common with the purpose build-professional analyzers selling for USD 1k or more? It certainly has one particular advantage, the SDR USB stick is very small, a mere 10 gramms, and only needs about 1 Watt of power. And it covers the full span of frequencies of general interest (at least is you add an upconverter, for low frequency and HF stuff below 24 MHz).

Well, what are some key requirements of a good spectrum analyzer?

(1) No spurs, at least no unpredictable ones. Well, there are spurs, but mainly multiples of 28.8 MHz (reference), and some spures related to the sampling frequencies (always check if the spur changes, by checking out several sample rates that are not multiples of each other)

(2) Intermodulation distortion. More complicated, will be analyzed later.

(3) Low input return loss (otherwise, amplitudes will be inaccurate). Will be measured later, the VNA rests back home in Germany. But this limitation can be easily overcome by putting a 6 dB attenuator in front of the SDR USB.

(4) Frequency accuracy – this is not great, but stable within a few ppm. If you want to add a precision reference, see earlier post.

(5) Amplitude accuracy – it needs to be very linear (i.e., a 1 dB step in signal strength must convert to a 1 dB step on the readout, same for 10 dB steps, etc.), and this should not very too much with frequency. Absolute amplitude accuracy (i.e., if 1 dBm is fed into the RF input, it needs to read 1 dBm power) – not applicable to the SDR USB stick, it only shows power in nominal, un-calibrated dB.

Well, let’s tackle item 5, and work out some absolute calibration.

The R820T tuner of the SDR USB stick under consideration here has a build-in preamp. This has nominal gains from 0 dB, to 49.6 dB. Some gain curves have been reported for other SDR USB sticks elsewhere, let’s do some in-depth analysis.

How to get this measured properly? The setup and method:
With 1.024 MSPS, 65536 FFT bins, RF frequency of 1000 MHz (HPAK 8642B), reference at 28.80 MHz – 500 mV (provided by an HPAK 8662A) and gains set to values of 0 dB, 20.7 dB (about mid-range), and 49.6 dB (max gain), the input RF power (which is calibrated in absolute dBm, and fed to the SDR USB stick by a low-loss cable) is varied in 10 dB steps, and the dB reading taken from the SDRSharp FFT spectrum display. Note that fully accurate reading of the dBs is only possible if the frequencies (reference and signal) are dead-stable, otherwise everything will be drifting up and down, and the FFT bins won’t be in the same place all the time.

Here are the results:
r820t db output vs rf power input at various gains
Everthing is quite linear (a good fit with just a line), but you notice, the slope of the lines change a bit, depending on the gain setting. In other words, a 1 dBm chain will not always result in an exactly 1 dB change on the SDSSharp display, at high gain setting, it will almost fit, at 0 dB, there is only about 0.93 dB change (readout) for every 1 dBm power change at the input. Well, over 40 dB, that’s an error of about 3 dB, not much, but more than desirable.
r820t level accuracy

After some more measurements, at 38.6 dB nominal gain, it relationship of level slope vs. gain seems pretty clear, at least at 1000 MHz.
r820t linearity (slope) vs nominal gain

After applying the slope correction (comparing a linear fit, with the acutal measured data), these are the residuals:
r820t linearity deviation (wide range)
Less than 1 dB – that’s within the measurement error of the calibration apparatus!

Next interesting item for practical use, the RF input power needed to get a 0 dB reading – the absolute power calibration for this SDR USB stick. This seems to vary from stick to stick only by 2-3 dB, but I don’t have a big set of sticks, multiple lots etc. – so this might be shifted depending on the exact device you are using, but trends should be the same, for all R820T sticks.
r820t 0db equivalent rf input power vs gain
According to this diagram, for any measurements above -40 dBm, you need a good set of attenuators, to bring the signal level down. In fact, the SDR USB might actually make a very decent subtitution type attenuation test receiver, if you put it in line with a precision attenuator, and only use a few dBs of span of the SDR USB (well-calibrated) to determine the signal levels. I checked quickly for drift of the level calibation vs. R820T temperature – there doesn’t seem to be any strong effect, which is a good sign that there is no need to re-calibrate the levels all the time.

R820T, RTL2832U SDR USB stick – sensitivity, dynamic range

After looking around in the web, there doesn’t seem to be a whole lot of information out there on the sensitivity and dynamic range of the SDR USB devices, at least not for the type I’m using here. Even the R820T datasheet isn’t all that clear – there are various versions of the R820T, also using different clock frequencies, with 28.8 MHz, being the most popular lately.

Therefore, time for some measurements.

The setup:

(1) HPAK (formerly HP, then Agilent, now Keysight) 8662A Signal Generator as the reference source, 28.800 MHz, 500 mV level.

(2) HPAK 8642B Signal Generator as the test signal source. This has a calibrated output from -140 dBm to +20 dBm, and very clean and free of spurs, and provides up to 2.1 GHz.
Absolute amplitude accuracy is about 1 dB, linearity is considerably better. As it says on the instrument cover – 70 pounds, “two person lift”.
The 8642B is phase locked to the 8662A clock, via a common 10 MHz reference signal. So even with drift, there can’t be any frequency errors getting into the way of our precision testing.

(3) Some well-shielded test cables, RG223/U, and adapters to link to the MCX connector (use a good test cable, but not your best – most of the SMA to MCX connectors aren’t all that precise, and may damage precision SMA connectors).

(4) The modified SDR USB stick, see earlier post.
r820t rtl2832u sdr usb dut

(5) Laptop PC, running SDRSharp. 1.024 MSPS, all automatic gain and frequency adjustments disabled, I/Q correction enabled.

r820t rtl2832u sdr usb test setup

First, the sensitivity check. Tuned the SDR USB to various frequencies, and measured the input power (dBm needed to get a -40 dB reading, at max gain of the SDR USB – 49.6 dB nominal), this is about 15 dB above the noise floor, and still a signal level that is very stable and can be accurately measured. Afterwards, set gain to 0 dB, and increased RF input power until 0 dB reading was obtained – this is the maximum power that can be reasonably fed to the SDR USB (no damage will occur up to +10 dBm; and even +20 dBm doesn’t seem to do much, at least not if only applied for a short time).

Power levels for -40 dB reading at max gain, and 0 dB reading at 0 dB gain:
r820t input sensitivity and max power
Sensitivity is quite constant over a pretty large range, up to 1500 MHz, no problem. Lowest frequency the thing can handle is about 24 Mhz (doesn’t tune any lower). Note that there are some spurious signals present around 28.8 MHz, (internal) ref clock leakage, and its 2nd harmonic.
R820T usb sdr dynamic range and sensitivity

The RF input power (about -130 dBm) to get -40 dB amplitude, at max gain of the SDR USB, this is quite remarkable, and still about 15 dB above the noise floor. So the R820T exhibits very high sensitivity, no doubt.
Here is an estimation of the dynamic range – “useful” because, it is still has some margin for noise. For the full dynamic range, add about 15 dB.
r820t sdr usb dynamic range
About 93 dB (108 dB full range, from noise floor, at 49.6 dB gain, to 0 dB at 0 dB gain).

R820T, RTL2832U: SDR USB stick hack – clean and stable reference!

One of the shortcomings of these handy and cheap SDR USB sticks is the offset of the reference, and the drift. First, lets see what we have: in the meantime, I have two more or these little units to play around, and all have about 70-100 ppm offset, positive.
The reference is derived from a small 28.8 MHz crystal, and while such crystals are pretty much suitable for clock generation, they do drift with temperature, and the SDR USB stick is getting hot during use… Quick look inside (case can be easily opened, no damage):

r820t sdr usb stick opened
The small silvery metal can is the crystal. Any temperature change will cause this to slightly change frequency.

So, what about the crystal drift? Easy enough, just hooked up one of the sticks to a counter (with stable timebase; you need to use high impedance probe, otherwise, proble will pull the crystal frequency), and logged the frequency values for an hour, after “cold” startup (stick with no case).
The result:
r820t ref clock drift
1 to 2 ppm, that’s not all that bad! Still, in the world of precision oscillators, it’s ridiculously drifting. So for any precise characterization of the SDR USB device, we need to get this under control. Some have tried to replace the crystal by a TCXO, but even with this, it will be challenging to break the 1 ppm (1 kHz at 1 GHz!) mark.

A quick look at the datasheets reveals that pins 8 and 9 of the R820T are the input/output of the xtal drive circuit, and pin 10 forward the clock signal to the RTL2832U, to safe some parts, and cost.

That’s how the oscillator output looks like, probed at pin 9, with a 10 Meg probe (0.5 V/div, 10 ns/div)
r820t ref clock signal 0.5 v-divy 10 ns-divx
The signal, amplitude is about 1.5 Vpp, with a DC bias of 1.2 V.

Therefore, if we want to substitute the crystal, we have to feed a few dBms of power at 28.8 MHz into pin 8, and leave pin 9 unconnected. The feed line (50 Ohms) requires some adequate termination. We also need to provide a DC block, with a little coupling capacitor.
That’s the little hack:
r820t sdr usb ref clock hack
A SMC connector, terminated with 82 Ohm (which will be in parallel with the impedance of the R820T, hopefully giving about 50 Ohm, or close enough), and with 0805 10 nF capacitor, connected to pin 8 of the R820T.

As for the new reference source – nothing less than a HPAK 8662A, which is a real marvel of engineering and one of the best sources I can suggest for any tests that require low phase noise close to the carrier. It is stable to better than 0.0005 ppm, per day – compare this to the 1 ppm, per hour…..
Sure, not the mention – the 8662a carries 80 pounds of electronics, a big fan, and uses about 300 Watts of power to keep things clean.

The new clock source for the SDR USB stick:
r820t new clock source 8662a

The reference level needed to drive to R820T oscillator – just by trial and error, things start to work at about 400 mV, and up to 1 V of signal doesn’t seem to change anything. So I set the level to 500 mV into 50 Ohm, and this seems to work well.

Interestingly, the R820 T seems to work from about 28.75 to 28.85 MHz reference, with no change in performance (at least nothing obvious), except, of course, for the frequency shift. At frequencies below about 28.72, and above 28.89, the stick crashes-no more data comming.

Some tests: 28.800 MHz reference, 1 GHz signal (note the small frequency shift, which is related to SDRSharp software, not to any hardware offsets)

28.75 MHz reference – still 1 GHz signal

28.85 MHz reference – still 1 GHz signal

Checking the math, this all makes sense – for 28.75 MHz, a reading of 1001.739 MHz would be expected, and 998.267, for the 28.85 MHz reference.