Let's start with the messaging protocols, MQTT and CoAP, and consider which of the following open standard protocols should be considered for your implementation.
If you're looking for the right guide to gain a solid perspective of the IoT business, these lines might just be what you need. The IoT can be defined as the a system of interrelated devices (such as sensors) that are provided with unique identifiers and the ability to transfer data over a network without requiring human-to-human or human-to-computer interaction.
So, how do all these "Things" speak among them? Which are the languages/communication protocols they use and which one should we choose? The answer might surprise you... it depends!
There are 2 types of open standard protocols that work for small devices:
- Message Queuing Telemetry Transport (MQTT)
- Constrained Application Protocol (CoAP)
MQTT and CoAP are two of the most promising protocols for small devices such as sensors. Both are:
- Open standards lightweight protocols very useful to cover the IoT needs
- They suit to constrained environments better than HTTP does
- Provide mechanisms for asynchronous communication
- Run on IP
- Have a range of implementations
The main differences between these two protocols are shown in the table below:
None of these protocols applies to all the cases, both have their pros and cons. Choosing the correct one depends on your application.
Let's proceed with a second group of Protocols: ZigBee and 6LoWPAN for sensor Networks
As a curiosity, the name ZigBee comes from the communicative erratic patterns that the bees do. This looks back on the invisible networks and their respective connections. ZigBee is an IEEE standard 802.15.4 (a technical standard that defines operation of low-rate WPANs) based specification for high-level communication protocols used to create WPANs, operating at 2.4 GHz targeting applications that require relatively infrequent data exchanges at low date-rates over a restricted area and within a 100m range.
The technology defined by ZigBee is simpler and less expensive than other WPANs such as Bluetooth and WiFi. ZigBee is a low-cost, low-power, wireless mesh network standard 3 targeted at the wide development of long battery life devices in wireless control and monitoring applications. Their devices have low latency, which further reduces average current. The following diagram shows the ZigBee meshed architecture and all sort of devices on the network
To sum up, ZigBee was developed to satisfy and provide a standards-based protocol for interoperability (applications do not need to know the constraints of the physical links that carry their packets) of sensor networks. And guess what? A competitor came up in the market: 6LoWPAN
On the other hand 6LoWPAN which is an acronym for IPv6 3 over Low-Power Wireless Personal Area Networks, originated from a working group in the IETF.
Their products have entered the marketplace as ZigBee’s competition, as it can utilize 802.15.4. Moreover, it can run on other PHYs (physical layer of the OSI model, and it refers to the circuitry required to connect a link layer often called MAC to a physical medium such as a cable).
Let’s make a more detailed comparison to be able to see which fits best or the most used connectivity protocol nowadays and why.
On the one hand, ZigBee’s wireless interoperability protocol defines the communication between 802.15.4 nodes and then defines new upper layers all the way to the application. This means ZigBee devices can interoperate with other ZigBee devices, creating in my opinion a bit more constrained network at a glance.
On the other hand, 6LoWPAN offers interoperability with other 802.15.4 wireless devices in addition to any other IP network link (Wi-Fi or Ethernet) with a simple bridge device. Although bridging between non-ZigBee and ZigBee networks requires a more complex application layer gateway. The key requirement for IPv6 over 802.15.4 is that the maximum transmit unit (MTU) must be at least 1280 byte packets.
In terms of security, both connectivity protocols benefit from built-in AES128 encryption, which is part of the IEEE 802.15.4 standard.
Finally, and trying to get a conclusion of which goes first on the race, we can affirm that all the major players in the semiconductor industry promote and supply 802.15.4 chips which can be used for either ZigBee or 6LoWPAN, but these same companies even offer free ZigBee stacks. So, the support for 6LoWPAN stacks seems to be trailing behind ZigBee.
Concluding, 6LoWPAN is pretty attractive, since it is IP based. Nevertheless, ZigBee appears to be more popular and has been adopted by major players in multiple industries, and the ZigBee alliance just introduced ZigBee IPv6 end-to-end networking to create a cost-effective and energy-efficient wireless mesh network.