Testing - Art-ut-Kia/JitterMeter GitHub Wiki
Two kinds of tests were performed: self-test and tick generations by a PC running Windows.
The 1st one only requires that pin D13 would be connected to pin D2, and that the version of the sketch with the following statement activated…:
#define selfTest
…would be loaded.
The data sent by the Jitter-Meter are then collected by the Serial Monitor of the arduino IDE. A copy & paste into Excel permits to process them. First, the hexadecimal data is converted into decimal then scaled to milliseconds (dividing the decimal value in µs by 1000). Last, the period of each cycle is computed by differentiating the successive times. The results from the self-test are depicted by the following plot:
It can be observed that the jitter is as low as +/-12µs (peak values). The average value is 10.0000001 ms (supposed to be 10ms by design). Therefore the error appears to be as low as 0.01 PPM (part per million). This amazing accuracy far exceeds any crystal clock performance. However it is meaningless, since this is the same arduino clock that generates the signal and that measures it.
A test program was written on a PC, limited to a sole routine that processes a Windows timer callback. The timer period was set to 10 ms. The content of the callback service routine was limited to writing a single NULL character on the COM port. It is well known that the default resolution of the Windows timers is 15.6 ms (1/64Hz). A quick look on the TX signal of the COM port with an oscilloscope actually exhibited a period about between 15 and 16ms.
The following plot depicts the fluctuations of the Windows timer period. It was obtained exactly in the same way than the one in the above "Self-test" paragraph:
It can be noticed that there is some kind of symmetry in the dot cloud. Zooming reveals that when a period is longer than expected, the next cycle is shorten of the same amount so that the average value is accurate. The peak jitter exceeds 2 ms however.
The conclusion is that the Windows timers are not very accurate (but that fact is allready wellknown by everybody) and – most than all – that the Jitter-Meter works well.