Measure Nanoseconds With A PIC Microcontroller

Sept. 1, 2003
Nanosecond interval timers are a critical component in products as diverse as time-domain reflectometers (TDRs), collision-avoidance systems, radar altimeters, and nuclear instrumentation. This simple circuit, which runs off a single 5-V supply,...

Nanosecond interval timers are a critical component in products as diverse as time-domain reflectometers (TDRs), collision-avoidance systems, radar altimeters, and nuclear instrumentation. This simple circuit, which runs off a single 5-V supply, allows a PIC 16F877 to measure pulse lengths from 2 to 950 ns with a 1-ns resolution. Linearity over the full dynamic range is ±1 count.

Referring to Figures 1 and 2, the input pulse (VIN) and the trigger are applied to the circuit at the same time. In this application, the PIC reads its ADC 240 µs after receiving the interrupt on the trigger input. A 2-V input pulse causes 11.5 mA to flow through Q1, Q2, and R7. Q1 and Q2 form a temperature-compensated pair of emitter followers. The current flowing through Q2 and R7 is identical due to the current mirror formed by Q3, Q4, and Q5. The biasing provided by R2 and R3 eliminates voltage droop on C1 by ensuring that Q2 remains off until the input voltage exceeds 0.7 V. C1 integrates the current for the duration of the input pulse, producing a voltage at B proportional to its width.

Figure 3 shows the input pulse and the response at B on a faster time scale and at higher resolution than shown in Figure 2. U1 amplifies and buffers the signal at B and drives the ADC (node C). Note that the ramp on trace C in Figure 2 is due to the op amp's step response, not because of integration on C1. After the ADC is read, the PIC resets the circuit via Q6. Resistors R4, R5, R6, R7, and R8 damp transients that would degrade linearity.

For prototyping purposes, the matched pairs Q1-Q2 and Q3-Q4 can be made by selecting transistors with a closely matched VBE and gluing them together with five-minute epoxy. Refer to Pease Porridge "What's All This Logarithmic Stuff, Anyhow?" (Electronic Design June 14, 1999, p. 111) for the procedure. In production, matched arrays such as the T320 and T340 (www.thatcorp.com) would be appropriate.

Board layout is critical for maximum performance. Leads should be very short, and node B in particular should have as little inductance as possible. Star ground and power distribution is recommended for all components between VIN and the op amp. On the prototype, the noise at C is less than 1 mV p-p, corresponding to a time resolution of under 200 ps. The 10-bit ADC limits the resolution to 1 ns. Adding a higher-resolution external ADC would improve performance accordingly.

Sponsored Recommendations

Near- and Far-Field Measurements

April 16, 2024
In this comprehensive application note, we delve into the methods of measuring the transmission (or reception) pattern, a key determinant of antenna gain, using a vector network...

DigiKey Factory Tomorrow Season 3: Sustainable Manufacturing

April 16, 2024
Industry 4.0 is helping manufacturers develop and integrate technologies such as AI, edge computing and connectivity for the factories of tomorrow. Learn more at DigiKey today...

Connectivity – The Backbone of Sustainable Automation

April 16, 2024
Advanced interfaces for signals, data, and electrical power are essential. They help save resources and costs when networking production equipment.

Empowered by Cutting-Edge Automation Technology: The Sustainable Journey

April 16, 2024
Advanced automation is key to efficient production and is a powerful tool for optimizing infrastructure and processes in terms of sustainability.

Comments

To join the conversation, and become an exclusive member of Electronic Design, create an account today!