Skip to main content
Log in

A Distributed Consensus-Based Clock Synchronization Protocol for Wireless Sensor Networks

  • Published:
Wireless Personal Communications Aims and scope Submit manuscript

Abstract

The birth of computer networks and distributed systems has led to the appearance of the clock synchronization problem. This issue has gained increasing importance with the emergence of new resource constrained networks such as wireless sensor networks. In this paper, we propose a new distributed clock synchronization algorithm, referred to as Weighted Consensus Clock Synchronization (WCCS), whose objective is to achieve a consensus clock among network nodes. In this distributed approach and in contrast to centralized schemes, each node periodically exchanges the local clock reading with its immediate neighbor nodes. Then, each node employs these time informations to calculate its relative offset and skew with respect to its neighbor nodes using a weighted average consensus based technique. The effectiveness of WCCS is proved through both simulations and an experimental study on TelosB mote using TinyOS.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8

Similar content being viewed by others

References

  1. Mills, D. (1991). Internet time synchronization: The network time protocol. IEEE Transactions on Communications, 39, 1482–1493.

    Article  Google Scholar 

  2. Elson, J., & Römer, K. (2003). Wireless sensor networks: A new regime for time synchronization. ACM SIGCOMM Computer Communication Review, 33(1), 149–154.

    Article  Google Scholar 

  3. Elson, J., Girod, L., & Estrin, D. (2002). Fine-grained network time synchronization using reference broadcasts. ACM SIGOPS Operating Systems Review, 36, 147–163.

    Article  Google Scholar 

  4. Ganeriwal, S., Kumar, R., & Srivastava, M. B. (2003). Timing-sync protocol for sensor networks. In Proceedings of the 1st international conference on embedded networked sensor systems (pp. 138–149).

  5. Maróti, M., Kusy, B., Simon, G., & Lédeczi, Á. (2004). The flooding time synchronization protocol. In ACM second international conference on embedded networked sensor systems (SenSys 04) (pp. 39–49).

  6. Maggs, M. K., O’Keefe, S. G., & Thiel, D. V. (2012). Consensus clock synchronization for wireless sensor networks. IEEE Sensors Journal, 12(6), 2269–2277.

    Article  Google Scholar 

  7. Sommer, P., & Wattenhofer, R. (2009). Gradient clock synchronization in wireless sensor networks. In R. Gupta (Ed.), Proceedings of the 2009 international conference on information processing in sensor networks (pp. 37–48). Washington: IEEE Computer Society.

  8. Lenzen, C., Sommer, P., & Wattenhofer, R. (2015). PulseSync: An efficient and scalable clock synchronization protocol. IEEE/ACM Transactions on Networking.

  9. Schenato, L., & Fiorentin, F. (2011). Average TimeSynch: A consensus-based protocol for clock synchronization in wireless sensor networks. Automatica, 47(9), 1878–1886.

    Article  MathSciNet  MATH  Google Scholar 

  10. He, J., Cheng, P., Shi, L., Chen, J., & Sun, Y. (2014a). Time synchronization in WSNs: A maximum-value-based consensus approach. IEEE Transactions on Automatic Control, 59(3), 660–675.

    Article  MathSciNet  MATH  Google Scholar 

  11. Kusy, B., Dutta, P., Levis, P., Maroti, M., Ledeczi, A., & Culler, D. (2006). Elapsed time on arrival: A simple and versatile primitive for canonical time synchronisation services. International Journal of Ad Hoc and Ubiquitous Computing, 1(4), 239–251.

    Article  Google Scholar 

  12. Sommer, P., & Wattenhofer, R. (2008). Symmetric clock synchronization in sensor networks. In A. Dunkels & P. J. Marron (Eds.), Proceedings of the workshop on Real-world wireless sensor networks (pp. 11–15). New York: ACM.

  13. Chen, Y., Tron, R., Terzis, A., & Vidal, R. (2011). Accelerated corrective consensus: Converge to the exact average at a faster rate. In American control conference (ACC), 2011 (pp. 3417–3422). IEEE.

  14. Oreshkin, B. N., Aysal, T. C., & Coates, M. J. (2008). Distributed average consensus with increased convergence rate. In IEEE international conference on acoustics, speech and signal processing, 2008. ICASSP 2008 (pp. 2285–2288). IEEE.

  15. Lenzen, C., Sommer, P., & Wattenhofer, R. (2009). Optimal clock synchronization in networks. In Proceedings of the 7th ACM conference on embedded networked sensor systems (pp. 225–238).

  16. He, J., Cheng, P., Shi, L., Chen, J., & Sun, Y. (2014b). Time synchronization in WSNs: A maximum-value-based consensus approach. IEEE Transactions on Automatic Control, 59(3), 660–675.

    Article  MathSciNet  MATH  Google Scholar 

  17. Wu, J., Zhang, L., Bai, Y., & Sun, Y. (2015). Cluster-based consensus time synchronization for wireless sensor networks. IEEE Sensors Journal, 15(3), 1404–1413.

    Article  Google Scholar 

  18. Heinzelman, W. B., Chandrakasan, A. P., & Balakrishnan, H. (2002). An application-specific protocol architecture for wireless microsensor networks. IEEE Transactions on Wireless Communications, 1(4), 660–670.

    Article  Google Scholar 

  19. Yang, Z., He, L., Cai, L., & Pan, J. (2014). Temperature-assisted clock synchronization and self-calibration for sensor networks. IEEE Transactions on Wireless Communications, 13(6), 3419–3429.

    Article  Google Scholar 

  20. Xu, M., & Xu, W. (2013). Taco: Temperature-aware compensation for time synchronization in wireless sensor networks. In 2013 IEEE 10th international conference on mobile ad-hoc and sensor systems (MASS) (pp. 122–130). IEEE.

  21. Benzaïd, C., Bagaa, M., & Younis, M. (2016). Efficient clock synchronization for clustered wireless sensor networks. Ad Hoc Networks, 56, 13–27.

    Article  Google Scholar 

  22. Djenouri, D., Merabtine, N., Mekahlia, F. Z., & Doudou, M. (2013). Fast distributed multi-hop relative time synchronization protocol and estimators for wireless sensor networks. Ad Hoc Networks, 11(8), 2329–2344.

    Article  Google Scholar 

  23. Luo, B., Cheng, L., & Wu, Y.-C. (2016). Fully distributed clock synchronization in wireless sensor networks under exponential delays. Signal Processing, 125, 261–273.

    Article  Google Scholar 

  24. Bliman, P.-A., & Ferrari-Trecate, G. (2008). Average consensus problems in networks of agents with delayed communications. Automatica, 44(8), 1985–1995.

    Article  MathSciNet  MATH  Google Scholar 

  25. Carli, R. (2008). Topics on the average consensus problems. Ph.D. thesis, PhD school in Information Engineering – University of Padua.

  26. Avrachenkov, K., El Chamie, M., & Neglia, G. (2011). A local average consensus algorithm for wireless sensor networks. In 2011 international conference on Distributed computing in sensor systems and workshops (DCOSS) (pp. 1–6). IEEE.

  27. Knorn, F., Stanojevic, R., Corless, M., & Shorten, R. (2009). A framework for decentralised feedback connectivity control with application to sensor networks. International Journal of Control, 82(11), 2095–2114.

    Article  MathSciNet  MATH  Google Scholar 

  28. Cao, M., Morse, A. S., & Anderson, B. D. O. (2008). Reaching a consensus in a dynamically changing environment: A graphical approach. SIAM Journal on Control and Optimization, 47(2), 575–600.

    Article  MathSciNet  MATH  Google Scholar 

  29. Olshevsky, A., & Tsitsiklis, J. N. (2009). Convergence speed in distributed consensus and averaging. SIAM Journal on Control and Optimization, 48(1), 33–55.

    Article  MathSciNet  MATH  Google Scholar 

  30. Sivrikaya, F., & Yener, B. (2004). Time synchronization in sensor networks: A survey. IEEE Network, 18(4), 45–50.

    Article  Google Scholar 

  31. Lundelius, J., & Lynch, N. (1984). An upper and lower bound for clock synchronization. Information and Control, 62(23), 190–204.

    Article  MathSciNet  MATH  Google Scholar 

  32. Graham, S., & Kumar, P.R. (2004). Time in general-purpose control systems: The control time protocol and an experimental evaluation. In 43rd IEEE conference on decision and control, 2004. CDC (vol. 4, pp. 4004–4009).

  33. Boulis, A. (2007). Castalia: Revealing pitfalls in designing distributed algorithms in WSN. In Proceedings of the 5th international conference on Embedded networked sensor systems (pp. 407–408). New York: ACM.

  34. Pediaditakis, D., Tselishchev, Y., & Boulis, A. (2010). Performance and scalability evaluation of the Castalia wireless sensor network simulator. In Proceedings of the 3rd international ICST conference on simulation tools and techniques (p. 53). ICST (Institute for Computer Sciences, Social-Informatics and Telecommunications Engineering).

  35. Ren, F., Lin, C., & Liu, F. (2008). Self-correcting time synchronization using reference broadcast in wireless sensor network. IEEE Wireless Communications, 15(4), 79–85.

    Article  Google Scholar 

  36. Hussain, S. S., & Sprent, P. (1983). Non-parametric regression. Journal of the Royal Statistical Society Series A (General), 146, 182–191.

    Article  MathSciNet  Google Scholar 

Download references

Acknowledgements

This paper has been written while the first author was visiting the Wireless Sensor group at Lab-STICC in Brest. Financial support through the PNE program established by the Government of Algeria is gratefully acknowledged.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Habib Aissaoua.

Appendices

Appendix 1: Proof of Lemma 1

Proof

Once node i receives a synchronization packet at time \(t_1\), it tries to synchronize itself with the received virtual compensated clock \({\mathcal {C}}_j(t)\). The relative clock rate is the ratio of the virtual compensated clock frequency of node j to the local clock frequency of node i. Thus, from Eqs. (4) and (7) we have:

$${\mathcal {C}}_j(t_1)=\hat{\alpha }_{ij}\tau _i(t_1)+\hat{\beta }_{ij}$$

Subtracting \(\tau _i(t_1)\) from each side of this equation leads to:

$${\mathcal {C}}_j(t_1)-\tau _i(t_1)=\hat{\alpha }_{ij}\tau _i(t_1)-\tau _i(t_1)+\hat{\beta }_{ij}$$

As a result:

$$offset ^{t_1}_{ij}=(\hat{\alpha }_{ij}-1)\tau _i(t_1)+\hat{\beta }_{ij}$$
(17)

Similarly, at time \(t_2\) we have:

$$offset ^{t_2}_{ij}=(\hat{\alpha }_{ij}-1)\tau _i(t_2)+\hat{\beta }_{ij}$$
(18)

and subtracting (17) from (18) gives:

$$offset ^{t_2}_{ij}- offset ^{t_1}_{ij}=(\hat{\alpha }_{ij}-1)(\tau _i(t_2)-\tau _i(t_1))$$
(19)

Consequently,

$$\alpha _{ij}=\frac{ offset ^{t_2}_{ij}- offset ^{t_1}_{ij}}{\tau _i(t_2)-\tau _i(t_1)}$$

\(\square\)

Appendix 2: Proof of Theorem 1

Proof

According to Lemma 1 and Eq. (11), we have:

$$\begin{aligned} \alpha _{i}(k+1)&=\sum \limits _{j\in {\mathcal {N}}_i} w_{ij}(k)\left( \frac{ offset ^{t_2}_{ij}- offset ^{t_1}_{ij}}{\tau _i(t_2)-\tau _i(t_1)}\right) (k)\\&=\sum \limits _{j\in {\mathcal {N}}_i} w_{ij}(k)\left( \frac{({\mathcal {C}}_j(t_2)-\tau _i(t_2))-({\mathcal {C}}_j(t_1)-\tau _i(t_1))}{\tau _i(t_2)-\tau _i(t_1)}\right) (k)\\&=\sum \limits _{j\in {\mathcal {N}}_i} w_{ij}(k)\left( \frac{{\mathcal {C}}_j(t_2)-{\mathcal {C}}_j(t_1)}{\tau _i(t_2)-\tau _i(t_1)}-1\right) (k) \end{aligned}$$

By adding 1 to each side of the equation, we obtain:

$${\alpha }_{i}(k+1)+1=1+\sum \limits _{j\in {\mathcal {N}}_i} w_{ij}(k)\left( \frac{{\mathcal {C}}_j(t_2)-{\mathcal {C}}_j(t_1)}{\tau _i(t_2)-\tau _i(t_1)}-1\right) (k)$$

As \(\hat{\alpha }_{i}=\alpha _{i}+1\), the above equation can be written as:

$$\hat{\alpha }_{i}(k+1)=1+\sum \limits _{j\in {\mathcal {N}}_i} w_{ij}(k)\left( \frac{{\mathcal {C}}_j(t_2)-{\mathcal {C}}_j(t_1)}{\tau _i(t_2)-\tau _i(t_1)}-1\right) (k)$$

From Eq. (12), we can easily prove that \(\sum \nolimits _{j\in {\mathcal {N}}_i} w_{ij}=1\), implying:

$$\begin{aligned} \hat{\alpha }_{i}(k+1)&=\sum \limits _{j\in {\mathcal {N}}_i} w_{ij}(k)+\sum \limits _{j\in {\mathcal {N}}_i} w_{ij}(k)\left( \frac{{\mathcal {C}}_j(t_2)-{\mathcal {C}}_j(t_1)}{\tau _i(t_2)-\tau _i(t_1)}-1\right) (k)\\&=\sum \limits _{j\in {\mathcal {N}}_i} w_{ij}(k)\left( \frac{{\mathcal {C}}_j(t_2)-{\mathcal {C}}_j(t_1)}{\tau _i(t_2)-\tau _i(t_1)}\right) (k) \end{aligned}$$

According to (3) and (8), we can substitute the values of both \({\mathcal {C}}_j(t)\) and \(\tau _i(t)\) into the above equation to obtain:

$$\begin{aligned} \hat{\alpha }_{i}(k+1)&=\sum \limits _{j\in {\mathcal {N}}_i} w_{ij}(k)\left( \frac{(\hat{\alpha }_{j}a_jt_2+\hat{\alpha }_{j}b_j+\hat{\beta }_{j})-(\hat{\alpha }_{j}a_jt_1+\hat{\alpha }_{j}b_j+\hat{\beta }_{j})}{(a_it_2+b_i)-(a_it_1+b_i)}\right) (k)\\&=\sum \limits _{j\in {\mathcal {N}}_i} w_{ij}(k)\frac{\hat{\alpha }_{j}a_j}{a_i}(k) \end{aligned}$$

If we multiply each side of the equation by \(a_i\) we obtain:

$$\hat{\alpha }_{i}a_i(k+1)=\sum \limits _{j\in {\mathcal {N}}_i} w_{ij}(k)\hat{\alpha }_{j}a_j(k)$$

If we denote \(\hat{\alpha }_{i}a_i\) by \(x_i\), we can rewrite the above equation as follows:

$$x_i(k+1)=\sum \limits _{j\in {\mathcal {N}}_i} w_{ij}(k)x_j(k)$$

which can be rewritten more compactly as:

$${\mathbf {x}}(k+1)={\mathcal {W}}(k){\mathbf {x}}(k)$$

where \({\mathcal {W}}\) denotes the \(n\times n\) matrix whose elements are the weights \(w_{ij}\) defined by Eq. (12), and where \({\mathbf {x}}(k)= [x_1(k),\ldots , x_n(k)]^T\) defines a column vector whose elements represent the clock rates of all compensated clocks of the network at time slot k. According to Eq. (12), the elements of \({\mathcal {W}}\) are nonnegative. In addition, \({\mathcal {W}}\) is row-stochastic since it is nonnegative and the sum of the elements of each row is equals 1, i.e., \({\mathcal {W}}{\mathbf {1}}={\mathbf {1}}\) where \({\mathbf {1}} =(1, 1, 1,\ldots , 1)^T\). Also, the state of each node \(i\in {\mathcal {V}}\) will be influenced directly or indirectly by every node \(j\in {\mathcal {V}}\) through a sequence of communications as \({\mathcal {G}}\) is connected according to Assumption 1. Following [28, 29], all this provides a sufficient condition to guarantee that all \(x_i\) will converge to a steady-state value c:

$$\lim _{k \rightarrow \infty }{\mathbf {x}}(k)={\mathbf {c}}{\mathbf {1}}$$

Consequently, as \(x_i=\hat{\alpha }_{i}a_i\),

$$\lim _{k \rightarrow \infty }\hat{\alpha }_{i}(k)a_i=\alpha _v{\mathbf {1}}$$

\(\square\)

Appendix 3: Proof of Lemma 2

Proof

According to Eq. (19), we can write:

$$\begin{aligned} offset ^{t}_{ij}- offset ^{old}_{ij}&=(\hat{\alpha }_{ij}-1)(\tau _i(t)-\tau _i(t_{old}))\\ offset ^{t}_{ij}&= offset ^{old}_{ij}+(\hat{\alpha }_{ij}-1)(\tau _i(t)-\tau _i(t_{old}))\\ {\mathcal {C}}_j(t)-\tau _i(t)&= offset ^{old}_{ij}+(\hat{\alpha }_{ij}-1)(\tau _i(t)-\tau _i(t_{old})) \end{aligned}$$

Consequently,

$${\mathcal {C}}_j(t)=\hat{\alpha }_{ij}\tau _i(t)+ offset ^{old}_{ij}-(\hat{\alpha }_{ij}-1)\tau _i(t_{old})$$
(20)

\(\square\)

Appendix 4: Proof of Theorem 2

Proof

The Eq. (14) can be written as:

$${\mathcal {C}}_i(t)=\hat{\alpha }_{i}\overline{a}_it+\hat{\alpha }_{i}\overline{b}_i+ offset ^{old}_{i}-(\hat{\alpha }_{i}-1)\overline{\tau }_i(t_{old})$$
(21)

where \(\overline{a}_it= \sum \nolimits _{j\in {\mathcal {N}}_i} w_{ij}a_it\) and \(\overline{b}_i= \sum \nolimits _{j\in {\mathcal {N}}_i} w_{ij}b_i\) as stated by Eq. (16). According to Eqs. (8) and (21), we have:

$$\hat{\alpha }_{i}(k+1)b_i+\hat{\beta }_{i}(k+1)=\hat{\alpha }_{i}(k)\overline{b}_i+ offset ^{old}_{i}(k)-(\hat{\alpha }_{i}-1)\overline{\tau }_i(t_{old})(k)$$

We denote \(\hat{\alpha }_{i}(k+1)b_i+\hat{\beta }_{i}(k+1)\) by \(x_i(k+1)\) to obtain:

$$x_i(k+1)=\hat{\alpha }_{i}(k)\overline{b}_i+ offset ^{old}_{i}(k)-(\hat{\alpha }_{i}-1)\overline{\tau }_i(t_{old})(k)$$

Using Eqs. (15) and (16), we can substitute the values of both \(offset ^{old}_{i}\) and \(\overline{\tau }_i(t_{old})\) into the above equation to obtain:

$$\begin{aligned} x_i(k+1)&=\hat{\alpha }_{i}(k)\overline{b}_i+\sum \limits _{j\in {\mathcal {N}}_i} w_{ij} offset _{ij}(k)-(\hat{\alpha }_{i}-1)\sum \limits _{j\in {\mathcal {N}}_i} w_{ij}\tau _i(t)(k)\\&=\hat{\alpha }_{i}(k)\overline{b}_i+\sum \limits _{j\in {\mathcal {N}}_i} w_{ij}({\mathcal {C}}_j(t)-\tau _i(t)-(\hat{\alpha }_{i}-1)\tau _i(t))(k) \end{aligned}$$

According to Eq. (7), we can substitute the value of \({\mathcal {C}}_j(t)\) into the above equation to obtain:

$$\begin{aligned} x_i(k+1)&=\hat{\alpha }_{i}(k)\overline{b}_i+\sum \limits _{j\in {\mathcal {N}}_i} w_{ij}(\hat{\alpha }_{j}\tau _j(t)+\hat{\beta }_{j}-\hat{\alpha }_{i}\tau _i(t))(k)\\&=\hat{\alpha }_{i}(k)\overline{b}_i+\sum \limits _{j\in {\mathcal {N}}_i} w_{ij}(\hat{\alpha }_{j}a_jt+\hat{\alpha }_{j}b_j+\hat{\beta }_{j}-\hat{\alpha }_{i}a_it-\hat{\alpha }_{i}b_i)(k)\\&=\hat{\alpha }_{i}(k)\overline{b}_i-\hat{\alpha }_{i}(k)\sum \limits _{j\in {\mathcal {N}}_i} w_{ij}b_i+\sum \limits _{j\in {\mathcal {N}}_i} w_{ij}(\hat{\alpha }_{j}a_jt-\hat{\alpha }_{i}a_it)(k)+\sum \limits _{j\in {\mathcal {N}}_i} w_{ij}(\hat{\alpha }_{j}b_j+\hat{\beta }_{j})(k)\\&=\hat{\alpha }_{i}(k)\overline{b}_i-\hat{\alpha }_{i}(k)\overline{b}_i+\sum \limits _{j\in {\mathcal {N}}_i} w_{ij}(\hat{\alpha }_{j}a_jt-\hat{\alpha }_{i}a_it)(k)+\sum \limits _{j\in {\mathcal {N}}_i} w_{ij}x_j(k)\\&=\sum \limits _{j\in {\mathcal {N}}_i} w_{ij}x_j(k)+\sum \limits _{j\in {\mathcal {N}}_i} w_{ij}(\hat{\alpha }_{j}a_jt-\hat{\alpha }_{i}a_it)(k) \end{aligned}$$

which can be rewritten more compactly as:

$${\mathbf {x}}(k+1)={\mathcal {W}}(k){\mathbf {x}}(k)+\varvec{\phi }(k)$$

According to Theorem 1, \(\lim \nolimits _{k \rightarrow \infty }a_i\hat{\alpha }_{i}(k)=\alpha _v, \forall i\in {\mathcal {V}}\) , and thus \(\lim \nolimits _{k \rightarrow \infty }\varvec{\phi }(k)=0\). Likewise, \({\mathcal {W}}\) is row-stochastic since it is nonnegative and the sum of the entries of each row equals 1. Also, according to Assumption 1, each node \(i\in {\mathcal {V}}\) can communicate its values to every other node \(j\in {\mathcal {V}}\). As a result [28, 29], \(x_i\) will converge to a steady-state value c:

$$\lim _{k \rightarrow \infty }{\mathbf {x}}(k)={\mathbf {c}}{\mathbf {1}}$$

Consequently, as \(x_i=\hat{\alpha }_{i}b_i+\hat{\beta }_{i}\), we obtain:

$$\lim \limits _{k \rightarrow \infty } \hat{\alpha }_{i}(k)b_i+\hat{\beta }_{i}(k)=\beta _v{\mathbf {1}}$$

\(\square\)

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Aissaoua, H., Aliouat, M., Bounceur, A. et al. A Distributed Consensus-Based Clock Synchronization Protocol for Wireless Sensor Networks. Wireless Pers Commun 95, 4579–4600 (2017). https://doi.org/10.1007/s11277-017-4108-4

Download citation

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s11277-017-4108-4

Keywords

Navigation