This post is a part of course From beginner to expert in IoT, so if you’re interested, more information you will find inside the link.
To describe how to connect the device with different systems, devices or everything that you want I divided the protocols into layers. Why? Different layers have their own purposes for sending data.
In IoT you need to decide which protocol you will choose, for example, UDP is a lightweight version of the protocol to send data, but you can lose packages and data will be insecure. On the other hand, you have AMQP protocol which is common in enterprise systems, but too heavy for devices. Each system will have a mix of these protocols, where each protocol will send data further or secure them.
Sometimes you will find that one standard is part of another standard or protocol, such as DTLS with TLS or ZigBee with IEEE 802.15.4. From my point of view, there a lot of other protocols or standards that can be applied. To keep this post simple and robust I chosen most useful that you need to know.
Application layer helps to exchange data between systems in an easy way by using common standards. Most know the standard is HTTP, but in IoT stack, we have different protocols to interact with end users. Most common and useful are:
CoAP(Constrained Application Protocol) – a protocol which you can compare to HTTP, both working on the REST model. You can use it with a microcontroller that has 10 KiB of RAM and 100 KiB of code space and sends data by default via UDP and IP to use minimal resources as you can. To secure transferring data, CoAP uses another protocol called DTLS. Device with this protocol can transfer data almost everywhere due to REST via XML or JSON.
MQTT(Message Queuing Telemetry Transport) – lightweight M2M (machine to machine) protocol, which based on the Publish/ Subscribes pattern. Devices with MQTT protocol is at this same moment publisher and subscriber of the events and act independently from different events. You can send telemetry data in D2C (device to the cloud) manner and invoke commands on the device with C2D (cloud to the device) manner, it depends on you.
XMPP(Extensible Messaging and Presence Protocol) – protocol to build decentralized messaging system, easy to scale enormous amounts of devices. Integrated with XML and secured by TLS with SASL. You can extend XMPP with extensions called XMPP Extension Protocols (XEPs), such as XMPP-IoT.
AMQP(Advanced Message Queuing Protocol) – is an interoperable protocol, which allows connecting different systems without worrying about compatibilities with the second system. AMQP is binary (intended to be read by a machine) protocol to send data and is secured by SASL or TLS.
The transport layer is appropriate for connection-oriented communication to transmission of data segments between points on a network, but in a connectionless approach, such as UDP it’s also true.
UDP(User Datagram Protocol) – connectionless communication protocol that no guaranteed delivery a data. It’s a simple protocol that allows sending data with the low overhead of the device to many devices at this same time (multicast). It’s not intended to use in the real-time system, due to the possibility of damaged or lost data.
DTLS(Datagram Transport Layer Security) – implements TLS and UDP together. The protocol provides secure communication, detection of duplicated data and prevents loss or damaged data.
As the name suggests, it’s group of methods, protocols that allow sending packets via IP to many users.
IPv6 – the most recent internet protocol(IP) that expand the number of available addresses from 232 to 2128 , to assign each device on the earth its own identity.
6LoWPAN(Low-power Wireless Personal Area Networks) – a wireless mesh network that uses IP to create an identity and standard protocols such as CoAP, MQTT, UDP to send data. Allows creating a mesh network with devices that met the requirements of the IEEE 802.15.4 standard.
ZigBee – also short-range wireless, based on IEEE 802.15.4 standard for small projects to create mesh networks for sensor networks, personal networks (WPAN), home automation, alarm systems, monitoring systems.
The physical layer is responsible for transferring data bit-by-bit from source to destination.
IEEE 802.15.4 – a standard that was developed to provide a framework and the lower levels for low power networks with low cost. Provide communications over distances up to 10 meters and with maximum transfer of 250 kbps. Most known implementations of this standard are ZigBee and 6LoWPAN.
Security in IoT is everything, so it’s worth knowing that you will find these standards from websites to devices using to secure our sessions or data.
TLS(Transport Layer Security) – cryptographic protocol to secure connections between client and server. Working with asymmetric encryption and x.509 Certifications.
SASL(Simple Authentication and Security Layer) – a framework that provides authentication and data security. Allows connecting different system that implements SASL by decoupling the authentication mechanism from the application layer.