NTP solution for network of Raspberry Pi devices

时间:2015-11-18 21:03:12

标签: raspberry-pi raspberry-pi2 ntp

I've built my own digital signage solution based around the Raspberry Pi. Basically all of the Pi's are scattered around one city in the midwest (for now), and they ask for hourly updates from a VPS that happens to be physically located in Dallas. The actual displaying by the Pi is done via a webapp in chromium that opens on boot, and uses javascript to cycle through content at defined intervals.

As an example, say two of these displays are in the same location, each changing the image on the screen every 4 seconds. And assume for the hour starting at 15:00, they are given the same list of content to cycle through by the server. When 15:00 rolls around, both display content item A, wait 4 seconds, display content item B, etc. before coming back around to A again.

As the raspberry pi has no real time clock chip, both would be getting all of their time information via NTP. ntp.conf tells me:

"pool.ntp.org maps to about 1000 low-stratum NTP servers. Your server will pick a different set every time it starts up."

And this works well almost all of the time, as these two screens would appear to be perfectly synchronized,changing to the same thing at the same time, but every now and then I catch them de-synced for a little while.

My theory is that since they are selecting different NTP servers from the pool (and maybe some of these are far away etc.), they are getting different enough time updates for one to think it is 15:00:005 and the other to think it is 15:00:00.

Finally arriving at the question (sorry), would it be worth it for me to set up my Dallas server as the only NTP server for all my scattered Pi's? Even if the Dallas server is wrong by a few seconds, at least they would all be synchronized, ignoring the fact that one Pi's data may take a different route to Dallas than another's, therefore making the time update slightly incorrect. To clarify, I don't care if the Pi thinks it's 15:00:005 when it's actually 15:00:00, I just want them ALL to think it's 15:00:005.

Maybe I'm worrying about it too much, or underestimating the accuracy of 3-4 low-stratum NTP servers even if they are far away. Thought it would at least be an interesting question. Thanks in advance!

1 个答案:

答案 0 :(得分:2)

取决于您的错误窗口(看起来非常狭窄)

  1. 您将它们全部指向同一个NTP服务器(可能是您自己的)并且在当天获得有关您的数据包往返的错误,这可能会让您获得精确的秒数,具体取决于您的网络。
  2. 安装GPS模块,GPS卫星广播非常精确小时。他们甚至还有位置信息,因此您可以了解时间戳的偏差。如果正确完成,这是非常精确的,甚至有无线网络广播系统使用这种技术进行数据同步。