[LEAPSECS] embedded data loggers?

Hal Murray hmurray at megapathdsl.net
Mon Jan 11 03:19:26 EST 2016


> Have been rummaging around looking at Arduino and/or Raspberry Pi hacks, but
> the former seems under-powered to run a full NTP instance and the latter is
> not real-time. Surely there must be an off-the-shelf dohickey that can
> return (via a unix-style service, for instance) a reliable ~millisecond
> timestamp corresponding to a trigger? 

The Raspberry Pi supports PPS inputs.  I haven't investigated the details, 
just followed the cookbook for setting up a GPS board that sits on top of the 
Pi.

In case it's not obvious, you can repurpose the PPS infrastructure for other 
hacks.  The interrupt routine grabs the time which user code can read at its 
leisure.  I use it for watching the time from the power line.

Real-time isn't an issue at the milisecond level.

ntpd works fine on a Pi.

There are several major versions of the Pi.  The new one is significantly 
faster.

Beware, GPIO inputs are (only) 3.3V.

If you are interested in fine print, one weak link in the Pi is that the 
Ethernet is connected via USB which adds a hardware polling delay, aka 
jitter.  There is a flag to eliminate the batching delay.  Round trip time 
from a PC as shown by ntpq is under 0.6 ms to an old Pi and under 0.4 to a 
new Pi.

You can try things on a PC with a serial port.  The normal setup is PPS on pin 1, DCD.

Linux PPS also works on USB serial adapters.  They use slow USB (1.0?) so the polling rate is 1 ms, but aside from that it works.

Linux has a hack where you can read the PPS info from a script.

root at rp7:/home/murray# cat /sys/devices/virtual/pps/pps0/assert
1452499255.000008059#3592986
root at rp7:/home/murray# 

The stuff before the # is the time of the last pulse, seconds and nanoseconds.  The stuff after is the count of pulses since the PPS device was setup.


-- 
These are my opinions.  I hate spam.





More information about the LEAPSECS mailing list