IEEE1588 based PTP protocol for Clock Synchronization in IoT
Time synchronization plays a vital role in IoT when the server is on emblematically on fire due to the conflict in time synchronization. Most people think that servers, workstations and network devices clocks are inherently accurate. Totally incorrect. In IoT clock synchronization is a serious issue because every phase of super visioning, securing, development, and debugging a network includes determining when events occur. Clock also offers the only frame of reference among all devices on the network.
One of the most accurate clocks in the world are being run by US National Institute of Standard and Technology. So, the question is if we have such perfect figures to comply to then why can’t we update our systems to that?
The reason is, latency occurs everywhere, therefore, perfect synchronization is not possible in clock. A simple example can help explain this phenomena, the speed of light is fast in a vacuum and a photon is able to circle the world more than seven times per second yet it still travels approximately 31% slower through a classic optical fiber network. For simple understanding, you can transfer a single bit of data halfway around the world in less than a tenth of a second.
However, we know that there is nothing ideal in the world. Add in switches, routers, and other network infrastructure, and that tenth of a second multiplies several times over.
Clock synchronization explained
One of higher concern of multiple clients inside the same network is synchronization. Suppose a financial institution in which Company X’s stock has thoroughly 100 shares. All of those 100 shares are bought by several investors over the period of a second, but due to synchronization not properly developed between the institution’s servers, there is no way to tell which order came first.
Network Time Protocol
Network Time Protocol(NTP) has been widely used for synchronization of clock and right now its fourth major version is running. It has accuracy up to milliseconds and right now, mostly IoT based distributed system require accuracy up to a microsecond.
Precision Time Protocol
Precision Time Protocol is a new standard of network-based time synchronization, Precision Time Protocol (PTP) networks target to reach nanosecond- or even picosecond-level synchronization in place of milliseconds level synchronization. For commercial and industrial applications, NTP is accurate enough but if you require even formfitting synchronization and time stamping like we require in IoT, you’ll have to shift to a PTP server.
PTP time stamping is so perfect because instead of software it uses hardware time stamping, and PTP equipment is a special purpose dedicated apparatus used to keep the devices synchronized. On the basis of that single-handed, Precision Time Protocol (PTP), networks offer much piercing time accuracy, and PTP devices timestamp the amount of time which synchronization messages spend during going through each device, which cause for device latency.
A graphical representation of clock synchronization
Every PTP follows the following pattern of four messages between master and slave:
- From master to slave initial sync message
- From master to slave a follow-up sync message
- From slave to master a delay request
- From master to slave a final delay response message
That above sequence pattern yields four different timestamps:
- (T1) the master sends the initial sync message
- (T2) the slave receives the initial sync message
- (T3) the slave sends the delay request
- (T4) the master receives the delay request
During the delay response phase, slave gets the all the four-time stamp from master side, and then the network latency calculated in both directions through slave between master and slave. Extra latency introduced by operating system(OS) working locally can be escaped from the local clock, slave devices from end to end by a special purpose hardware fetch timestamp.
NTP networks have additional latency and a smaller amount of accuracy simply because they’re software-based, and all requests of timestamp have to hold for the local operating system. For different companies, network time protocol(NTP) offers a piercing time resolution to resolve clashes in a timely manner, but some organizations comprising the aforementioned physics laboratories want a far better level of synchronization.
So, on a packet switch network, the PTP is looking to be one of the best synchronization solutions because of its accuracy up to microsecond or nanosecond while synchronizing the clock.
In internet of things (IOT) and industry wireless communication, every single sensor should be smart and must have the ability to interconnect over a network. The wired network is not a choice in most of network. The devices must be synchronized through the wireless link also for their use in measurement, industrial and control networks. There are a lot of wireless technologies, maximum of them are radio base created and not deterministic that makes them fairly exciting for implementing the PTP. So, PTP is the need of time in IoT for clock synchronization in multiple domain.