Aligning several cameras and an inertial unit to one clock
Where the microseconds come from at each layer of a multi-camera rig, and how to tell an offset you can calibrate from jitter you cannot.
The budget in one table
| Layer | What it fixes | Order of magnitude | Where it is measured |
|---|---|---|---|
| 0. Oscillator | Two boards drifting apart on their own | seconds per day | Nothing measures it. It is the reason layer 1 exists |
| 1. Clock domain | What time it is, on every board | tens of nanoseconds with PTP hardware stamps | PTP offset log, or a scope on a pulse-per-second output |
| 2. Local trigger | When each sensor began exposing | sub-microsecond on one board | Two probes on the frame-start pins |
| 3. Cross-board start | When all the boards began | microseconds, dominated by the spread of the start message | A GPIO edge at each trigger against a shared time base |
| 4. Frame matching | Which frames belong together | tens of microseconds | The spread inside each recorded group, over a long run |
Only the last row describes the dataset. The rows above it either cancel or convert into it, which is why a single quoted sync figure is impossible to evaluate.
Start with the crystal, not the code
Two boards that agree on the time at switch-on will not agree by the end of the day. The gap is set by the oscillator tolerance, and the arithmetic is simple enough to do before buying anything. A 50 parts per million part drifts 50 microseconds per second, which is 4.32 seconds over 24 hours. A 20 ppm part gives 1.73 seconds. Neither clock is wrong; they are just independent.
That number is the reason alignment has to be a repeating process rather than a setup step. Any scheme that aligns once and then trusts the result fails on the timescale of a recording session, and the failure is silent because each board's own timestamps stay perfectly ordered.
Layer 1: one clock domain
The first layer is the clock itself, and the choice of protocol decides what the other layers can achieve.
PTP, standardised as IEEE 1588, exchanges timestamps between a master and its slaves and corrects for the propagation delay between them. When the timestamps are taken in the network hardware rather than in software, the residual offset is in the tens of nanoseconds. The hardware part is not optional: a timestamp taken by the kernel after an interrupt has already absorbed the interrupt latency, and that latency is the thing being measured.
NTP reaches milliseconds, and on Wi-Fi it can be worse because the wireless link adds variable queueing. Wi-Fi TSF reads the access point's beacon counter and can do better than NTP, but it is bounded by beacon timing and by the driver's ability to read the counter at the right moment. Neither belongs in a budget that expects microseconds.
If a rig can be wired, wire it. A gigabit switch between the boards costs less than the cameras, and it removes the entire wireless error term from the budget before anything else is measured.
Layer 2: trigger the exposure, do not infer it
Knowing the time accurately is not the same as knowing when the sensor exposed. A camera with a rolling shutter starts each row at a different moment and reports only the start of the frame, and the moment that start happened is decided by a signal, not by the timestamp of the file that eventually contains the image.
The reliable pattern drives that signal. Most machine-vision sensors accept a frame-start input, often called FSYNC or FSIN, and the frame begins when the pin is asserted. A hardware timer generates that pulse, and every camera on the board is driven from the same timer, so they begin together to within the skew of the buffer that drives both pins. That is where half a microsecond comes from, and it is a property of the board rather than of the network.
The pattern to avoid is letting the sensor free-run and then stamping the frames on arrival. The timestamp then includes the image pipeline, the buffer queue and the scheduler, all of which vary with load, and the original moment is gone.
Layer 3: start across boards
Once each board has its own hardware trigger, the remaining problem is starting them at the same instant without putting the network in the timing path.
The pattern that works broadcasts the intended start time rather than a start command. The master sends a future timestamp, each board receives it, and each board arms its own timer to fire the local trigger when its clock reaches that value. Latency in delivering the message no longer matters, because the board is not waiting for the message to act, only to know when to act.
What does matter is the spread of that latency rather than its mean. A constant delay of ten microseconds is absorbed by the clock correction in layer one. A delay that varies from five to fifty microseconds becomes an alignment error, and it is invisible in a report that quotes only the average. Ask for the maximum over a session, and for the number of samples behind it.
Layer 4: match the frames
The last layer is grouping. Each stream carries a timestamp for its own start of frame, and the recorder collects the frames whose timestamps are closest, one from each camera, into a group. The spread within that group is what the dataset actually sees, and it is the only figure worth putting in a specification.
Everything above it either cancels or converts into this number. A clock offset of twenty nanoseconds and a start latency of ten microseconds both disappear if they are stable. The residual is the sum of whatever did not cancel, plus the quantisation of the grouping rule.
How to check each layer
Measurement, not documentation, is what makes these numbers real.
- Clock. Run the PTP daemon in logging mode and read its offset estimate, or, better, drive a one-pulse-per-second output from each board onto an oscilloscope and look at the two edges. The scope does not share the assumption that the software is honest.
- Trigger. Put two scope probes on the two FSYNC lines of the same board and trigger on one. The distance between the rising edges is the layer two figure, and it should not change when the camera is set to a different resolution or frame rate.
- Cross-board. Drive a GPIO high when the local trigger fires, on both boards, and measure the two edges against the shared time base. Repeat for an hour, and record the maximum, not the average.
- Grouping. Log the timestamps of every group over a real session and take the maximum minus the minimum inside each group. Plot the distribution. If the tail is ten times the mean, the mean was never the useful number.
Failure modes worth knowing before they bite
- Stamping at the sink. A timestamp written when the application receives an image describes the software path, not the exposure. It cannot be corrected afterwards because the information needed to correct it has been discarded.
- Means without tails. A reported mean absolute deviation says nothing about the worst case. A training pipeline that pairs frames with actions at a fixed tolerance is sensitive to the tail, not to the average.
- Frame reordering in the encoder. When H.265 metadata is carried as a per-frame message, it has to follow the picture order count rather than the order in which frames leave the encoder. A recorder that assumes otherwise pairs timestamps with the wrong images, and the symptom looks exactly like an occasional dropped frame.
- A yardstick borrowed from the wrong sensor. A 30 frames per second camera tolerates a few hundred microseconds of error without anyone noticing. An inertial unit at a kilohertz has a one millisecond sample interval, so the same error is a percent of the interval. Budget against the fastest sensor, not the most visible one.
- Resynchronisation that never happens. Clock correction has to run continuously. A rig that aligns before a session and then disables the correction is relying on the crystal, which is the layer zero problem again.
- A switch that does not carry PTP. Transparent-clock and boundary-clock support in the switch keeps the correction from being distorted by queueing. A plain switch passes the packets but not the timing, and the offset degrades in a way that looks like a bad clock.
What to ask a vendor
- Which physical path was each figure measured on, wired or wireless.
- Whether the figures are means, maxima, or percentiles, and over how long a run.
- Whether the timestamp is taken in hardware at the sensor interface, or in the driver, or in the application.
- How often the clock is corrected, and what happens when a correction is missed.
- Whether the frame timestamp travels inside the stream or in a side channel, and what happens to it when packets are retransmitted.
- What the alignment figure is at the inertial unit, not only at the cameras.
Official reading
IEEE 1588-2019 standard for a precision clock synchronization protocol
Linux PTP project documentation
Editorial guide. Sources reviewed on 2026-11-06; no hands-on testing.