TDMA based MAC protocol to assist in Wide area Sensor Network Deployment This thesis was submitted to the Department of Electronic & Telecommunication of the University of Moratuwa in partial fulfillment for the degree of Master of Science By N. S. Gajaweera Supervised by Prof. Dileeka Dias Department of Electronic and Telecommunication University of Moratuwa Sri Lanka May 2009 ii DECLARATION The work included in this thesis, in part or whole has not been submitted for any other academic qualification at any institution. ................................ Nuwan Gajaweera M.Sc. research (full time) Dept. of Electronic & Telecom University Moratuwa (Candidate) I endorse the declaration by the candidate. ................................ Prof. Dileeka Dias Professor Dept. of Electronic & Telecom University of Moratuwa (Supervisor) iii ACKNOWLEDGMENT I would like to thank my supervisor Prof. Dileeka Dias for her valuable advice, support and encouragement throughout my period of study. I would also like to thank the Dialog UoM Mobile Communication Lab for funding my work. Special thanks go out to the staff of the Dialog-UoM Mobile Communication lab for their constant support and friendship right throughout my period of study. I would like to thank head of the Electronics & Telecommunication Mr. Kithsiri Samarasingha as well as the members of the academic staff for their support and on constructive criticism that kept me on the right track. I would like to thank my parents for their enthusiasm in all my achievements and for pointing my head in the right direction from day one. And last but not least I would like to thank my wife for her patience during difficult times and for the love and support she gives me in all my endeavours. Nuwan Gajaweera February 2009 iv ABSTRACT Wireless sensor networks are an emerging area of interest among research groups around the globe. It is envisioned that these low power computers will become the enabling technology in pervasive computing and bring about the next paradigm shift in computing. The purpose of this work has been the development of enabling technologies for a sensor network deployment over a wide geographical area. Chief among these is the development of a time division multiple access (TDMA) based MAC protocol for a special type of mobile wireless sensor network. In this network, mobile sensor nodes will sense the environment, and buffer the measured data for later retrieval. Once within range of the base station, the mobile mote will upload the buffered data to the base station. Such a system could be used in applications such as analyzing migration patterns of animals (ex. Elephants) or offline monitoring of vehicle fleets. We present a MAC protocol developed by combining floor acquisition multiple access (FAMA) and TDMA that will maximize the throughput of the said network, and thereby ensure that the maximum amount of data can be uploaded by the mobile mote to the base station in a given time. The proposed protocol is implemented as TinyOS components, targeted for the MICA2 sensor network platform. Simulation results are presented that benchmark the proposed FAMA/TDMA Hybrid MAC against a CSMA based MAC (B-MAC) protocol as well as a demand assigned TDMA protocol. In addition to the above MICA2 motes were built locally for the purpose of testing the protocol on real hardware. A study was carried out and recommendation made on algorithms that can be used for data storage on such a system. v TABLE OF CONTENTS Title Page................................................................................................................ i Declaration............................................................................................................. ii Acknowledgement................................................................................................ iii Abstract.................................................................................................................. iv Table of Contents................................................................................................... v List of Figurers...................................................................................................... vi List of Tables......................................................................................................... vi List of Abbreviations............................................................................................ vii 1.0 Introduction .............................................................................................................. 1 2.0 Literature Survey ..................................................................................................... 3 3.0 Methodology .......................................................................................................... 18 4.0 Wireless Sensor Node Hardware ........................................................................... 20 5.0 The MAC protocol ................................................................................................. 25 6.0 Simulations & Results............................................................................................ 36 7.0 Recommendations for data storage ........................................................................ 43 8.0 Conclusion ............................................................................................................. 45 References .................................................................................................................... 46 Appendix A – The MICA2 V1 Schematic and PCB ...................................................... i Appendix B – The MICA2 V2 Schematic and PCB..................................................... iv vi LIST OF FIGURES Figure 1.1 – Illustration of scenario under study ........................................................... 1 Figure 2.1 – Classification of MAC protocols and some examples .............................. 4 Figure 2.2 – Preamble sampling in LPL ........................................................................ 5 Figure 2.3 – Comparison between LPL and X-MAC .................................................... 6 Figure 2.4 – S-MAC sleep periods and active periods .................................................. 7 Figure 2.5 – A graphical representation of the Blink application ................................ 14 Figure 2.6 – Interface user and interface provider ....................................................... 15 Figure 4.1 – A MPR4x0 aka MICA2 mote from Crossbow Technologies ................. 20 Figure 4.2 – A block diagram of a MICA2 .................................................................. 20 Figure 4.3 – The CC1000 plug and play radio module................................................ 21 Figure 4.4 – The MICA2 V1 board with the plug and play radio module attached .... 22 Figure 4.5 – A block diagram of a MICA2 V2 ............................................................ 22 Figure 4.5 – The MICA2 V2 board with expansion modules attached ....................... 23 Figure 5.1 – Process for MAC protocol development ................................................. 25 Figure 5.2 – Transmission periods and contention periods ......................................... 26 Figure 5.3 – Flow diagram of demand assigned TDMA MAC ................................... 27 Figure 5.4 – Use of guard periods in the transmission period ..................................... 29 Figure 5.5 – Efficient use of radio resources by repeated transmission ...................... 29 Figure 5.6 – Flow diagram for the transmission period ............................................... 30 Figure 5.7 – Packets exchanged during contention period .......................................... 31 Figure 5.8 – Flow diagram for the contention period .................................................. 32 Figure 5.9 – Flow diagram of FAMA/TDMA MAC ................................................... 34 Figure 5.10 – Flow diagram of a transmission period for the FAMA/TDMA MAC .. 35 Figure 6.1 – BMAC - Throughput vs Number of nodes .............................................. 38 Figure 6.2 – FAMA/BMAC hybrid - Throughput vs Number of nodes ...................... 39 Figure 6.3 – Demand assigned TDMA MAC - Throughput vs Number of nodes ...... 39 Figure 6.4 – FAMA/TDMA hybrid - Throughput vs Number of nodes ...................... 40 Figure 6.5 – Comparison of Simulation Results - Throughput vs Number of nodes .. 41 LIST OF TABLES Table 2.1 – WSN platforms ........................................................................................... 3 Table 2.2 – Flash file systems ...................................................................................... 12 Table 2.3 – Some popular memory cards .................................................................... 13 Table 2.4 – Open-source WSN operating systems ...................................................... 14 Table 2.5 – Components of a TinyOS deployment...................................................... 16 Table 2.6 – Motes that support TinyOS platform ........................................................ 16 Table 4.1 – Standard sensor boards ............................................................................. 21 Table 5.1 – Packets exchanged during the transmission period .................................. 28 Table 5.2 – Packets exchanged during the contention period ...................................... 31 Table 6.1 – Comparison between FAMA/BMAC & FAMA/TDMA MAC ............... 41 Table 6.2 – Simulation verification for TDMA MAC ................................................. 42 Table 6.3 – Simulation verification for FAMA/TDMA MAC .................................... 42 vii LIST OF ABBREVIATIONS API – Application programmers interface BMA – Bit-map-assisted B-MAC – Berkeley Medium Access Protocol CF – Compact flash COTS – Common off the shelf CPU – Central processing unit CSMA – Carrier sense multiple access CTS – Clear to send EEPROM – Electrically Erasable Programmable Read-Only Memory FAMA – Floor acquisition multiple access FAT – File allocation table FIFO – First-in-first-out GAMA – Group allocation multiple access GPRS – General packet radio service GPS – Global positioning system GUI – Graphical user interface IC – Integrated circuit IR – Infra-red LAN – Local area network LEACH – Low Energy Adaptive Clustering Hierarchy LED – Light emitting diode LMAC – Lightweight Medium Access Protocol LPL – Low power listening MAC – Medium/Media Access Control MEMS – Micro-Electro-Mechanical Systems MMC – Multimedia memory card MMU – Memory management unit OS – Operating system PCB – Printed circuit board …… continued viii LIST OF ABBREVIATIONS PDA – Personal digital assistant PEDAMACS – Power efficient and delay aware medium access protocol sensor networks PPC – Packets-per-cycle RF – Radio frequency ROM – Read only memory RTS – Ready to send Rx – Receiver/Reception SD – Secure Digital S-MAC – Sensor Medium Access Protocol S-MAC/AL – Sensor MAC with adaptive listening SPI – Serial peripheral interface SRAM – Static random access memory TDMA – Time division multiple access T-MAC – Timeout Medium Access Protocol TOSSIM – TinyOS simulator Tx – Transmitter/Transmission WSN – Wireless sensor network