Bluetooth Low Energy Based Coap Communication in Iot Coapnonip: an Architecture Grants Coap in Wireless Personal Area Network
Total Page:16
File Type:pdf, Size:1020Kb
Bluetooth Low Energy Based CoAP Communication in IoT CoAPNonIP: An Architecture Grants CoAP in Wireless Personal Area Network A Thesis Submitted to the College of Graduate Studies and Research in Partial Fulfillment of the Requirements for the degree of Master of Science in the Department of Computer Science University of Saskatchewan Saskatoon By NAN CHEN c NAN CHEN, July/2016. All rights reserved. Permission to Use In presenting this thesis in partial fulfilment of the requirements for a Postgraduate degree from the University of Saskatchewan, I agree that the Libraries of this University may make it freely available for inspection. I further agree that permission for copying of this thesis in any manner, in whole or in part, for scholarly purposes may be granted by the professor or professors who supervised my thesis work or, in their absence, by the Head of the Department or the Dean of the College in which my thesis work was done. It is understood that any copying or publication or use of this thesis or parts thereof for financial gain shall not be allowed without my written permission. It is also understood that due recognition shall be given to me and to the University of Saskatchewan in any scholarly use which may be made of any material in my thesis. Requests for permission to copy or to make other use of material in this thesis in whole or part should be addressed to: Head of the Department of Computer Science 176 Thorvaldson Building 110 Science Place University of Saskatchewan Saskatoon, Saskatchewan Canada S7N 5C9 i Abstract In recent years, the development of smart devices has led to the Internet of Things (IoT). In IoT, the Constrained Application Protocol (CoAP) is a well-known protocol used in constrained networks. CoAP aims to work in IP-based networks. However, there are many constrained devices using different scenarios to transfer data. For example, Bluetooth Low Energy (BLE) devices use the Media Access Control (MAC) address as an identifier and use Generic Attribute Profile (GATT) to transfer data. Therefore, how to overcome those barriers is an important topic. There are several approaches to overcome those barriers. For example, a new hardware component can be added to make those devices support TCP/IP protocol stacks, then CoAP can easily be implemented in those devices. On the other hand, an application layer architecture can be added upon existing communication technologies to support CoAP. Considering to minimize the changes of underlying communication infrastructure, the second approach can achieve the goal with less effort. This thesis proposes an architecture that apply CoAP to different Non-IP based communication tech- nologies. Meanwhile, Bluetooth Low Energy is used to explore how to overcome limitations of underlying technology. By adopting the proposed architecture, existing devices can participate in the IoT through CoAP without extra hardware upgrade or hardware modification. Although experiments show that the current im- plementation of the proposed architecture has relatively low data rate, the problem can be solved via changing the factory settings of BLE devices. Compared with the hardware solution, the proposed architecture takes less effort to support different underlying technologies and platforms. ii Acknowledgements I would like to express my very great appreciation to my supervisor Professor Ralph Deters. Under his supervision, I have gained great skills in the past two years. The past two years was a wonderful and memorable journey of my life. Under Professor Ralph Deterss guide, I not only achieved marks in academic but also increase skills in programming. I would also like to extend my thanks to all colleagues in MADMAC lab. Their support helped me to work through the tough time at the first year and granted me confidence to overcome problems. At last, I want to thank the support of my parents and family members. Without their support, I can not study and work smoothly in the past two years. iii Contents Permission to Use i Abstract ii Acknowledgements iii Contents iv List of Tables vi List of Figures vii List of Abbreviations viii 1 Introduction 1 2 Problem Definition 2 2.1 How to identify Non-IP based devices? . 2 2.2 How to overcome packet size limitation of BLE communication? . 2 2.3 How to serve multiple applications as a background service . 3 2.4 How to provide interface to support different technologies . 3 2.5 Research Goal . 3 3 Literature Review 4 3.1 Internet of Things (IoT) . 4 3.2 Personal Cloud . 6 3.3 Simple Object Access Protocol (SOAP) and Representational State Transfer (REST) . 7 3.3.1 SOAP . 7 3.3.2 REST . 8 3.3.3 REST VS SOAP . 9 3.3.4 REST VS SOAP in mobile app . 10 3.3.5 Summary . 10 3.4 MQ Telemetry Transport (MQTT) and Constrained Application Protocol (CoAP) . 10 3.4.1 MQTT . 10 3.4.2 CoAP . 11 3.4.3 COAP VS MQTT . 14 3.4.4 Summary . 15 3.5 Bluetooth . 15 3.5.1 Classic Bluetooth . 15 3.5.2 Bluetooth Low Energy . 17 3.5.3 Classic Bluetooth vs Bluetooth Low Energy . 20 3.5.4 Summary . 21 3.6 CAP Theorem . 21 4 Architecture 23 4.1 Application Layer . 23 4.1.1 Process component . 24 4.1.2 Communication component . 25 4.2 Network Layer . 26 4.3 Detail Design . 27 iv 4.3.1 Application layer . 27 4.3.2 Network layer . 28 4.4 Proposed Solutions for Problems . 34 5 Implementation 36 5.1 Application Layer . 36 5.2 Network Layer . 37 5.3 Demo Applicaitons for Experiment . 38 6 Experiments/Evaluations 40 6.1 Goals of Experiment . 40 6.2 Experiment Setup . 40 6.3 Details . 41 6.3.1 Minimum Data with Interval . 41 6.3.2 Multiple Packets . 44 6.3.3 Round-Trip . 47 6.3.4 Multiple Apps . 49 6.4 Conclusion . 50 7 Conclusion and Future Work 52 7.1 Summary and Contributions . 52 7.2 Future Work . 53 7.2.1 Data Rate . 53 7.2.2 Availability . 53 7.2.3 Cross-Platform . 53 7.2.4 Underlying Technology . 54 7.2.5 Security . 54 References 55 A Link for code 58 v List of Tables 6.1 Experiment goals . 40 6.2 Specifications of devices . 41 vi List of Figures 3.1 Trend of devices vs people [15] . 5 3.2 SOAP message structure example [24] . 7 3.3 MQTT message format[2] . 11 3.4 CoAP message format [34] . 12 3.5 From Web Applications to IoT Nodes [33] . 13 3.6 Topology of Classic Bluetooth [35] . 16 3.7 The relationship between Bluetooth Smart and Bluetooth Smart Ready devices [40] . 17 3.8 GATT format [35] . 18 3.9 Topology of BLE [35] . 18 3.10 IPv6 and IPSS on the Bluetooth LE Stack [27] . 20 4.1 Layers of proposed architecture . 23 4.2 Application layer structure . 24 4.3 Process component flowchart . 25 4.4 Life cycle of network service . 30 4.5 Life cycle of network service . 31 4.6 Packet structure . 32 4.7 Communication mechanism . ..