Close

On accuracy

A project log for Raspberry Pi Zero W desk clock

An LED desk clock driven by NTP on a Pi Zero W

Nick SayerNick Sayer 03/20/2017 at 22:220 Comments

I've been pretty dramatically under-promising on the accuracy of the clock, talking about the tens of milliseconds or so.

It turns out that my experimental observations suggest the clock does much better than I expected.

My means of testing is to take 240 fps slow motion video with my phone of a GPS clock and a Pi clock.

The GPS clock is architecturally similar - it's the same MAX6951 display driver chip, but it's being run by bit-banged SPI from an ATTiny841 that's listening to a GPS receiver module. The GPS clock is driven primarily by the PPS. What inaccuracy there is is due to the interrupt processing latency, plus the time it takes to update the display with SPI. My guess is that it's maybe a maximum of 100 µs slow.

When I take video of the two together, the two tenth-of-a-second digits change almost always in the same frame. For 240 FPS video, a frame is 4.16 ms, so when they switch in the same frame, they're at least that close to each other. Giving it the benefit of the doubt, if it's within 10 ms, then that's still an order of magnitude better than the granularity (100 ms), so it's definitely a win.

Oh, and this is comparing a Pi clock that's just running NTP over WiFi against 4 random hosts in the NTP pool. There's no local server involved.

Discussions