Professional Documents
Culture Documents
The ContikiMAC Radio Duty Cycling Protocol
The ContikiMAC Radio Duty Cycling Protocol
Adam Dunkels
adam@sics.se
SICS Technical Report T2011:13
ISSN 1100-3154
December 2011
Abstract posed (see e.g. Dutta and Dunkels for a more thorough
review of duty cycling mechanisms [9]). This document
Low-power wireless devices must keep their radio describes the ContikiMAC duty cycling mechanism, the
transceivers off as much as possible to reach a low power default duty cycling mechanism in Contiki 2.5
consumption, but must wake up often enough to be able to ContikiMAC is designed to be simple to understand
receive communication from their neighbors. This report and implement. ContikiMAC uses only asynchronous
describes the ContikiMAC radio duty cycling mechanism, mechanisms, no signaling messages, and no additional
the default radio duty cycling mechanism in Contiki 2.5, packet headers. ContikiMAC packets are ordinary link
which uses a power efficient wake-up mechanism with layer messages. ContikiMAC has a significantly more
a set of timing constraints to allow device to keep their power-efficient wake-up mechanism that previous duty
transceivers off. With ContikiMAC, nodes can participate cycling mechanisms. This is achieved by precise timing
in network communication yet keep their radios turned through a set of timing constraints. In addition, Contiki-
off for roughly 99% of the time. This report describes the MAC uses a fast sleep optimization, to allow receivers to
ContikiMAC mechanism, measures the energy consump- quickly detect false-positive wake-ups, and a transmission
tion of individual ContikiMAC operations, and evaluates phase-lock optimization, to allow run-time optimization
the efficiency of the fast sleep and phase-lock optimiza- of the energy-efficiency of transmissions.
tions.
The mechanisms in ContikiMAC are inspired by ex-
isting duty cycling protocols. The idea of periodic
1 Introduction wake-ups has been used by many protocols, such as
B-MAC [21], X-MAC [1], and BoX-MAC [18]. The
Low-power wireless devices must maintain strict power phase-lock optimization has been previously suggested by
budgets to attain years of lifetime. Of all components WiseMAC [11] and has since been used by other proto-
on a low-power wireless device, the wireless transceiver cols as well [14]. The use of multiple copies of the data
often has the highest power consumption. The wireless packet as a wake-up strobe has previously been used by
transceiver consumes as much power when passively lis- the TinyOS BoX-MAC protocol [18].
tening for transmissions from other devices as it does The rest of this report is structured as follows. Sec-
when actively transmitting, so the transceiver must be tion 2 presents the ContikiMAC mechanism and its under-
completely turned off to save power. Since the device lying principles. Section 3 describes the implementation
is not able to receive any data when the transceiver is of ContikiMAC in Contiki 2.5. Section 4 evaluates the
turned off, a duty cycling mechanism must be used to energy efficiency of ContikiMAC, both with micro bench-
turn the transceiver on every now and then. Over the marks and in a data collection network. Related work is
years, numerous duty cycling mechanisms have been pro- reviewed in Section 5 and Section 6 concludes the report.
1
Send data packets until ack received t t
i a
D Data packet
Receiver Ack
Receiver D A A Acknowledgement packet
t t t t
CCA r c r d
Transmission detected CCA
Figure 1: ContikiMAC: nodes sleep most of the time and Figure 3: The ContikiMAC transmission and CCA tim-
periodically wake up to check for radio activity. If a ing.
packet transmission is detected, the receiver stays awake
to receive the next packet and sends a link layer acknowl-
edgment. To send a packet, the sender repeatedly sends
2.1 ContikiMAC Timing
the same packet until a link layer acknowledgment is re- ContikiMAC has a power-efficient wake-up mechanism
ceived. that relies on precise timing between transmissions. Con-
tikiMAC wake-ups use an inexpensive Clear Channel As-
Send data packets during entire period
sessment (CCA) mechanism that uses the Received Signal
Strentgh Indicator (RSSI) of the radio transceiver to give
Sender D D D D D D Reception window
an indication of radio activity on the channel. If the RSSI
is below a given threshold, the CCA returns positive, in-
D Data packet
dicating that the channel is clear. If the RSSI is above the
Receiver D
threshold, the CCA returns negative, indicating that the
channel is in use.
Transmission detected
The ContikiMAC timing is shown in Figure 3. The tim-
ing requirements from the figure are:
Figure 2: Broadcast transmissions are sent with repeated ti : the interval between each packet transmission.
data packets for the full wake-up interval.
tr : the time required for a stable RSSI, needed for a stable
CCA indication.
2
t
s The remaining variables, ti , tc , and ts can now be chosen.
Equation 2 gives a lower bound on ts > 0.736 millisec-
Sender Data packet
onds, which sets a limit on the smallest packet size we
can handle. With a bitrate of 250 kilobits per second, this
Receiver
means that packets must be at least 23 bytes long, includ-
ing preamble, start of frame delimiter, and length field,
t t t
CCA r c r
CCA
which leaves 16 bytes of packet data.
To ensure that all packets are larger than the smallest
packet size, packets may be padded with additional fram-
Figure 4: A packet transmission must be long enough so ing to ensure a minimum packet size. Alternatively, if the
that it does not fall between to subsequent CCAs. network layer is able to ensure that packets never go be-
low a given size, no framing is needed. For example, in
the case of an IPv6 network layer, packets with full IPv6
as shown in Figure 4. For ContikiMACs two CCAs to headers will always be longer than the smallest Contiki-
be able to detect the packet, a packet transmission cannot MAC packet size on a IEEE 802.15.4 link layer. With
be so short that it falls between the CCAs. Specifically, 6lowpan IPv6 header compression, packets may become
ts , the transmission time of the shortest packet, must be smaller, but ensuring a smallest packet size is simple: do
larger than tr + tc + tr . not compress the header of IPv6 packets that are smaller
When a CCA has detected a packet transmission, Con- than a given threshold.
tikiMAC keeps the radio on to be able to receive the full The ContikiMAC implementation in Contiki 2.5 uses
packet. When a full packet has been received, a link- the following configuration:
layer acknowledgment is transmitted. The time it takes
for an acknowledgment packet to be transmitted, ta , and • ti = 0.4 milliseconds,
the time it takes for an acknowledgment packet to be de-
tected, td , establishes the lower bound for the check inter- • tc = 0.5 milliseconds, and
val tc .
• ts = 0.884 milliseconds.
We can now construct the full ContikiMAC timing con-
straints as
2.2 Packet Detection and Fast Sleep
ta + td < ti < tc < tc + 2tr < ts . (1)
The ContikiMAC CCAs do not reliably detect packet
With an IEEE 802.15.4 link layer and a specific ra- transmissions: they only detect that the radio signal
dio transceiver, some of the variables in Equation 1 are strength is above a certain threshold. The detection of a
given as constants. First, ta , the time between a packet radio signal may either mean that a neighbor is transmit-
reception and the acknowledgment transmission, is de- ting a packet to the receiver, that a neighbor is transmitting
fined by the IEEE 802.15.4 specification as 12 symbols. to another receiver, or that some other device is radiating
In 802.15.4, one symbol is 4/250 milliseconds long, giv- radio energy that is being detected by the CCA mecha-
ing ta = 48/250 = 0.192 milliseconds. Second, an IEEE nism. ContikiMAC must be able to discern between these
802.15.4 receiver can reliably detect the reception of the events and react properly.
acknowledgment after the 4-byte long preamble and the If a neighbor is transmitting a packet to the receiver,
1-byte start of frame delimiter is transmitted, which takes the receiver should stay awake to receive the full packet
40/250 miliseconds. Thus, td = 40/250. Finally, tr is and transmit a link layer acknowledgment. Other nodes,
given by the data sheet of the CC2420 radio transceiver as which detect the packet, could quickly go to sleep again.
0.192 milliseconds. Potential receivers cannot go to sleep to quickly, however,
With the constants for substituted, Equation 1 becomes as they must be able to receive the full packet. The naive
way to determine how long to be awake when a CCA has
0.352 < ti < tc < tc + 0.384 < ts . (2) detected radio activity is to stay awake for tl + ti + tl ,
3
t Send data packets until ack received
i
Receiver
D Data packet
silence period is not detected before tl , the receiver goes D Data packet
back to sleep. If the silence period is longer than ti , the Receiver D A A Acknowledgement packet
receiver goes back to sleep. If no packet is received after
the silence period, even if radio activity is detected, the
Transmission detected
receiver goes back to sleep.
4
new wake-up after another wake-up interval without per- 20
Current (mA)
forming the wake-up. 15
The phase-lock mechanism is implemented as a sep- 10
arate module from ContikiMAC, to allow it to be used 5
by other duty cycle mechanisms, such as the Contiki X- 0
MAC [1] implementation. The phase-lock mechanism
Radio
maintains a list of neighbors and their wake-up phases. On
The ContikiMAC transmission logic records the time of Off
0 5 10 15 20 25 30 35 40
each packet transmission. When a link layer acknowledg-
Time (ms)
ment is received, it notifies the phase-lock module with
the transmission time of the last packet. This time is used
as an approximation of the wake-up phase of the receiver. Figure 7: A ContikiMAC wake-up with no signal de-
Before commencing a transmission, the ContikiMAC tected. The two CCAs are seen in the lower graph.
transmission logic calls the phase-lock module to check if
it has a recorded wake-up phase of the intended receiver.
20
If so, the phase-lock code queues the packet to be trans-
Current (mA)
15
mitted and sets a callback timer (ctimer) at the time of
the expected wake-up of the receiver. ContikiMAC will 10
On
neighbor is expected to be awake. Reducing the length of
Off
the transmission thus reduces radio congestion. 0 5 10 15 20 25 30 35 40
If a neighbor whose phase is known has rebooted, or if Time (ms)
its clock has drifted far enough away from its previous
wake-up phase, transmissions to the neighbor will fail.
To protect from this, ContikiMAC maintains a count of Figure 8: A ContikiMAC wake-up with radio activity de-
failed transmissions for each known neighbor. After a tected and where the fast sleep optimization quickly turns
fixed number of failed transmission (16 in Contiki 2.5), the radio off.
the neighbor is evicted from the list of known neighbors.
Likewise, if no link layer acknowledgment is received
Tsiftes and Dunkels [24].
within a fixed time (30 seconds in Contiki 2.5), regardless
of the number of transmissions, the neighbor is evicted.
4.1 Micro Benchmarks
4 Evaluation We measure the energy consumption of the individual
ContikiMAC operations by measuring the current draw
This report evaluates two aspects of ContikiMAC: the of a Tmote Sky mote [22] running ContikiMAC. We mea-
energy consumption of the individual ContikiMAC op- sure the current draw with an oscilloscope by measuring
erations and the power efficiency of ContikiMAC in a the voltage over an 100 Ω resistor connected in series with
data collection sensor network. In addition to the results the Tmote Sky power source. We also instrument Contiki-
presented here, we have used ContikiMAC in much re- MAC to register the state of the radio on one of the Tmote
cent work. For more ContikiMAC performance results, Sky I/O pins, with a high current indicating that the radio
the reader is referred to Dunkels et al. [3]; Duquennoy, is on and a low current indicating that the radio is off, and
Österlind, Dunkels [7]; Duquennoy et al. [8]; Kovatch, measure the state of the pin with the same oscilloscope.
Duquennoy, Dunkels [16]; Lundén and Dunkels [17]; and All measurements use ContikiMAC with a wake-up fre-
5
20 20
Current (mA)
Current (mA)
15 15
10 10
5 5
0 0
Radio
Radio
On On
Off Off
0 5 10 15 20 25 30 35 40 0 20 40 60 80 100 120 140 160
Time (ms) Time (ms)
Figure 9: Broadcast reception: wake-up, packet detected, Figure 11: Broadcast transmission.
broadcast packet received.
20
Current (mA)
20 15
Current (mA)
15 10
10 5
5 0
0 Radio
On
Radio
On Off
0 20 40 60 80 100 120 140 160
Off
0 5 10 15 20 25 30 35 40 Time (ms)
Time (ms)
6
20
Table 1: Comparison of the energy consumption of the
Current (mA)
15
wake-up operation.
10
5 Protocol Energy (uJ)
0 X-MAC [1] 132
Hui and Culler [14] 54
Radio
On
Off
ContikiMAC 12
0 20 40 60 80 100 120 140 160
Time (ms)
25
X-MAC
10
1500
First
Energyv (uJ)
5
unicast
1000
0
0 5 10 15 20 25 30
500
Channel check rate (Hz)
Unicast
Broadcast
Fast reception Subsequent
reception
sleep unicast
Wake-up
0 Figure 15: The radio duty cycle in a data collection net-
work with path loss, with X-MAC and ContikiMAC, as
a function of the wake-up frequency (in the graph called
Figure 14: The energy consumption of the individual channel check rate).
ContikiMAC operations.
7
3 6
No phase lock, no fast sleep No phase lock, no fast sleep
No phase lock, with fast sleep No phase lock, with fast sleep
2.5 With phase lock, no fast sleep 5 With phase lock, no fast sleep
With phase lock, with fast sleep With phase lock, with fast sleep
Radio duty cycle (%)
1.5 3
1 2
0.5 1
0 0
0 5 10 15 20 25 30 0 5 10 15 20 25 30
Channel check rate (Hz) Channel check rate (Hz)
Figure 16: The network radio duty cycle with Contiki- Figure 17: The network radio duty cycle with Contiki-
MAC, averaged for all nodes a the network without path MAC, averaged for all nodes in a network with path loss.
loss.
8
duce power consumption. ple the medium for a wake-up tone. If a wake-up tone is
Figure 17 shows the results in the network with path found, the radio is kept on to receive a transmission. To
loss. We see that the phase-lock and fast sleep optimiza- send a packet, the sender first transmits a wake-up tone to
tions are more efficient in the face of loss. This is because wake its neighborhood up. Later variants of this scheme
of a phase-locked transmission being shorter than non- used scheduled transmissions to avoid sending a too long
phase-locked transmissions, leading both to less energy wake-up tone [11]. The low-power listening scheme was
being spent on transmissions and to less radio congestion. moved to a packetizing radio with X-MAC [1]. In X-
MAC, the wake-up tone is composed of a series of strobe
packets. When the receiver wakes up, it sends a link-layer
5 Related Work acknowledgment to the sender to indicate that it is awake
and ready to receive the data packet. Others have sub-
The high power consumption of the radio transceiver sequently improved upon these protocols [21, 14]. Con-
is a well-known issue that has spurred much work on tikiMAC is highly similar to existing low-power listening
radio duty cycling. Radio duty cycling mechanisms protocols but has a significantly more effective wake-up
can be divided into two main categories: synchronous mechanism due to the precise timing between each data
and asynchronous. Synchronous mechanisms depend on packet transmission.
neighboring nodes being synchronized with each other Receiver-initiated protocols have a shorter history than
whereas asynchronous mechanisms do not depend on any sender-initiated protocols. Low-Power Probing (LPP) is
a priori synchronization. Asynchronous mechanisms can perhaps the first example of a receiver-initiated protocol
further be subdivided into sender-initiated and receiver- for low-power wireless [19]. In LPP, when a node in-
initiated mechanisms. In sender-initiated mechanisms, tends to send a packet, it turns on its radio to listen for
the sender initiates communication between a sender probes from potential receivers. When the sender hears
and a receiver, whereas in receiver-initiated mechanisms, a probe from the intended receiver of the packet, it trans-
the receiver initiates communication. ContikiMAC is a mits its packet. RI-MAC [23] is a similar but more ef-
sender-initiated asynchronous mechanism. The literature fective mechanism of the same type. A-MAC [10] makes
provides many examples of mechanisms from these cat- the wake-up signal more efficient, making both idle power
egories as well as hybrid mechanisms that combine fea- consumption lower and transmissions more effective
tures from more than one of the categories.
Examples of synchronous protocols as the early work
on S-MAC [26] and T-MAC [25] as well as the more re- 6 Conclusions
cent TSMP [20]. In S-MAC and T-MAC, nodes period-
ically wake up in a scheduled manner such that commu- This report presents the ContikiMAC radio duty cycling
nication can take place when adjacent nodes are awake. mechanism for low-power wireless networks, the default
The wake-up schedules are arranged to avoid overlapping radio duty cycling mechanism in Contiki 2.5. Contiki-
and medium contention. In TSMP, time is divided into 10 MAC is designed to be simple to understand and imple-
ms long slots. Nodes are given a schedule of when to be ment, uses only asynchronous and implicit synchroniza-
awake. Nodes wake up briefly at the start of each slot to tion, and requires no signaling messages or additional
listen for any activity on the radio medium. If activity is headers. ContikiMAC uses a simple but elaborate tim-
detected, the radio is kept on longer to be able to receive ing scheme to allow its wake-up mechanism to be highly
incoming packets. power efficient, a phase-lock mechanism to make trans-
Asynchronous protocols have the advantage of not re- missions efficient, and a fast sleep optimization to allow
quiring synchronization and the research community has receivers to quickly go to sleep when faced with spu-
explored many different variants of asynchronous proto- rious radio interference. Measurements show that the
cols. Early work on sensor network architectures found wake-up mechanism is significantly lower than for ex-
a simple asynchronous mechanism called low-power lis- isting duty cycling mechanisms and that the phase-lock
tening [13] in which nodes periodically wake up to sam- and fast sleep mechanisms reduce the network power con-
9
sumption between 10% and 80%, depending on the wake- [6] A. Dunkels, O. Schmidt, T. Voigt, and M. Ali. Pro-
up frequency of the devices in the network. tothreads: Simplifying event-driven programming
of memory-constrained embedded systems. In Pro-
ceedings of the International Conference on Em-
Acknowledgments bedded Networked Sensor Systems (ACM SenSys),
Boulder, Colorado, USA, November 2006.
The author wishes to thank (in alphabetical order) Mari-
ano Alvira, Simon Duquennoy, Joakim Eriksson, Niclas [7] S. Duquennoy, F. Österlind, and A. Dunkels. Lossy
Finne, Marcus Lundén, David Kopf, Fredrik Österlind, Links, Low Power, High Throughput. In Proceed-
and Nicolas Tsiftes, for inspiration, help, and expertise. ings of the International Conference on Embedded
This work was funded by the SSF as part of the Promos Networked Sensor Systems (ACM SenSys), Seattle,
project and the EU Commission as part of the NOBEL WA, USA, November 2011.
and Calipso projects. [8] S. Duquennoy, N. Wirström, N. Tsiftes, and
A. Dunkels. Leveraging IP for Sensor Network
Deployment. In Proceedings of the workshop on
References Extending the Internet to Low power and Lossy
Networks (IP+SN 2011), Chicago, IL, USA, April
[1] M. Buettner, G. V. Yee, E. Anderson, and R. Han. 2011.
X-MAC: a short preamble MAC protocol for duty-
cycled wireless sensor networks. In Proceedings [9] P. Dutta and A. Dunkels. Operating systems and
of the International Conference on Embedded Net- network protocols for wireless sensor networks.
worked Sensor Systems (ACM SenSys), Boulder, Philosophical Transactions of the Royal Society A,
Colorado, USA, 2006. 370(1958):68–84, January 2012.
[2] A. Dunkels, J. Eriksson, N. Finne, and N. Tsiftes. [10] Prabal Dutta, Stephen Dawson-Haggerty, Yin Chen,
Powertrace: Network-level power profiling for Chieh-Jan Mike Liang, and Andreas Terzis. Design
low-power wireless networks. Technical Report and Evaluation of a Versatile and Efficient Receiver-
T2011:05, Swedish Institute of Computer Science, Initiated Link Layer for Low-Power Wireless. In
March 2011. Proceedings of the International Conference on Em-
bedded Networked Sensor Systems (ACM SenSys),
[3] A. Dunkels, L. Mottola, N. Tsiftes, F. Österlind, Zurich, Switzerland, November 2010.
J. Eriksson, and N. Finne. The announcement layer:
[11] A. El-Hoiydi, J.-D. Decotignie, C. C. Enz, and E. Le
Beacon coordination for the sensornet stack. In Pro-
Roux. wiseMAC, an ultra low power MAC proto-
ceedings of the European Conference on Wireless
col for the wiseNET wireless sensor network. In
Sensor Networks (EWSN), 2011.
Proceedings of the International Conference on Em-
[4] A. Dunkels, F. Österlind, and Z. He. An adaptive bedded Networked Sensor Systems (ACM SenSys),
communication architecture for wireless sensor net- 2003.
works. In Proceedings of the International Con- [12] O. Gnawali, R. Fonseca, K. Jamieson, D. Moss, and
ference on Embedded Networked Sensor Systems P. Levis. Collection tree protocol. In Proceed-
(ACM SenSys), Sydney, Australia, November 2007. ings of the International Conference on Embedded
Networked Sensor Systems (ACM SenSys), Berkeley,
[5] A. Dunkels, F. Österlind, N. Tsiftes, and Z. He.
CA, USA, 2009.
Software-based on-line energy estimation for sensor
nodes. In Proceedings of the IEEE Workshop on Em- [13] J. Hill and D. Culler. Mica: A wireless platform for
bedded Networked Sensor Systems (IEEE Emnets), deeply embedded networks. IEEE Micro, 22(6):12–
Cork, Ireland, June 2007. 24, 2002.
10
[14] J. Hui and D. Culler. IP is Dead, Long Live IP for [22] J. Polastre, R. Szewczyk, and D. Culler. Telos: En-
Wireless Sensor Networks. In Proceedings of the abling ultra-low power wireless research. In Pro-
International Conference on Embedded Networked ceedings of the International Conference on Infor-
Sensor Systems (ACM SenSys), Raleigh, North Car- mation Processing in Sensor Networks (ACM/IEEE
olina, USA, November 2008. IPSN), Los Angeles, CA, USA, April 2005.
[15] J. Ko, J. Eriksson, N. Tsiftes, S. Dawson-Haggerty, [23] Y. Sun, O. Gurewitz, and D. Johnson. RI-MAC: A
M. Durvy, J. Vasseur, A. Terzis, A. Dunkels, and Receiver-Initiated Asynchronous Duty Cycle MAC
D. Culler. Beyond Interoperability: Pushing the Per- Protocol for Dynamic Traffic Loads in Wireless Sen-
formance of Sensornet IP Stacks. In Proceedings sor Networks. In Proceedings of the International
of the International Conference on Embedded Net- Conference on Embedded Networked Sensor Sys-
worked Sensor Systems (ACM SenSys), Seattle, WA, tems (ACM SenSys), Raleigh, NC, USA, 2008.
USA, November 2011.
[24] N. Tsiftes and A. Dunkels. A database in every sen-
[16] M. Kovatsch, S. Duquennoy, and A. Dunkels. A sor. In Proceedings of the International Conference
Low-Power CoAP for Contiki. In Proceedings of on Embedded Networked Sensor Systems (ACM Sen-
the Workshop on Internet of Things Technology and Sys), Seattle, WA, USA, November 2011.
Architectures (IEEE IoTech 2011), Valencia, Spain,
[25] T. van Dam and K. Langendoen. An adaptive
October 2011.
energy-efficient MAC protocol for wireless sen-
[17] M. Lundén and A. Dunkels. The Politecast sor networks. In Proceedings of the International
Communication Primitive for Low-power Wireless. Conference on Embedded Networked Sensor Sys-
ACM SIGCOMM Computer Communication Re- tems (ACM SenSys), Los Angeles, California, USA,
view, 41:31–37, April 2011. November 2003.
[18] D. Moss and P. Levis. BoX-MACs: Exploiting [26] W. Ye, J. Heidemann, and D. Estrin. An Energy-
Physical and Link Layer Boundaries in Low-Power Efficient MAC Protocol for Wireless Sensor Net-
Networking. Technical Report SING-08-00, Stan- works. In Proceedings of the IEEE Conference
ford University, 2008. on Computer Communications (INFOCOM), New
York, NY, USA, June 2002.
[19] R. Musaloiu-E., C-J. M. Liang, and A. Terzis.
Koala: Ultra-Low Power Data Retrieval in Wire-
less Sensor Networks. In Proceedings of the Inter-
national Conference on Information Processing in
Sensor Networks (ACM/IEEE IPSN), St. Louis, Mis-
souri, USA, 2008.
11