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

Understanding Thermal Challenges in EV Charging Applications

March 28, 2024
As EVs emerge as the dominant mode of transportation, factors such as battery range and quicker charging rates will play pivotal roles in the global economy.

Board-Mount DC/DC Converters in Medical Applications

March 27, 2024
AC/DC or board-mount DC/DC converters provide power for medical devices. This article explains why isolation might be needed and which safety standards apply.

Use Rugged Multiband Antennas to Solve the Mobile Connectivity Challenge

March 27, 2024
Selecting and using antennas for mobile applications requires attention to electrical, mechanical, and environmental characteristics: TE modules can help.

Out-of-the-box Cellular and Wi-Fi connectivity with AWS IoT ExpressLink

March 27, 2024
This demo shows how to enroll LTE-M and Wi-Fi evaluation boards with AWS IoT Core, set up a Connected Health Solution as well as AWS AT commands and AWS IoT ExpressLink security...

Comments

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