# Low-Cost, High-Resolution Time-Measurement Application

**What is Time Domain Reflectometry (TDR)?**

Time Domain Reflectometry (TDR) is a measurement of the impedance of a transmission line using the reflected energy of a pulse sent down that transmission line. As a pulse is sent down a transmission line, it travels at the speed of light for the media it is in (typically, 60% to 80% of the speed of light in free space). As the pulse arrives at an impedance, mismatch energy is reflected back to the pulse source and arrives at a time that is two times the electrical distance from the pulse source to the impedance mismatch. Figure 1 shows the typical waveform at the pulse source of an un-terminated transmission line.

**Goal of Design**A great deal of information can be determined using a TDR, such as the consistency of the impedance along the transmission line, quality of connectors, location of connectors, length of transmission lines, faults due to shorts, or faults due to opens. But the cost of the test equipment involved is not cheap—typically many thousands of dollars. In most cases, we are interested in one of three pieces of information—the length of the transmission line, faults due to shorts or faults due to opens.

This brings us to the subject of this article. If we limit our need for information to the following, then a low-cost solution can be implemented:

1. Transmission-line length

2. Location of faults due to opens

3. Location of faults due to shorts

The goals for this design are:

* Worst-case time resolution of 1 ns (better then 0.5ft)

* Overall accuracy of time measurement on the order of +-1%

* Maximum length of measurement with 0.5 ft. resolution greater then 200 ft.

* Cost to be less then $10, for component costs associated with the TDR

**Time Measurement with a Charge Time Measurement Unit (CTMU) Peripheral**

The heart of the low-cost TDR system is a peripheral called the Charge Time Measurement Unit (CTMU). A CTMU peripheral on a microcontroller can be used to measure time with a high degree of precision and resolution [typical resolution is less then 1 nanosecond (ns)].

A simplified CTMU block diagram is shown in Figure 2 and consists of the following:

* Constant current source and high-speed switch

* Analog-to-Digital Converter (ADC)

* Discharge switch

* Analog multiplexer

All of these blocks are integrated onto a single microcontroller.

The CTMU is a constant current source that can be turned on and off in less then 1 nanosecond (ns). This current can be converted to a time-dependent voltage with the addition of a capacitor, using the following standard equation:

I = C(dV/dT) Eq. 1

Solving for dT and integrating, we arrive at:

T = (C/I)V Eq. 2

I is the output current of the CTMU current source, C is the input capacitance of the ADC plus any stray capacitance, and V is measured by the ADC. This results in the ability to calculate what T is.

The current output of the CTMU is connected to the on-chip 10-bit ADC, which uses a capacitive Digital-to-Analog Converter (DAC) for an input. So, we have a current source that can be turned on and off in less then 1 ns and an ADC with a fixed capacitance for an input. The analog-to-digital input is charged for an unknown amount of time, after which a voltage measurement is made using the ADC. Knowing C and I, and measuring V, we can calculate T. Figure 2 shows a typical waveform generated by the CTMU. The first pulse closes the switch, starts the charging of the analog-to-digital input capacitor and creates a linear voltage ramp (see Figure 1). The second pulse opens the switch and stops charging the analog-to-digital input capacitor. The voltage can now be measured and the time calculated using Eq. 2.

Software calibration can be accomplished by measuring two known times and calculating a value for C/I.

**Implementation of TDR Design**

Figure 1 shows a simplified schematic of the TDR circuitry and the TDR waveform. Not shown is a 16-bit microcontroller with the CTMU peripheral on-chip, in this case a PIC24FJ32GA102. The microcontroller provides a pulse that goes to a high-speed buffer, which drives a 50 ohm coax through a 50 ohm resister. This results in the waveform shown in Figure 1. The resulting waveform is fed to a set of dual high-speed comparators with respective trip points of 1/4VPULSE and 3/4 VPULSE, where VPULSE is the amplitude of the pulse generated by the microprocessor and output to RF4. The comparator provides the edges CTED1 and CTED2 needed to measure time, as shown in Figure 2. CTED1 provides the start edge and CTED2 provides the stop edge. The resulting voltage is measured by the ADC and represents the time between EDGE1 and EDGE2, or 2 times the electrical length of the 50 ohm coax. The CTMU peripheral’s resolution is less then 1 ns, resulting in an overall resolution of less then 0.5 ft. With a 10-bit ADC, the max length is 500 ft.

Conclusions

Referring back to the goals, first with a resolution of 1 nS or better the CTMU can easily provide a resolution of 0.5ft when measuring cable length. With software calibration and the use of a 0.01% crystal, the system can easily be calibrated to 1% accuracy with no electrical adjustments. The 10-bit ADC gives a maximum range of .5 ft times 1024, which exceeds the 200 ft. range requirement. Finally, looking at approximate costs for the TDR related components, system cost is below $10:

Vendor

Components

Price

Microchip Technology

PIC24FJ32GA106 16-bit MCU

$2.12 each

National Semiconductor

LMH6559 Buffer

$0.95 each

Linear Technology

LT1712 Dual Comparators

$3.35 each

BNC Connector

1 Connector

$1.58 each

Misc. Components

Resistors, Capacitors, etc.

$1.00 each

Total

$9.00

So, the cost goals have been met. The end result is a robust, easily implemented and low cost TDR.