Vous êtes sur la page 1sur 6

ISPCS 2008 – International IEEE Symposium on Precision Clock

Synchronization for Measurement, Control and Communication


Ann Arbor, Michigan, September 22–26, 2008

Non invasive Time Synchronization for ZigBee Wireless Sensor Networks


P. Ferrari1, A. Flammini1, D. Marioli1, E. Sisinni1, A. Taroni2
1
University of Brescia – DEA – Brescia – Via Branze,38 – 25123 – Italy
2
Carlo Cattaneo University, Castellanza (VA) – C.so Matteotti,22 – 21053 – Italy
Email: emiliano.sisinni@ing.unibs.it, Tel.+390303715445 Fax. +39030380014

Abstract –A precise time synchronization is essential in many due to the specific requirements of those networks in terms of
Wireless Sensor Networking applications, e.g. in order to correlate precision (that must be high) and cost (nodes have typically
observations of the same event from different sites or to efficiently limited power, computational and storage resources). In fact,
share the wireless channel. Generally, wireless sensors are designed most of the protocols designed for wired environments
having in mind low cost and low power. In the past, several
exchange several huge messages and also need to store them
protocols have been suggested, each one with its pros and cons,
aiming at the maximization of the accuracy vs. consumption ratio.
(for statistical processing). For this reason, solutions like the
However, their performance have been generally tested on IEEE1588v2 or even the IEEE802.1AS [6], that has been also
particular hardware setup and with proprietary communication proposed for wireless audio video broadcasting, must be
protocols. In this paper we present a non invasive implementation of discarded. On the other hand, their basic principle (i.e.
a synchronization protocol over a full ZigBee-compliant platform. pairwise message exchanges within a hierarchical
Experimental evaluation on real prototypes has been performed in master/slave structure) and the concept of transparent clock
order to ensure feasibility and verify performances. Our approach can be borrowed and usefully adopted in multi hop WSNs.
preserves compatibility with this emerging standard still offering Recently, a significant amount of research on time
synchronization error on the order of few μs if synchronization
synchronization for wireless sensor has been published [7,8].
procedure is executed every 4 s.
Taking advantage from the well-known TPSN (Timing-sync
Protocol for Sensor Networks) protocol [9], we propose a non
Keywords – Wireless Sensor Neworking, Time synchronization,
Distributed system invasive modification that preserves all the features of
standard ZB stack and allows to reach time synchronization
I. INTRODUCTION on the order of few μs without decreasing power efficiency.
The rest of this paper is structured as follows. In Section II
we present an overview of ZB architecture and the time
ZigBee (ZB) [1] is an emerging standard for Wireless
synchronization from the ZB point of view. After describing
Sensor Networks (WSNs). It targets low distance, low data
our implementation in Section III, we present some
rate, low power consumption and low cost applications;
experimental results in Section IV. Finally, in section V some
according to standard nomenclature, it implements a Low
concluding remarks are reported.
Rate–Wireless Personal Area Network (LR-WPAN).
However, there is a lot of confusion around what the term ZB
really describes and its name has been often misused (for
instance in [2] the term is misused, since it only refers to an II. ZIGBEE AND TIME SYNCHRONIZATION
IEEE802.15.4-compliant hardware platform). ZB defines
upper layers (network and application) of the ISO protocol Key feature of ZB is the capability of handling both single
reference model. On the contrary, in regards to the physical (star topology) and multi hop (cluster tree and mesh
and data link ones, it relies over another standard, the well topologies) networks. The cluster-tree is a hierarchical
accepted IEEE802.15.4 [3], which offers a gross transfer rate topology, probably the most interesting solution of this
of 250 kbps in the 2.4 GHz ISM unlicensed band. Although standard. In this case the network consists of clusters, each
ZB is designed for event-based applications, it can take having a “router” as a cluster head and multiple devices as
advantage from sensors clock synchronization, in order to leaf nodes. A “PAN coordinator” initiates the network and
give an unique time reference to all measurements and serves as the root. The network is formed by parent-child
events. However, synchronization procedure should be relationships, where new nodes associate as children with the
simple, in order to not waste power, and it should preserve existing coordinators. This well-defined structure simplifies
compatibility with the available ZB stacks, including the so- multi-hop routing and allows energy saving; each node
called ZB-processors [4]. maintains synchronization of data exchanges with its parent
In the past several protocols have been proposed and used coordinator only. As a matter of fact, two different kinds of
for time synchronization in wired and wireless networks. devices can participate in ZB-WSNs: Full Function Devices
Mill’s Network Time Protocol (NTP) [5] has been widely (FFDs) and Reduced Function Devices (RFDs). They
used in the Internet for decades. However, traditional differentiate on the basis of capabilities and, thus, on the
synchronization schemes are not suitable for use in WSNs resources needed to operate. An RFD does not have routing

978-1-4244-2275-3/08/$25.00 ©2008 IEEE

Authorized licensed use limited to: UNIVERSITY OF DELAWARE LIBRARY. Downloaded on January 20, 2009 at 19:40 from IEEE Xplore. Restrictions apply.
capabilities and can act as end node only. It can only communicate. A node that wants to join the network must
communicate with its parent, i.e. the node that allowed it to choose the time collocation of the active portion of its
join the network. On the contrary, an FFD has routing superframe structure with any suitable algorithm able to
capabilities and can be configured as the WSN coordinator. avoid overlapping. Nevertheless, the standard do not
According to this distinction, ZB implements three types of specifically address this aspect. If there are no free non-
logical devices: coordinator (must be an FFD), router (must overlapping time slots, the device shall not transmit Beacons
be an FFD) and end device (may be an FFD or an RFD). and shall operate on the network as an end device (i.e. it
In order to reduce latency and packet losses, the current cannot route packets).
ZB standard requires FFDs to be always on, which in practice
means that if they are battery-powered their lifetime is on the
order of a few days. On the contrary, RFD are optimized for III. THE PROPOSED APPROACH
low power consumption and are allowed to enter in the deep
sleep modality offered by the hardware, as better explained in Authors’ basic idea is to completely avoid the use of
the superframe description that follows. It is evident that Beacons still ensuring that all nodes share the same sense of
mesh topology allows only FFDs and it is not a power time in order to improve power efficiency; also the traditional
efficient solution “listen-before-talk” strategy of the CSMA/CA protocol
As we previously said, ZB has been optimized for single should be preserved. In particular, we want to permit node
sporadic event notification, as suggested by the adoption of synchronization without using a complex and rigid structure
CSMA/CA (Carrier Sense Multiple Access with Collision as the superframe time organization. This approach lowers
Avoidance) as medium access protocol. the node protocol complexity since no particular scheduling
In regard to time synchronization, it is based on the algorithm must be employed and it is not needed to acquire
exchange of particular packets, called Beacon, that FFDs may information about neighbors. It must be also remembered that
emit on a regular basis. However, only star and tree networks beacons are handled at the MAC level of the protocol and we
may use beacon-oriented communications, but many do not want to operate at intermediate levels of the stack to be
commercially available stacks do not fully support this implementation independent. As better explained in the
feature. In addition, Beacons do not use CSMA/CA and a lot following, we only access the application layer of the
of burden must be done in order to avoid collisions between protocol stack (no matter who made it) and exploit a minimal
them or with data frames. As previously stated, each cluster is software integration to furnish low level timestamping, when
managed by one coordinator (i.e. Zigbee Router - FFD), this feature in not already provided.
which generates periodic Beacon frames to synchronize its
child nodes (belonging to its cluster). Since many nodes of A. The TPSN protocol
different clusters may occupy the same operating space, their
transmissions must be accurately scheduled to not overlap. What we suggest is a modified implementation of the
Obviously, there is a tradeoff with respect to the network well-known TPSN [9] protocol in order to be fully
scalability, since this approach obliges each node to collect compatible with ZB without increasing consumption. TPSN
information about all its neighbors and their parents. This in is a traditional sender-receiver based synchronization
turn means that each node must compile such a database, protocol that uses a tree to organize the clock hierarchy. In
greatly affecting memory resource requirements. the original proposal, there is a level discovery phase and an
The ZB standard suggests to divide the time into different actual synchronization phase. The first step of the algorithm
non overlapping timeslots each one corresponding to the is to create a hierarchical topology in the network. Every
superframe active portion of that node (see Fig.1). node is assigned a level in this hierarchical structure. The
basic hypothesis underlying this phase is that a node
WPAN
Superframe
belonging to level k+1 can communicate with at least one
Coordinator Active portion of the
(FFD) (Level k) superframe
node belonging to level k. Only one node is assigned to level
Cluster Head “0”, which it is called the “root node”.
(FFD) The level discovery phase is initiated by the root sending a
Level k
level discovery packet which contains the identity and the
End Device Coordinator Superframe Cluster Head level of the sender. The immediate neighbors (i.e. MAC
(RFD) Beacon (Level k+1) Beacon neighbors) of the root node receive this packet and assign
Level k+1
themselves a level “1”. After establishing their own level,
Fig. 1. Beacon scheduling under ZB. they broadcast a new level discovery packet. This process is
continued and eventually every node in the network is
In fact, the activity of a beacon-enabled node is organized assigned a level. After a node obtains his level, it discards
into regular repetitive patterns (superframes) that initiate with any such future packets. This makes sure that no flooding
the Beacon transmission. The time between two successive congestion takes place in this phase.
Beacons is divided into an active and a sleep portion of Once the hierarchical structure has been established, the
variable lengths. In the latter, nodes are not allowed to root node initiates the second stage of the algorithm, the so

Authorized licensed use limited to: UNIVERSITY OF DELAWARE LIBRARY. Downloaded on January 20, 2009 at 19:40 from IEEE Xplore. Restrictions apply.
called synchronization phase. In this phase, a node belonging With regard to peer-to-peer (e.g. router toward router) data
to level k+1 synchronizes to a node belonging to level k. transfer, the devices wishing to communicate must be
Eventually every node is synchronized to the root node and receiving constantly or must be synchronized (for instance
we achieve network-wide time synchronization. The main using Beacon) and can use direct transmission.
improvement suggested by the original TPSN protocol is the The timestamping feature is one of the most critical aspect
adoption of a MAC level timestamping, that allows to in synchronization methods. If we work at the highest level,
precisely mark the begin of a transmission and its reception. as an application tool, we preserve a full compatibility with
In our implementation the first phase is superfluous, since the selected stack, but the results are poor in terms of jitter.
the root is always the coordinator and hierarchical clock Otherwise, if we work at the lower levels in order to achieve
structure coincides with the cluster tree-topology [10]. the best performance, we often are too invasive.
Synchronization among nodes of level k (closer to the root) In our implementation we worked at the lowest and
and level k+1 is achieved by means of a pair wise packets highest levels of the stack, thus being completely non
exchange, called “Synchronization Pulse” and invasive with respect to the stack (see Fig.4).
“Acknowledgement” packet, respectively, as shown in Fig.2.
Synchro
WPAN Level k+2 Level k+1 Level k End Point ZDO

ZIGBEE
Coordinator
(FFD) T1,k+1
Synchronization
T2,k
APS
Cluster Head Pulse
(FFD) T3,k

Security
Level k Acknowledgement NWK
T4,k+1 Synchronization
Cluster Head
“retrofitting”

IEEE802.15.4
(FFD)
T1,k+2
MAC
Level k+1 T2,k+1
End Device
T3,k+1
(RFD) PHY
Level k+2 T4,k+2
Timestamping
Time
Fig. 2. Two-way message exchanges between nodes of different Transceiver
hierarchical levels.
Fig. 4.The proposed “retro fitted” ZigBee protocol stack (ZDO: Zigbee
Device Object, APS: Application Support, NWK: Network, MAC: Medium
B. Implementation within the ZigBee protocol Access Control, PHY: Physical).

Referring to ZB, in non Beacon-enabled networks, In fact, we added an accurate timestamping block at the
communications are always initiated by the end device (see physical level while offset and drift compensation of the local
Fig.3). When an RFD wakes up from its deep sleep, it first clock are performed at the application level. The former
sends a “Data Request” command to check for data pending statement is not a strong requirement, especially at the
at its parent (coordinator or router). receiving stage, since every transceiver compliant with the
IEEE802.15.4-2003 standard offers such a feature. In fact,
FFD - Level k+1 RFD - Level k+2 timestamping is used to track Beacons with a time resolution
of “one symbol” (i.e. 16 μs when operating at 2.4 GHz).
(T2,k) Data Request (T1,k+1) However, no information is provided on how it must be
ACK obtained or which point of the frame must be used as a
reference. In addition, it must be noticed that the latest public
(T3,k) DATA (T4,k+1) available version of the ZB specifications [1] is only based on
ACK the IEEE802.15.4-2003 [3] and not on the more recent
IEEE802.15.4-2006 [11]. In particular, according to what
stated in [11], also transmitted or received data frames can be
Fig. 3. Indirect transmission in nonbeacon-enabled ZigBee network.
optionally timestamped at the MAC level with a resolution of
After the reception of this packet, the parent must always one symbol and a minimum precision (according to the
reply sending its data. In our implementation, we used this standard nomenclature) of 16 symbols. For this reason, within
couple of packets (“Data Request” and “Data”) to retrieve the ZB standard timestamping is optionally performed at the
clocks offset and drift. Referring to Fig.3, “Data” packet network level and disabled by default.
contains both information (T2,k) and (T3,k), while both
information (T1,k+1) and (T4,k+1) are known by the end C. Practical realization
device, as better explained in the following. In addition, the
acknowledge frames defined in the standard allow for The transceiver we used in this work is the MC13192 from
increased protocol robustness (ACK, different from the Freescale, which has an input-capture feature fired by the
Acknowledgement packet of the synchronization protocol). reception of the Frame Length Identifier –FLI– of the

Authorized licensed use limited to: UNIVERSITY OF DELAWARE LIBRARY. Downloaded on January 20, 2009 at 19:40 from IEEE Xplore. Restrictions apply.
incoming packet (see Fig.5). As another example, the
CC2420 from TI offers a digital line which is raised when the ΔμC, i = ((T4 i – T3 i) + (T2 i – T1 i))/2 (3)
Start Frame Delimiter –SFD– is decoded. As stated in the OμC, i = T4 i – T3 i – ΔμC, i (4)
previous section, the standard do not indicate the reference
point and only in [11] has been added the attribute With regard to the delay, it can be estimated sporadically
“macSyncSymbolOffset”, i.e. the offset, measured in symbols, since it can be considered almost constant (i.e. ΔμC,i= ΔμC).
between the symbol boundary at which the MAC layer The aim of every synchronization algorithm is to minimize
captures the timestamp of each transmitted or received frame, the offset among all clocks and some forms of drift
and the onset of the first symbol past the SFD. compensation must be employed. The average drift among R
successive synchronization pulses can be estimated as
160μs 32μs (usually 4 ≤ R ≤ 64):
4 bytes 1 byte 1 byte Max 125 bytes 2 bytes

1 R (O μC,i − O μC,i −1 )
PREAMBLE SFD FLI PAYLOAD DATA FCS
ρ= ∑
R i=1 (T3i − T3i−1 )
(5).

Timestamp transceiver MC1319x


The adjustment of the slave clock is performed according
Fig. 5. IEEE802.15.4 physical layer packet (inbound timestamping). to the following algorithm, derived from [12]:
Step 1: the “Acknowledgement” arrival timestamp in the
The synchronization phase needs also an accurate slave clock time reference in the cycle i T3i is obtained by
timestamping of the transmission start. We studied two means of the equation:
different approaches with our prototypes; the first one is
based on the “streaming” mode of data transmission towards
T4 i = T4*i−1 +
(T3i − T3i−1 ) (6)
the radio chip. We are able to intercept the interrupt request 1+ ρ
associated with the transmission of the first two bytes of the
outgoing stream and subsequently read the transceiver timer where the corrected timestamp T4*i-1 of the previous cycle is
(the same used in the reception phase). On the coordinator available after Step 3.
side only, we also encapsulate this value within the outgoing Step 2: the residual offset from the master is evaluated
data packet. Again, this is not a strong restriction, and a considering also the transmission delay:
similar approach has been already used for instance in [2]
with the previously cited CC2420. The second possibility is O μC,i = T4 i − T3i − Δ μC (7).
available when the MC13192 is used, and takes advantage of
the “time triggered” feature of this device. It is possible to
postpone packet transmission later in time exploiting a sort of Offset is verified against the average value of the last 4
output-compare behavior of the transceiver timer; this further offsets; a simple non-linear filter suppresses any out-of-range
improve timestamp accuracy. It should be highlighted that value.
timestamping is related to the transceiver oscillator, that is Step 3: now the corrected timestamp can be calculated:
normally a high quality one. Thanks to isochronous reading
of other oscillators, timestamps can be related to different T4 *i = T4 i − O μC,i (8)
oscillators. In addition, as the synchronization parent is
always on, the end-device can take advantage from the In order to update the slave clock time reference we
knowledge of (T2,k) of consecutive synchronizing “Data simply force T4i = T4*i, introducing a step variation to slave
Request” actions. clock. However, amortization algorithms can be employed to
Concerning offset and drift compensation, we perform a eliminate such step variations (e.g. introducing a linear
simple calculation at the application level. The one-way delay amortization). The previous algorithm is executed every
ΔμC and the offset between parent and child node clocks OμC synchronization cycles. Between them, the timestamp (in the
can be computed according to well known equations [9,12]. slave clock time reference) of a generic event T*gen,S can be
In particular, if we suppose a symmetrical channel and calculated with the following equation:
consider the single hop portion of the network near the root
(i.e. k=0), equations are:
* *
(T gen,S − T4 i )
(9)
Tgen,S = T4 i +
T2i = T1 i – OμC,i + ΔμC,i (1) 1+ ρ
T4 i = T3 i + OμC,i + ΔμC,i (2)
where T4*i and T4i are referred to the last synchronization
where the nomenclature is as in Fig.2 and i is the cycle cycle and Tgen,S is the value of the slave clock at the
number; remember that both timers have the same resolution. considered event.
They can be rearranged as in:

Authorized licensed use limited to: UNIVERSITY OF DELAWARE LIBRARY. Downloaded on January 20, 2009 at 19:40 from IEEE Xplore. Restrictions apply.
IV. EXPERIMENTAL RESULTS of messages. On the contrary, for incoming messages it has
been supposed that latency is ΔIN=32μs, since the hardware
Preliminary tests have been conducted with two nodes timestamping occurs after the reception of the FLI (see
implementing the BeeKit [13] stack from Freescale. One of Fig.5).
them was configured as the PAN coordinator, the other as an In order to verify algorithm implementation, the node
end device. As previously stated, all timestamps were based itself has been used to compute the one-way delay ΔμC. It has
on the timer of the radio device, clocked at 62.5kHz. This been obtained ΔμC=21 clock ticks, i.e.
choice is dictated by low power considerations and, (ΔμC)·TCK≤ΔOUT+ΔIN<(ΔμC+1)·TCK where TCK=16μs is the
obviously, it doesn’t offer a very high resolution. (Currently, clock tick duration. In other words, 336μs≤ΔOUT+ΔIN<352μs,
attempts to use the smallest available time grain of 0.5μs are in accordance with theoretical estimation. It has been also
being carried on). estimated the channel asymmetry, that is on the order of
A passive sniffer showing the packet duration in air has 0.2μs and thus can be neglected. Attention must be paid if we
been implemented using the CC2420 transceiver (a digital want to synchronize nodes compliant with ZB using different
line shows the actual message timestamp point, i.e. the SFD). solutions, since they can use different timestamping reference
It has been used to estimate the so called outbound and point as previously said.
inbound latency, with the first one being the propagation time Some additional measurements have been performed using
between the clock timestamp point and the communication a three-nodes WSN, made up of a coordinator and two single
medium for outbound messages and the second one the hop childes. The two nodes start together with completely
propagation time between the communication medium and unsynchronized clocks and are deployed in an environment
the clock timestamp point for inbound messages. with an almost constant temperature. The absolute
In regards to outgoing messages, a digital line (PTA5_ZC synchronization error has been estimated comparing the
for coordinator and PTA5_ZED for end device in Fig.6 and offset error as computed in Eq.(7). If a sync period of
Fig.7) toggles when timestamping occurs and the delay is TSYNC=4 s is used, the maximum deviation between the two
measured with respect to the sniffer signal (SFD in Fig.6 and nodes is on the order of 32 μs, as expected being the timer
Fig.7). resolution equal to 16 μs. In Fig.8 it has been reported the
offset distribution over 256 consecutive synchronization
periods for both the nodes.

250
Max synchronization error

200
Node A

Node B
Frequency

ΔOUT Acknowledge (IEEE802.15.4) 150

Synchronization Pulse
100

Fig. 6. “Synchronization Pulse” message properties.


50

0
-30 -25 -20 -15 -10 -5 0 5 10 15 20 25 30
Offset [µs]

Fig. 8. Synchronization error of two nodes (A and B) with a


synchronization period of TSYNC=4s.

V. CONCLUSION
ΔOUT Acknowledge (IEEE802.15.4)
In this paper a non-invasive approach for synchronization
Acknowledge
of ZB wireless networks has been proposed. The
implemented algorithm exploits pairwise synchronization and
can be used as the basic building block to synchronize an
Fig. 7. “Acknowledge” message properties. entire multi hop network. The main advantage of the
proposed approach is that it can be easily “retrofitted” on
An Agilent logic state analyzer HP1690A has been used every ZB compliant platform without increasing cost or
obtaining that this delay lasts about ΔOUT=306μs for both kind complexity. It works at the application level except for a

Authorized licensed use limited to: UNIVERSITY OF DELAWARE LIBRARY. Downloaded on January 20, 2009 at 19:40 from IEEE Xplore. Restrictions apply.
small plugin that allows for MAC level timestamping. If a
sync interval of 4 s with a timer resolution of 16 μs is used
the maximum offset error between two nodes has been
experimentally evaluated to be on the order of 32 μs.

REFERENCES

[1] ZigBee Specification, ZigBee Document 053474r17, January 17, 2008,


ZigBee Alliance.
[2] D. Cox, E. Jovanov, A. Milenkovic, “Time synchronization for ZigBee
networks”, in Proc of SSST05, March 2005, pp. 135 – 138.
[3] IEEE Std. 802.15.4-2003, Wireless Medium Access Control (MAC) and
Physical Layer (PHY) Specifications for LR-WPANs. IEEE Press. 2003
[4] STMicroelectronics SN260 (http://www.st.com/ stonline/ products/
literature/ds/12972/sn260.htm), Texas Instruments CC2480
(http://focus.ti.com/ docs/ prod/ folders/print/cc2480a1.html).
[5] D. L. Mills, “Internet time synchronization: the network time protocol,”
IEEE Trans. On Communications, vol. 39, no. 10, pp. 1482–1493, Oct.
1991.
[6] G.M. Garner, F. Feng, K. den Hollander, J. Hongkyu, K. Byungsuk, L.
Byoung-Joon, J. Tae-Chul, J.J. Joung, “IEEE 802.1 AVB and its
Application in Carrier-Grade Ethernet”, IEEE Communications
Magazine, vol.45, n.12, pp.126-134.
[7] F. Sivrikaya, B. Yener, “Time synchronization in sensor networks: A
survey” IEEE Network, vol. 18, pp. 45–50, July 2004.
[8] B. Sundararaman, U. Buy, A. D. Kshemkalyani, “Clock synchronization
in wireless sensor networks: A survey,” Ad-Hoc Networks, vol. 3, pp.
281–323, May 2005.
[9] S. Ganeriwal, R. Kumar, M.B. Srivastava, “Timing-sync protocol for
sensor networks”, in Proc. of SenSys03, Nov. 2003, pp. 138-149.
[10] P.Yadav, N. Yadav, S. Varma, “Cluster based hierarchical wireless
sensor networks (CHWSN) and time synchronization in CHWSN”, Proc.
Of ISCIT '07, Oct. 2007, pp. 1149-1154.
[11] IEEE Std. 802.15.4-2006, Wireless Medium Access Control (MAC) and
Physical Layer (PHY) Specifications for LR-WPANs. IEEE Press. 2006
[12]P. Ferrari, A. Flammini, D. Marioli, A. Taroni, "IEEE 1588-based
Synchronization System for a Displacement Sensor Network", IEEE
Trans. Instrum. Meas., February, 2008, Vol. IM-57, N. 2, pp. 254-260.
[13] Online: http://www.freescale.com/

Authorized licensed use limited to: UNIVERSITY OF DELAWARE LIBRARY. Downloaded on January 20, 2009 at 19:40 from IEEE Xplore. Restrictions apply.

Vous aimerez peut-être aussi