Elektrotehniški vestnik 75(1): 50-55, 2008 Electrotechnical Review, Ljubljana, Slovenija MAC protocols for wireless sensor networks Uroš Pešovic1, Aleksandar Peulic1, Žarko Cucej2 1 University of Kragujevac, Technical Faculty Cacak, 2 University of Maribor, Faculty of Electrical Engineering and Computer Science Abstract. The paper presents a brief survey of the Medium Access Control (MAC) protocols for Wireless Sensor Networks (WSN). It describes pros and cons of some known solutions of the MAC protocols with emphasis on his energy efficiency. The main goal in WSN is prolonging the lifetime of the sensor node, that is usually battery powered and can thus be achieved by designing energy-efficient MAC protocols. Results obtained from simulations of the MAC protocols are also presented and commented on. Key words: Protocols, Medium Access Control, Wireless Sensor Network Protokoli dostopa do medija pri radijskih omrežjih senzorjev Razširjeni povzetek. Članek vsebuje pregled protokolov dostopa do prenosnega medija pri radijskih omrežjih senzorjev. Opisane so prednosti in slabosti nekaterih znanih rešitev s poudarkom na njihovi energijski učinkovitosti, saj je od nje -zaradi baterijskega napajanja - odvisna življenjska doba senzorjev. Znani podatki teh protokolov so preverjeni s simulacijami delovanja radijskih omrežij senzorjev. V drugem poglavju je seznam glavnih vzrokov zapravljanje energije pri radijski komunikacijah senzorjev in zahteve, ki so postavljene pred protokole za dostop do radijskih omrežij. V tretjem poglavju so opisani koncepti protokolov z razporejanjem prometa. Njihova glavna prednost je odsotnost kolizij, slabosti pa so zahtevna sinhronizacija, dodelitev prenosnega kanala cetudi ni prenosa podatkov in nezmožnost direktnega komuniciranja med senzorji. Izmed njih sta posebej omenjena protokola LEAČH in zelo razširjeni Bluetooth. Drugo skupino tvorijo tako imenovani dogodkovni protokoli. Opisani so v cetrtem poglavju. Pri njih se prenosni medij dodeli le senzorju, ki mora poslati podatke. Omogocajo veliko fleksibilnost v organizaciji omrežja, skalabilnost in direktno komunikacijami med senzorji. Njihov glavni problem so izgube energije pri poslušanju nezasedenega prenosnega medija in trki paketov. Izmed teh protokolov je ocenjen protokol ČSMA/ČA, pri katerem je tudi opisan problem skritega in izpostavljenega komunikacijskega vozlišca. V petem poglavju so opisani protokoli prilagojeni radijskim omrežjem senzorjev. Podana je analiza delovanja in lastnosti protokolov SMAČ, TMAČ in WiseMAC. Članek zakljucuje pregled simulacijskih rezultatov. Oceno rezultatov dopolnjujejo diagrami energijske ucinkovitosti protokolov ČSMA/ČA, SMAČ, TMAČ in WiseMAČ. Ključne besede protokoli, dostop do prenosnega medija, radijska omrežja senzorjev 1 Introduction Wireless Sensor Networks (WSN) consist of a large number of battery-powered sensors capable of communicating wireless. They are distributed within an area of interest in Received 11 June 2007 Accepted 21 October 2007 order to track, measure and monitors various events. They are often deployed in an ad-hoc fashion, without careful planning. They must be organized so as to transmit measured data to the fusion center, which is usually done using multihop communication. Protocols for these networks need to be extremely adaptable and scalable because of constant changes in network topology (caused by node movement and nature of wireless communication). If high energy-efficiency demands are also considered, it becomes clear that the design of MAC protocols for WSN is a difficult task. 2 MAC protocols In WSN, nodes usually have to share a common channel. Therefore, the MAC sublayer task is to provide fair access to channels by avoiding possible collisions. The main goal in MAC protocol design for WSN is energy efficiency in order to prolong the lifetimes of sensors. The reasons for the unnecessary energy waste in wireless communication are: • Packet collision: It can occur when nodes don't listen to the medium before transmitting. Packets transmitted at the same time collide, become corrupted and must be retransmitted. This causes unnecessary energy waste. • Overhearing: A node receives a packet which is addressed to another node. • Control packet overhead: Control packets are necessary for successful data transmission. They don't, however, represent useful data. They are very short. • Idle listening: The main reason for energy waste is when a node listens to an idle channel waiting to receive data. • Over emitting: The node sends data when the recipient node is not ready to accept incoming transmission. In order to satisfy WSN needs, the MAC protocols have to fulfill the following requirements: • Energy efficiency: Most sensor nodes are battery powered and prolonging their lifetime is possible by designing energy-efficient protocols. • Collision avoidance: The main goal is to reduce collisions as much as possible. This can be achieved either by listening to the channel (CSMA) or by using time (TDMA), frequency (FDMA) or code (CDMA) channel division access. • Scalability and adaptability: The MAC protocol needs to be adaptable to changes in network topology caused by node movement and nature of wireless transmission. • Latency: Latency represents the delay of a packet when sent through the network. The importance of latency in wireless sensor networks depends on the monitoring application. • Throughput: Represents the amount of data within a period of time sent from the sender to the receiver through WSN. • Fairness: The MAC protocol needs to provide fair medium access for all active nodes. 3 Scheduled MAC protocols The scheduled MAC protocol is based on the TimeDivision Multiple Access (TDMA). In each slot, only one node is allowed to transmit. Nodes are organized into clusters. A center of each cluster have the cluster head. It is responsible for all communication inside the cluster as well as for inter-cluster communication. It also takes care of channel time division and time synchronization of nodes. The Frequency (FDMA) or Code (CDMA) division can be used in order to avoid interference at inter-cluster communication. There are no collisions in the schedule-based protocols, as only one node at a time is allowed to transmit. There is also no overhearing or idle-listening. When a node's time slot expires, it goes back to the sleep mode. The disadvantage of these protocols is lack of peer-to-peer connection. Consequently, nodes can only communicate with a cluster head. These protocols are also poorly adaptable and scalable. When a node joins or leaves a cluster, the cluster head needs to redefine the whole framework timetable and synchronize all nodes inside the cluster. There is also huge pressure on the cluster head which has to be a unit exercising typical node performance. Because of clock drifts in the cluster of nodes, the time synchronization must also be precisely kept. Two examples of the scheduled protocols are LEACH (Low-Energy Adaptive Clustering Hierarchy) and Bluetooth. 3.1 LEACH Two versions of the LEACH protocol exist: distributed (LEACH-D) and centralized (LEACH-C) LEACH. In both versions, nodes are organized in clusters with TDMA within each cluster. In LEACH-D, the role of the cluster head is randomly rotated among all nodes in the network. The protocol is organized in rounds which consist of startup and transmission phases. In the startup phase, the nodes organize themselves into clusters, where the cluster head is picked up randomly. During the transmission phase, the cluster head collects data for the nodes within the cluster and applies data fusion before sending them to the base station. In LEACH-C, the base station decides which node will be the cluster head. The role of the cluster head is selected by the node location and its remaining energy level. 3.2 Bluetooth The Bluetooth standard has been developed for personal area networks (PAN) where nodes are laptop computers, PDAs, cell phones, etc. The nodes are organized into clusters, called piconets. Each piconet consists of one master node and up to seven slave nodes. TDMA is used within a cluster and frequency-hopping CDMA for inter-cluster communication. The master node's role is usually given to the node which starts the piconet. This one is responsible for time synchronization and traffic control inside piconet. Larger networks are constructed as scat-ternet. In such a case, a border node is used to bridge two piconets together (Fig. 1). 4 Event-driven protocols Unlike the scheduled protocols, event-driven protocols do not pre-allocate the channel for each node, regardless of whether they have data to send or not. Instead, they allocate a channel only to those nodes which need to send data. A major advantage over the schedule-based protocols it is that these protocols are more adaptable to network topology changes. They are also susceptible to changes in the node density and changes in the traffic load. They support peer-to-peer communication, so there is no need (a) point-to-point piconet 2 piconet 1 O ^slave in piconet 1, master in piconet 2 (c) scatternet type 1 Figure 1.: Bluetooth networks organizations for communication clusters. They also don't require time synchronization as is the case with the TDMA protocols. The disadvantage of these protocols is in idle listening and overhearing. A node needs to listen to a medium if it is available before transmitting data. This leads to energy waste. Energy is also wasted due to frequent collisions during the transmission. 4.1 Aloha Aloha was one of the first attempts to design the MAC protocol for regular networks. Its main idea is that the transmitter sending packets whenever it wants without the need for coordination between nodes. 4.1.1 Pure Aloha In the pure Aloha protocol nodes transmit messages regardless of whether the channel is available or not. This can lead to frequent collisions which require retransmission. The pure Aloha protocol is useful when traffic in the channel is low and collisions are rare. When the traffic load in the channel increases, collisions become more frequent and the channel tends to become congested. 4.1.3 Aloha with preamble sampling In this protocol, nodes wake up from the sleep-mode to listen to the channel. If the channel is free, they go back to sleep until the next time slot. If they pick up something on the channel, they stay awake and wait for a valid message. To avoid missing the neighbor's wake-up schedule, a sender node sends a long dummy packet, called preamble. When the neighbor wakes up, it detects the preamble and continues listening until it obtains valid data. The valid message reception is confirmed with acknowledgment frame (ACK). 4.2 Carrier Sense Medium Access with Collision Avoidance Carrier Sense Medium Access with Collision Avoidance (CSMA/CA) is widely used in wireless networks. When nodes want to transmit data, they first listen if the medium is free. If so, the node sends an RTS (Ready to Send) packet to its neighbor and waits for the CTS (Clear to send) packet. After successful coordination, the node is cleared to send data, the successful reception of which is confirmed by ACK frame. Collisions are only possible when the station is sending an RTS signal; being small, it doesn't cause any noticeable energy loss. Two problems occurring in CSMA/CA because of the limited range of radio transmission: hidden station and exposed terminal. 4.2.1 Solution to the hidden-station problem Let's assume a case with three stations: A, B and C (Fig. 2). Station C doesn't know of existence of station Figure 2.: Hidden station problem (b) point-to-multipoint piconet 2 (d) scatternet type 2 4.1.2 Slotted Aloha The slotted aloha protocol is an improved version of the pure Aloha protocol by dividing a channel into time slots in which nodes can transmit. Here the node waits for the beginning of a slot for transmission. In this solution, collision happens only at the beginning and not during transmission. By using an efficient collision detection mechanism the transmission can immediately be stopped when collision is detected and the energy can be saved. When collision is detected, the stations use a random back-off interval to avoid collision during the next time slot. A, because it's not within the range of its radio. If station A wants to communicate with station B, it sends an RTS packet with information about the length of the data packet. The RTS packet reaches station B but not station C. Collision is possible if station C sends an RTS packet at the same time. In case of collision, station B stands silent at least for the interval in which stations A and C expect CTS packets from station B. If there is no collision, station B replies to station A with a CTS packet which includes the received length information of the data packet. This CTS packet also receives station C. Now, station B knows about station A and about duration of the data packet. It uses this information to set up a Network Allocation Vector (NAV), that is used to determine how long station B should stay silent. This is the so-called virtual carries sense. This means that the node knows what is going on inside the channel without turning on its radio, and in this case, to conserve energy, it turns off its radio for the data packet duration. 4.2.2 Solution to an exposed-terminal problem Let's assume a case with two pairs of stations which want to communicate: A with B and C with D, where B and C are neighboring stations (Fig. 3). Assume that station Sleep A \\ C < D V_/ Listen for SYNC Listen for RTS send CTS (a) node 1 H- Sleep Listen for SYNC Listen for RTS send CTS (b) node 2 H- Sleep Listen for SYNC Listen for RTS send CTS Data Transmission Figure 3.: Exposed terminal problem A starts communicating with station B. Station C also wants to send data to station D. If station C receives an RTS packet from station B, it knows that it is close to the sender node but away from the receiver station. Therefore node C can send data without causing collision at the recipient station. If station C receives a CTS packet, it knows that it is close to the receiver and needs to stay silent for the time of data transmission between stations A and B. (c) node 3 Figure 4.: SMAC protocol synchronizer 1 synchronizer 2 border node of cluster 1 •• O q/ 1 \ □ - -border node of cluster-2 Figure 5.: Problem of bordering nodes in SMAC Receive data 5 MAC protocols used in WSN There are many MAC protocols adapted for different WSN applications. They differ in channel utilization, complexity and efficiency regarding energy saving. 5.1 Sensor MAC In the Sensor MAC (SMAC) protocols, nodes form virtual clusters with one common sleep schedule, so all the clusters wake up and start communicating at the same time (Fig. 4). The channel is divided into an active and sleeping period. Potential energy saving is determined by the ratio between the active and passive periods during the active period. The node starting a synchronization sequence is called synchronizer. It emits an SYNC packet which synchronizes all nodes inside the virtual cluster. Collision avoidance is achieved by the carrier sense and by the data exchange schemes RTS/CTS/ DATA/ACK. This protocol has one major problem. It is addressed to border nodes which are located at the cross-section of two virtual clusters (Fig. 5). In order to connect virtual clusters in one network, these nodes have to transmit all traffic from one cluster to another towards the sink node, therefore, they need to follow both sleeping schedules. Consequently, these nodes can quickly deplete their batteries. This problem can be solved by frequently changing synchronizer allocation inside virtual clusters which causes borders to move between clusters. Energy efficiency in SMAC is proportional to the ratio between active and sleeping periods. This ratio is constant regardless of traffic intensity. When traffic is low, most of the active-period nodes listen to an idle channel. When traffic is heavy, only some of nodes can use active period so they buffer data which they can not send. This problem increases the packet latency. 5.2 TMAC The TMAC protocol is an extension of the SMAC protocol for the time-division based approach. Weakness of the SMAC protocol can be solved by introducing an adaptive active period. All communication during the active period is done in one burst. When all communications are over, nodes still listen to the medium ta seconds for any communication demand left. After that they go into an early sleeping-mode (Fig. 6). When traffic is heavy, the active period finishes after all the nodes have sent their packets. CSMA î 1 î I î 1 î î I Î active time j î_r sleep time S-MAC TIT TIT I TIT I active time jn_ ta Ml T-MAC ta sleep time ta 1/ vi \/ si U 1 TIT Arrival, wait for right moment Source Destination -□- wake up, medium idle If medium idle, transmit wait Data K- T td -□- wake up, wake up, medium busy, it medium idle receive message Legend: □ PS, □ Rx, □ Tx, P: Preamble, A: Acknowledge Figure 6.: TMAC protocol. A major advantage of the TMAC over the SMAC protocol is in the adaptive frame time. In the SMAC protocol, as the traffic load changes the duty cycle needs to be changed in order to operate efficiently. The TMAC protocol adapts to changes in network traffic by itself. TMAC also supports overhearing avoidance, full-buffer priority and Future Ready To Send (FRTS) packets [6]. Figure 7.: Example of communication using the WiseMAC protocol. PS: prepare state, where a node is able to quick power on to Rx or Tx state. 6 Simulation results The following are the MAC protocols used in wireless networks that we tested by using simulation: CSMA/CA, SMAC, TMAC and WiseMAC. 5.3 WiseMAC The WiseMAC protocol represents an extension of Aloha with Preamble Sampling. A big disadvantage of preamble sampling is the long preamble that has to be received by all receivers, even if they are not addressed. In WiseMAC, the sender does not send a packet immediately, but shortly before the receiver is expected to wake up. Receivers wake up at constant intervals, probe the channel and if it is idle, they go back to sleep. If the receiver detects a preamble, it stays awake and receives packet. Each node must have the wake-up time table of its neighbors. Before transmission, it waits until the neighbor wakes up (Fig. 7). The protocol works as follows. The sender node doesn't start its preamble immediately, but waits until the neighbor node is expected to wake-up. The sender can spend this time in the sleep-mode to preserve energy. Preamble starts a short time before the anticipated wake-up time of the receiver in order to compensate for potential clock drifts between nodes. When the receiver node wakes up, it can hear the preamble and waits to start receiving data. A successful data reception is confirmed by the ACK frame in which the receiver piggy-backs its time schedule. The WiseMAC protocol does not have problems with idle listening and doesn't suffer from energy waste caused by long preamble, as the case with Aloha with preamble sampling. A disadvantage of this protocol is the need for clock synchronization and scheduling tables which need to be constantly updated. 6.1 Setup and parameters for CSMA/CA, SMAC and TMAC The used simulation network consists of a 5 x 5 square mesh network with 25 nodes. Each node is equipped with an IEEE 802.15.4 radio within a range radius of 3.1 units (each node can see up to 8 neighbor nodes). Power consumption is modeled by data from a Chip-con cc2420 radio (transmit 57,4 mW, receive 62 mW and sleep 0,066 mW). Packets are 128 bytes long and are transmitted at 250kb/s. In each simulation, we monitored the node average power consumption while we increased the traffic load. We used the nodes-to-sink communication pattern with a randomized shortest-path routing method. For SMAC, we used active periods ranging from 12,5 % up to 90 % of data cycle. In TMAC, we set the frame interval to 610 ms with ta interval of 15 ms. 6.2 Setup for WiseMAC Simulation considers a population of N sensor nodes under the responsibility of one access point. Downlink Poisson traffic arrives at the access point from the fixed network at a global rate of A, assuming equal traffic distribution A/N to their destination. A given sensor node will receive data packets with an average packet inter-arrival time of L = N/A. Data and control packets have a constant duration td and tc, respectively (Fig. 7). It is also assumed that global inter-arrival 1/A is much larger than the sum of td + tt + tc. P t p t t w The average power consumption increments caused by the preamble sampling activity (setup and listening during the duration of a radio symbol) with the reception of the packet and the overhearing of this packet by N - 1 neighbors during periodic traffic with period L is [5]: does the duty cycle. Simulation results for WiseMAC show that it outperforms other MAC protocols in terms of power consumption, but has a strong weakness. If traffic arises so much that time intervals tw and sum td + tt + tc become close, then the benefits of WiseMAC disappear. = + PR(ts + 1/5) + Pwise — PZ +--1--+ tw pR(X +td + tt) + pttc + Pr(N -1)(1) L L where: X — 26 L 1 — exp Y td + 12td6L 2t (Jd-V V46L y 1 — exp A tw N V46L y (2) (3) Expression (2) is obtained by taking an expectation of min(20L, td/2), with I exponentially distributed data with mean duration L and (3) determine the average duration during which a potential overhearer listens to a transmission. The energy PR(X + td + tt) + PTtc consumed to receive a packet includes the energy needed to listen to the wake-up preamble during X seconds, the energy to receive the data packet, a turn-around into Tx, mode and to send an acknowledgement. 6.3 Results Simulation results for CSMA/CA, SMAC, TMAC and WiseMAC show (Fig. 8) that CSMA/CA has the high- ---CSMA —SMAC 12.5% o SMAC 25% X SMAC 50% SMAC 75% SMAC 90% TMAC WiseMAC Load per node (bytes/s) Figure 8.: Node power consumption at the CSMA/CA, SMAC, TMAC and WiseMAC protocols. est power consumption. As there are no sleep periods in CSMA/CA, nodes listen to the channel all the time. In SMAC we have a different graph for each duty cycle of the active time. We can see that consumption decreases as the traffic load increases. The reason for this is the virtual carrier sense which is implemented in SMAC. As the node detects RTS or CTS which is not addressed to it, it goes to sleep to preserve energy. Depending on the duty cycle, we have the maximum load which SMAC can handle, meaning if traffic load changes, the duty cycle needs to be changed as well. On the other hand, the TMAC protocol is adaptive and as the traffic load increases so Acknowledgement This research was carried out during the stay of Mr. Uroš Pešovic, dipl. ing. EE as a guest researcher in the Lab for Signal Processing and Remote Control at the University of Maribor, Faculty of Electrical Engineering and Computer Science. The authors are thankful to the Serbian Goverment who supported this research with fellowship granted to Mr. Uroš Pešovic. 7 References [1] T. Haenselman: Sensor Networks. University of Mannheim, Germany April 2006. [2] I. MahgoubandM. Ilyas: SmartDust: Sensor network apli-cations architecture and design. CRC Press 2006 [3] W. Ye and J. Heidemann: Medium Access Control in Wireless Sensor Networks. University of South California/Information Sciences Institute, Technical Report ISI-TR-580, October 2003 [4] I. Demirkol, C. Ersoy and F. Alagöz: MAC Protocols for Wireless Sensor Networks: A Survey. IEEE Communications Magazine, April 2006 pp. 115-121 [5] W. Ye, J. Heidemann and D. Estrin: Medium Access Control With Coordinated Adaptive Sleeping for Wireless Sensor Networks. IEEE/ACM Transaction on networking, Vol. 12, No. 3, June 2004, pp. 493-506 [6] T. van Dam, K. Langendoen: An Adaptive Energy-Efficient MAC Protocol for Wireless Sensor Networks SenSys'03, Los Angeles, California, USA, November 5-7, 2003 [7] C. C. Enz, A. El-Hoiydi, J. D. Decotignie and V. Peiris: WiseNET: An ultra low-power Wireless Sensor Network Solution. IEEE Comupter, August 2004, pp. 62-69 Uroš Pešovic completed his studies at the Technical faculty of Cacak in 2006 where he received his diploma in electrical and computer engineering. Now he is with the Technical Faculty, as researcher in the computer science laboratory. He is studying toward Ph.D. in the field of wireless sensor networks. Aleksander Peulic is a docent at the Technical Faculty of (Cacak, University of Kragujevac. His research interests include microcontrollers, sensor networks and their applications. Žarko Cucej is a full professor for automatic control and robotics, and a full profesor for telecommunication at the UM-FERI. His recent research interests include signal processing and industrial data networks.