ABSTRACT
Wireless sensor networks (WSN) consist of micro-sensors capable of monitoring physical and environmental factors. These are often mainly made up of resource constrained sensor nodes and gateways. Networking these nodes presents several challenges because the devices have limited computational capability, data storage, energy and communication bandwidth. Therefore, various lightweight communication protocols are emerging for Machine to Machine (M2M) communications. Among the various application layer protocols for data communication in WSNs, the two most popular protocols for constrained devices are the Message Queue Telemetry Transport Protocol (MQTT) with a variant for sensor nodes (MQTT-SN) and the Constrained Application Protocol (CoAP). Studies have shown that the performance of these different protocols are dependent on different network conditions. CoAP is more efficient in terms of message overhead while MQTT-SN is more efficient in terms of client complexity. Studies have further emphasized the levels of difficulties implementing any of these protocols regarding application requirements. This project proposes an integration of MQTT-CoAP protocols using an abstraction layer that enables both MQTT-SN and CoAP protocols to be used in a sensor node. The performance of the system was evaluated in terms of latency per message size in bytes transmitted for different quality of service (QoS) levels and energy consumption per node. The result of the study showed that latency values slightly increase as the packet size increased. The lowest latency was observed in MQTT-SN QoS 0 while similar latency values were obtained for the CoAP and MQTT-SN QoS 1. The average latency was observed to be 163.2ms, 188.5ms and 191.5ms for MQTT-SN QoS 0, MQTT-SN QoS 1 and CoAP respectively. Energy consumption of the node when using MQTT-SN for a single Tx/Rx operation in a 10s interval showed an average of 261.6mJ for both QoS 0 and QoS 1 while an average of 261.3mJ was observed for CoAP. Performance evaluation of these protocols when integrated shows that the system is feasible. While CoAP performs better in terms of energy consumption, the two protocols perform almost equally in latency. The observed values of latency and energy consumption in the developed integration technique is comparable to other studies. This work has shown that the two protocols can coexist in a single sensor node without impacting negatively on its performance. Future work will be required to test the integrated system in a more complex network conditions.
CHAPTER ONE
1.0 INTRODUCTION
1.1 Background of the study
In recent years, development of smart sensors has caused interesting advancements in the development of wireless sensor networks (WSNs). Smart sensor nodes are low power devices equipped with one or more sensors, possibly with an actuator, a processor unit, memory/storage unit, a power supply and a wireless communication radio (Akyildiz et al., 2002).
Wireless sensor networks (WSNs) consist of small sensors that can monitor environmental and physical factors such as seismic events, motions, vibrations, humidity, temperature. These have been applied in different areas, such as, but not limited to, industrial process monitoring and control (Peng et al., 2006), environment observation and habitat monitoring (Chen & Liao, 2011), healthcare applications (Alemdar & Ersoy, 2010; Kulkarni & Ozturk, 2011), home automation (Ding et al., 2011; Kaiwen et al., 2017), traffic control (Xu & Lee, 2007) and forecast systems (Selavo et al., 2007).
Research in WSN technology in resource constrained devices and using the Internet Protocol (IP) has greatly changed the Internet landscape. This showed that in the near future, trillions of smart objects would be connected to the Internet to form the Internet of Things (IoT) (Colitti et al., 2011). Internet of Things (IoT) is a prominent technology used in today’s era for the establishment of the WSNs for anywhere and anyplace communication between sensor nodes (Sharma et al., 2020). The main aim of IoT is to create an interconnected network or infrastructure of devices that integrate all the current technologies (Gluhak et al., 2011). By the introduction of IoT, everything can be connected to the internet. This enables ubiquitous communication and the data sensed for communication can be physical world control signal, a device or regular internet data communication (Mohan et al., 2015).
Wireless sensor networks (WSNs) are made up of sensor nodes which are small, inexpensive, and intelligent (Yick et al., 2008) thanks to the significant advancements in the development of Micro Electrical Mechanical Systems (MEMS) development. Networking these nodes presents several challenges because the devices have limited computational capability, data storage, energy and communication bandwidth. This implies that, WSNs would currently not be able to adequately meet the needs of the IoT unless these challenges are resolved appropriately.
As the Internet of Things (IoT) expands to numerous applications through the availability of different sensors, increasing minimization of hardware, and “smart objects” (Giusto et al., 2010), many potential protocols are emerging for machine to machine (M2M) communications thus, the question of which protocol is most appropriate to use for the Internet of Things (IoT) becomes a very interesting topic for research.
The most important IoT protocols are divided into three main scategories: application layer protocols, infrastructure protocols and service discovery protocols (Martí et al., 2019). The most relevant infrastructure protocols for resource constrained devices in Lossy Networks are the Routing Protocol for Low-Power and Lossy Networks (RPL), considered the routing layer standard for IoT (Iova et al., 2016), 6LowPAN (Shelby & Bormann, 2009) for the network layer, and IEEE 802.15.4 (Molisch et al., 2006), LTE-A (Ghosh et al., 2010), EPCglobal (Kürschner et al., 2008), and Z-Wave (Gomez & Paradells, 2010) for the data link and physical layers. IETF Routing over Lows-power and Lossy networks (ROLL) Working Group has specified and designed a new IP routing protocol for smart object internetworking in addition to 6LowPAN. The protocol is called IPv6 Routing Protocol for Low-power and Lossy networks (RPL) (Vasseur & Dunkels, 2010). The most widely used service discovery protocols are DNS Service Discovery (DNS-SD) and multicast DNS (mDNS), which are used for discovering resources and services offered by IoT devices (Al-Fuqaha et al., 2015). In the application layer, several popular protocols available today are CoAP (Constrained Application Protocol) (Shelby, 2013), MQTT (Message Queuing Telemetry Transport) (MQTT, 2014), DDS (Data Distribution Service) (DDS, 2015), AMQP (Advanced Message Queueing Protocol) (OASIS, 2012) and XMPP (eXtensible Messaging and Presence Protocol) (Saint-Andre, 2011).
One of the most significant advantages of IP based networking in Low-Power and Lossy Networks (LLNs) is that typical web service architectures can be used without the necessity of application gateways. This has made it possible for smart objects to not only be connected to the internet but to be connected with the Web. This connection is defined as the Web of Things (WoT) where smart object applications are built on Representational State Transfer (REST) architectures. REST architectures allow applications to depend on services that are loosely coupled which can be reused and shared (Colitti et al., 2011).
From an end-to-end view, a Wireless Sensor Network (WSN) can be viewed as comprising of two subnets; a subnet connecting one or more gateway nodes to sensor nodes in which sensor nodes route data until it reaches one of the gateways using WSN protocols (Gnawali et al., 2009), and another subnet connecting the backend server or broker and the gateway. Sensor data generated by sensor nodes are delivered through the gateway to the server. Meanwhile, clients that are interested to receive sensor data connect to the server to obtain the data. To transfer all the sensor relevant data collected by a gateway node to a server, the gateway requires a protocol that is energy-efficient, bandwidth-efficient and can work with really limited resources in terms of hardware capacity. For this purpose, protocols like Message Queue Telemetry Transport (MQTT) (MQTT, 2014) and Constrained Application Protocol (CoAP) (Shelby, 2013) have been developed to specifically address the stringent requirements of real-world WSN deployment outcomes.
One way data transfer is handled between gateway and clients in WSNs is the “request-response” also known as “client-server” architecture which is supported by CoAP. In the client-server architecture, request messages begin a transaction with a server, which may send a response to the client identified by a matching transaction ID since it uses UDP and this is based on a polling method (Davis et al., 2013). CoAP was designed on a web transfer protocol based on REST (Representational State Transfer) on top of HTTP (Hypertext Transfer Protocol) functionalities (Al-Fuqaha et al., 2015). CoAP works using UDP unlike HTTP, removing all the overhead TCP incurs, which makes it simpler, reduces bandwidth requirements, and makes it a good option for IoT applications. CoAP uses a client/server or request/response architecture like HTTP. As a result, it uses same methods as HTTP: GET, POST, PUT, and DELETE (Richardson & Ruby, 2007). CoAP also supports unicast as well as multicast (Martí et al., 2019).
Another way data transfer is handled in WSNs is the “publish-subscribe” architecture (Eugster et al., 2003). In this architecture, a client needing data (known as subscriber) registers its interests with a server (also known as broker). The client producing data (known as publisher) sends the data to a server and this server forwards the fresh data to the subscriber. One of the most significant advantages of this design is the separation of data-sending and data-receiving clients, i.e., sensor nodes do not need to know the network address or location or any other information regarding clients that are interested in their data and conversely, clients do not need to know about the sensor nodes generating the sensor data. This decoupling enables the architecture to be highly scalable (Eugster et al., 2003). The “publish-subscribe” architecture is supported by MQTT and CoAP (Davis et al., 2013; Thangavel et al., 2014). The publish-subscribe architecture was designed because there was a need to provide loosely coupled, asynchronous and distributed communication between data generators and destinations. This solution is seen today in the form of numerous publish-subscribe Message-Oriented Middleware (MoM) (Jia et al., 2014) and recently has been a subject of many research efforts (Chelloug & El-Zawawy, 2018; Hakiri et al., 2017; Veeramanikandan & Sankaranarayanan, 2017).
In this study a variant of the MQTT protocol designed for very resource constrained nodes was used which is the MQTT for Sensor Nodes (MQTT-SN). While the original MQTT works over TCP and TLS, MQTT-SN was designed to work in Wireless Sensor Networks (WSNs) over UDP (Lesjak et al., 2015). This protocol was designed to operate and function very much like MQTT. This means that because it provides the same semantics as MQTT, it can function with the same infrastructure. The sole architectural difference is that MQTT-SN needs a new system entity, known as a gateway, which has to convert all MQTT-SN messages sent over UDP to MQTT messages sent over TCP. Because of the fact that many brokers currently have this capability built in, all the complexity resides at the broker/gateway side, making the client side a lot simpler (Martí et al., 2019).
Studies have shown that the performance of these different protocols are dependent on different network conditions. MQTT messages had shorter delays than CoAP when there was less packet loss and larger delays when there was more packet loss. (Chen & Kunz, 2016; Thangavel et al., 2014). In addition, the publisher-subscriber architecture using the broker mechanism of the MQTT protocol offers two major advantages over the CoAP technique and these are; publishers and subscribers do not need to know about each others existence or presence; to share information, subscriber and publisher do not need to be online/active at the same time, because the broker is capable of storing data for clients that are not connected at the time a message is published (Sachs et al., 2010).
As a result of the fact that the disadvantages offered by one protocol is complemented by the other protocol and vice-versa, this study proposes an integration of MQTT and CoAP protocols that bring the advantages of both protocols to be utilized in data communication.
1.2 Research Motivation
Research has revealed that the two most predominantly used communication architectures in internet of things are the request/response architecture implemented in CoAP and the publish/subscribe architecture implemented in MQTT. Research has also shown that MQTT-SN and CoAP are the two most predominantly used application layer communication protocols for resource constrained wireless sensor nodes. Because of the design and architecture of each of these two protocols, there are certain network conditions and certain network designs that each protocol is better suited for. In other words, if the sensor nodes are programmed to work with the MQTT-SN protocol because of the network design/conditions, any change to the design/condition that necessitates the need for CoAP protocol to be used would require the sensor nodes to be reprogrammed. Furthermore, this would constitute a major roadblock to dynamic application layer communication protocol switching in resource constrained sensor nodes.
The effort to solve problems that arise from stereotyped application layer architecture for communication in WSNs is the main motivation for this research. There is no prior research that attempts to implement an integration of the MQTT-CoAP protocols in resource constrained devices.
1.3 Statement of the Research Problem
There are often expensive tradeoffs when either CoAP or MQTT Protocols are used individually and switching them would often require re-programming the node which is difficult in real life scenario. Identifying the problems that could arise from using either protocol can only be adequately realized after deployment. For better communication efficiency, the engineer would be required to retrieve all the nodes and reprogram them which would be an extremely tedious task depending on the size of the wireless sensor network.
1.4 Aim and objectives of the study
The aim of this work is to integrate the MQTT and CoAP protocols for data communication in wireless sensor networks. To achieve the aim, the objectives of this research are to:
i. Develop an abstraction layer that manages both MQTT and CoAP protocols thereby integrating both protocols in a system
ii. Test the integrated protocols by simulating the protocol and measuring Energy consumption and Latency
iii. Evaluate the performance of each protocol in the integrated system and compare with the performance of MQTT and CoAP protocols for diverse QoS requirements.
1.5 Justification of the Study
Various studies have highlighted the advantages, disadvantages and the performance evaluation of the MQTT and CoAP protocols. These show that some disadvantages of MQTT protocol is addressed in the CoAP protocol and some disadvantages of the CoAP protocol is addressed in the MQTT protocol. For example MQTT messages had shorter delays than CoAP when there was less packet loss and larger delays when there was more packet loss (Thangavel et al., 2014). CoAP uses RESTful (Representational State Transfer) technique which provides flexibility and interoperability with other HTTP schemes. This enables a request pattern like GET, PUT, POST request for accessing or executing a specific function on the Node while the MQTT does not support RESTful methods (Dizdarevic et al., 2019). The REST technique would greatly simplify node specific configurations as opposed to setting up a subscription topic on the broker for node specific configurations in the MQTT protocol. The complementary advantages and disadvantages of the MQTT and CoAP protocol justifies the need for a study on integrating both protocols and utilizing them for data communication.
1.6 Significance of the Study
This study focuses on creating a technique that uses both MQTT and CoAP protocols for data communication in WSNs by creating an abstraction layer that enables leveraging any or both protocols for communication. This can then be further improved to facilitate identifying the data transmission type, network architecture and utilizing the most appropriate protocol for communication.
1.7 Organization of the thesis
Chapter two contains the theoretical background and review of some published literature related to this work. The methods and materials used in achieving the research objectives are presented in chapter three. In chapter four, the performance evaluation of the two protocols were carried out, the results of the research work were presented and discussed. Chapter Five is the Conclusion and Recommendations for future research.
This material content is developed to serve as a GUIDE for students to conduct academic research
INTEGRATION OF MESSAGE QUEUE TELEMETRY TRANSPORT PROTOCOL AND CONSTRAINED APPLICATION PROTOCOL FOR DATA COMMUNICATION IN WIRELESS SENSOR NETWORKS>
A1Project Hub Support Team Are Always (24/7) Online To Help You With Your Project
Chat Us on WhatsApp » 09063590000
DO YOU NEED CLARIFICATION? CALL OUR HELP DESK:
09063590000 (Country Code: +234)
YOU CAN REACH OUR SUPPORT TEAM VIA MAIL: [email protected]
09063590000 (Country Code: +234)