In this paper, we present Timing-sync Protocol for Sensor Networks (TPSN) that aims at providing
network-wide time synchronization in a sensor network. The algorithm works in two steps. In the
first step, a hierarchical structure is established in the network and then a pair wise synchronization is performed along the edges of this structure to establish a global timescale throughout the
network. Eventually all nodes in the network synchronize their clocks to a reference node. We
implement our algorithm on Berkeley motes and show that it can synchronize a pair of neighboring
motes to an average accuracy of less than 20μs. We argue that TPSN roughly gives a 2x
better performance as compared to Reference Broadcast Synchronization (RBS) and verify this
by implementing RBS on motes. We also show the performance of TPSN over small multihop
networks of motes and use simulations to verify its accuracy over large-scale networks. We show
that the synchronization accuracy does not degrade significantly with the increase in number of
nodes being deployed, making TPSN completely scalable.