# Poor Man’s Homebrew TDR With 4cm Resolution – Part 1

The standard equipment for measuring impedance variations is a Time Domain Reflectometer, TDR. TDRs are very effective but resolving small elements requires a wide bandwidth, which implies the TDR will be very expensive. This note explores a £35/$55 alternative based on SDR dongles and noise sources, to see what can and cannot be achieved. Although there are limitations, initial results are surprisingly good and useful. For example, Figure 1 shows reflections in two different transmission lines with an open-circuit stub 3.1m from the TDR. The first stub is 19cm long, and the second is 29cm long. Figure 1: 19cm & 29cm Stubs The stubs’ differing lengths are clearly distinguishable. Why do such impedance variations matter? Because with RF circuits and medium/high speed digital circuits, connections must be uniform-impedance correctly terminated transmission lines. Impedance discontinuities in RF circuits causes peaks and troughs in the frequency response, leading to poor performance and/or link failure. Impedance discontinuities in digital circuits cause signal integrity problems, leading to marginal operation and/or pattern-sensitive errors. ## Background TDRs inject a short impulse into the transmission line, and display the line’s “impulse response” on an oscilloscope. Impedance imperfections appear as “echoes” in the “impulse response” of the circuit, and the scope’s limited bandwidth determines the smallest visible feature. For a bandwidth $B$, the adjacent impulses in the time-domain response are $t=1/(2 B)$ seconds apart. Given an impedance mismatch distance $d$ from the instrument and propagation velocity $v$, the reflection will be visible at the instrument at time $t=2d/v$. Thus the distance resolution is $d=v/(4 B)$. Many amateurs have 100MHz oscilloscope, and the velocity in a transmission line is typically 0.66c, so the distance resolution will be $d$ = 0.5m and discontinuities 1m apart can be clearly distinguished. Alternatively, cheap SDR dongles can receive signals at up to 1.5GHz, so the distance resolution is potentially 33mm with discontinuities 66mm apart being distinguishable. ## Basic Principles A circuit’s frequency-domain response and time-domain impulse response are duals of each other, related by the Fourier Transform, $\mathcal{F}$, and inverse Fourier Transform, $\mathcal{F}^{-1}$. Hence if the circuit’s frequency response is measured, its impulse response can be calculated. The usual method of measuring the frequency response is to use a vector network analyser (VNA) or spectrum analyser (SA), with a coupled tracking signal generator. Unfortunately VNAs and SAs at least as expensive as an equivalent oscilloscope. A very good overview of using a VNA as a TDR is Agilent’s Time Domain Analysis Using a Network Analyzer Application Note 1287-12. Cheap SDR dongles are intended to demodulate RF signals, but they can also be used to measure power without demodulation. Since they are cheap and it doesn’t affect their intended purpose, their frequency response is far from flat, their dynamic range is limited, and their sweep speed is slow. Despite those limitations, they can function as crude spectrum analysers, as demonstrated by many programs including RTL-SDR Scanner, RTL SDR Wide Spectrum Analyzer, and Simon Schrödle’s evaluation. Cheap programmable signal generators are available, and could be swept in sync with the SDR. However, those which work at GHz frequencies are based on synthesisers which produce square waves, not sine waves. In this application such synthesisers’ harmonic content is not filtered out, and is unacceptably high. The cheap low-tech alternative is a diode-based white noise source, which emits white noise from MHz to several GHz. While frequency sweeping is unnecessary, it also has disadvantages that limits the overall dynamic range and correspondingly limits the maximum observable distance: • with non-linear devices in the transmission line, high powers could produce excessive intermodulation products • if the SDR’s RF front end has too high a gain, it will be saturated ## Components To simplify discussions, it is assumed that the homebrew TDR is being used to measure a transmission line. The circuit diagram in Figure 2 shows: • an SDR dongle: R820T2 based on a Realtek R820-T2 front-end tuner/amplifier and RTL2832U demodulator, with the input impedance changed from 75Ω to 50Ω. Frequency range 24MHz-1.5GHz RF power is measured by Kyle Keen’s program rtlpower. Dynamic range is around 30dB. Cost:£12/$18
• a noise source: from EBay, based on the “BG7TBL 2014-06-20” design. Frequency range probably around 4GHz, i.e. much greater than the SDR dongle’s. Power output approximately 10dBm. Cost: £19/$30 • splitter-combiner: Mini-circuits ZFSC-2-2500-S+, 10-2500MHz. Cost: £4/$7, second-hand
• Python programs control the SDR dongle, calculate and display the impulse response

Figure 2: Hombrew TDR Circuit Diagram

The relative merits of splitter-combiners and directional couplers have not yet been fully assessed. Simple tee-junctions have the disadvantage that the input impedance is 25Ω, which causes power reflected from the transmission line to be re-reflected back into the transmission line.

## Process and Algorithm

Unlike VNAs, SAs are inherently scalar, and there is no useful phase information in a noise source. Now the inverse-FFT $\mathcal{F}^{-1}$ does contain phase information, but it is meaningless and thus is discarded by only using the magnitude of time series. The net result is that the impulse response cannot distinguish positive reflections from negative reflections. Thus a short-circuit appears identical to an open-circuit, and in a 50Ω line a 55Ω termination gives the same result as a 45.5Ω termination.

Nonetheless, if it is only impedance changes and reflection coefficients that are important, this technique is sufficient.

The process is:

• verify SDR dongle input is not saturated
• with a 50Ω terminator at the reference plane, measure the spectrum of the noise source and SDR dongle. This, with all its imperfections, is the “baseline spectrum”, $S_{base}(f)$
• replace the 50Ω terminator with the transmission line under test and measure the spectrum, $S_{raw}(f)$
• the frequency-domain response of the transmission line is therefore $R_{line}(f)=S_{raw}(f)-S_{base}(f)$
• the impulse response of the transmission line is then $R_{line}(t)=\mathcal{F}^{-1}(R_{line}(f))$, where $\mathcal{F}^{-1}$ is the inverse Fourier transform

Note that no window function is applied to the responses; that will be the subject of later experiments.

## Initial Results

Figure 3  shows the baseline spectrum, $S_{base}(f)$, with a 50Ω terminator connected directly to the TDR.

Figure 3: TDR’s Baseline Spectrum

The reasons for the ripple at 1.1GHz and discontinuities around 100-300MHz are unclear; possibilities are discussed in RTL SDR Dongles: Anomalous Frequency Domain Response.

Figures 4 and 5 show the frequency response, $R_{line}(f)$ and impulse response, $R_{line}(t)$ of 2.02m RG-58 cable terminated with 50Ω, 75Ω, a short-circuit and an open-circuit.

The main peak is at 2.1m, and the echoes at 4.22m and 6.27m presumably indicate a less than perfect match at the splitter-combiner. The peak at 6cm is presumably due to mismatches inside the TDR. Update: the spurious echoes and “hash” between 0 and 2m can be significantly reduced, as will be described in part 2.

Figure 6 shows the reflections from an open-circuit stub located 3m along a terminated transmission line.

Figure 6: Distance Resolution

The first peak at 3.1m is caused by the tee, the second is caused by reflections off the end of the stub. Two impulse responses are shown, for 19cm and 29cm long stubs with reflections at ~3.3m and ~3.4m respectively.

Figures 7 and 8 show the frequency response, $R_{line}(f)$ and impulse response, $R_{line}(t)$ of a much longer transmission line: a terrestrial TV feed cable from a roof-mounted antenna. The characteristics of the cable are unknown, but reception is variable across the DTV band around 650MHz. It is probable that the reflections at 13.1-14.1m are from the antenna itself. The reflections at 4-5m and 2m may or may not be the cause of the patchy reception; either way they are undesirable.

Those results are sufficient to demonstrate the principle of using an SDR dongle plus noise source, but there are annoying imperfections in the results. It will be interesting to see if the imperfections can be minimised by further processing.

## 5 thoughts on “Poor Man’s Homebrew TDR With 4cm Resolution – Part 1”

1. Mike says:

I wonder if the Python programs are available and I cant seem to find part 2 of this article

Regards
Mike
GD6ICR

Like

• The second article is written but I need to check/modify it, and to sort out which is the appropriate licence for the code. I’ve already thought of some extra improvements but haven’t implemented them. (Memo to self: the best is the enemy of the good.)

Thanks for your interest; it is an incentive to increase the priority of the task. It is unlikely to be within the next week, since I’m preparing my spare Tektronix 1502 TDR for sale next weekend.

Like

2. Pingback: SDR Utilities | Entertaining Hacks

3. Mugen710 says:

Hello tggzzz,

i really like it very much, what you achieved and want to reproduce your experiment. But i am not so strong in IFFT Python programming. Could you please post the code?

Best regards

Like