Raspberry Pi and GPS for Testing Camera Image Timestamps with NTP and PPS


An image time-stamp will tell you when an image was acquired by its camera, they are typically donated in Coordinated Universal Time (UTC) – accurate time-stamps are very often important in Computer Vision Applications especially those that involve observing or analyzing change over time.

Implementing such time-stamp functionality on a camera is very hard and typically involves both hardware and software support – testing the functionality to make sure that the time-stamps are accurate is nearly even harder!

A time-stamp’s accuracy is partly dependent on how well the camera’s time is synchronized, if it’s time is well synchronized by the Network Time Protocol (NTP) then an accuracy of a few milliseconds can be expected, if full pulse-per-second (PPS) synchronization is used then (with care) an accuracy of tens of microseconds can be achieved.

In order to test time-stamp accuracy it is necessary to have an accurate time source to act as a test base-line for comparison purposes, multiple cameras can the then be synchronized to this via their acquisition triggers and NTP or PPS and their images and image time-stamps can be compared.

To this end we have been prototyping a Stratum 1 time source built using a Raspberry Pi with a GPS shield. This will take its time reference from GPS and provide the following for testing cameras:

+ NTP time server (stratum 1) – Raspberry Pi & NTP syncs its time to GPS time via PPS signal and time packets (ZDA packets), the cameras’ NTP clients can use this for synchronizing their clocks (purley software based synchronization).

+ Electrical PPS output – Can be used by camera for syncing it’s time via PPS and for triggering acquisition on second boundaries

+ Re-transmit PPS time packets (ZDA) via UDP – Can be used by cameras for syncing their time via PPS (software & hardware synchronization)

To build the time source we are following this excellent article which explains the various steps involved:


Many thanks to David Taylor, it is a rather complex subject with lots of software setup on the Pi, it hurts our heads but we are making progress, and the initial prototype has already been very helpful in characterizing camera triggering and time-stamping behavior. We expect great things.

In terms of hardware we are using:

Uptronics Raspberry Pi+ GPS Expansion Board – with the GPS Timing Antenna

Raspberry Pi 3