LeapSecond.com
picPET -- Precision Event Timer

21-Sep-2009

Introduction

There are many ways to measure time and frequency or to compare frequency standards. It can get complicated and expensive when nanosecond or picosecond precision is required. But not all timing needs to be that accurate. If you are measuring fan blades, heart beats, wheel rotations, spark plugs, mains power line cycles, pendulum swings, watch ticks, or the gradual drift of 1PPS signals over hours or days then millisecond or microsecond precision is sufficient.

Over the years I've developed a simple solution for such measurements.

picPET™ is a PIC-based Precision Event Timer. Given an accurate 10 MHz reference frequency it will continuously time-stamp events with sub-microsecond precision and output both the time stamp and an event count at 19200 baud RS-232. An event is defined as the rising edge of an input pulse. That's all there is to it: one pulse in, one time-stamp out.

The picPET works equally well for random or periodic events, as slow as one event a minute or as fast as a hundred every second. Data is typically logged by a PC using a native serial COM port or a USB/serial adapter.

No software or drivers are required; the output format is directly readable with any native serial or LAN/USB-hosted virtual com port. Multiple picPET's can be connected to the same PC using N-way USB/serial adapters and USB hubs (I have one laptop with 40 serial ports).

There are no issues with serial port, USB, operating system latency -- because the time-stamp is generated by the PIC hardware. The only purpose of the PC is to log the data. Thus communication delays or jitter have no effect on the readings.

picPET is a medium-performance continuous time-stamping counter (TSC). Measurement accuracy is determined by the accuracy of the 10 MHz clock alone. There is no dead-time. Like any TSC, one can determine frequency or time intervals simply by subtracting successive readings. A TSC can be used as a frequency counter, a time-interval counter, or a phase comparator. The raw data can be used to generate phase, frequency, and stability (Allan deviation) plots.

Operation

The picPET could not be simpler to use. Besides +5 VDC power (pin 1) and ground (pin 8), there are only three pins!

Pin 2 -- The 10 MHz clock drives the PIC (it runs isochronous code). It's supposed to be a CMOS-compatible square wave but the PIC is incredibly forgiving. I often just drive it with the 10 MHz sinewave output of a frequency standard or GPSDO.

Pin 5 -- An event is defined as the rising edge of any pulse on this pin. Since it's a Schmitt trigger diode protected input the PIC is very forgiving.

Pin 3 -- The serial output is 5V level RS-232; that is, it can go directly to a PC.

Sample output format is:

83.2567392 88
84.2567696 89
85.2567856 8A
86.2568192 8B
87.2568664 8C
88.2569244 8D

The first field is the decimal time-stamp with seconds units and 100 ns resolution (400 ns granularity). The count wraps at 100 seconds. Time interval is simply the difference between samples. In this example, the time interval of these 6 pulses is 1.0000304, 1.0000160, 1.0000336, 1.0000472, 1.0000580 seconds, respectively. One can thus use a picPET as an interval or frequency counter.

The second field is the hexadecimal event count. This field can normally be ignored since it will increment by 1. The count wraps at 0x100 (256) events. Clever uses of the event count will be described later.

Time Stamping Counters

The picPET is a one-input time stamping counter (TSC), not the more familiar two-input time interval counter (TIC).

Traditional interval timers measure from A to B, then C to D, then E to F, etc. By contrast a continuous interval timer, or time stamping counter, measures the time of A, of B, of C, D, E, and so on. This allows one to compute B-A, C-B, D-C, E-D, or E-C, C-A, or even E-A, etc. This added flexibility, no time drift, and zero deadtime between measurements makes TSC (time stamping counters) more attractive than TIC (time interval counters) for some applications.

An additional benefit is that once a TSC is started you don't even need to record all the data; accidental or deliberate undersampling is fine, Unlike TIC, no long-term phase information is lost if some TSC output is missing.

Sample Projects

See ...

Availability

The relativity kids have grown up a bit since you last saw them in 2005. Time for them to learn what work is. I've assigned them the task of taking orders, burning firmware, testing, packaging and shipping. The cost is $3 for a picDIV (ten for $25) and $5 for a picPET (ten for $40). First-class postage is $2. Contact me (tvb@LeapSecond.com) for PayPal payments.


See LeapSecond.com PIC project page.
Return to LeapSecond.com home page.
Comments/questions to tvb.