Lesson Contents
There are many protocols and standards we can choose from to build an IoT network. In this lesson, I’ll give you an overview of common standards and protocols.
Protocols
There are many protocols that have a direct or indirect role in IoT. We’ll focus on two protocol types in particular:
- Network protocols
- Data protocols
Network Protocols
The network protocols we use for IoT should be open standards because our IoT network has to support devices from multiple vendors. Proprietary protocols increase complexity because you then need devices that can translate between the different protocols.
The Internet Protocol (IP) is well established and we have been using IP for IT networks for a long time. This is one of the reasons why IP is also the main choice for IoT networks.
Using IPv6 is encouraged because there are no address space limitations as there are with IPv4. Solutions such as IPv6 over Low-Power Wireless Personal Area Networks (6LoWPAN) or IPv6 Routing Protocol for LLNs (RPL) don’t even support IPv4, only IPv6.
Data Protocols
We need to transfer data between our devices and other systems such as an IoT platform. Some devices have sensors that push data at a regular interval. Other sensors work with a pull model where you have to request the information. There are several data protocols we can use in IoT. Here are three popular protocols:
- Message Queuing Telemetry Transport (MQTT)
- Constrained Application Protocol (CoAP)
- Extensible Message and Presence Protocol (XMPP)
MQTT
MQTT is probably the most used protocol in IoT. It’s a lightweight message protocol that uses publish and subscribe operations to transmit data between a client and server. It uses TCP as the transport protocol.
Packets are tiny and require little bandwidth. MQTT uses a client-server model. The server is called a broker. There are two operations:
- Publish: a device (client) sends data to a broker (server).
- Subscribe: a device (client) wants to receive data from a broker (server).
CoAP
CoAP is also a lightweight protocol and was developed as a standard (RFC 7252). It’s based on a REST model. A server makes resources available under a URL and clients access these resources with GET, PUT, POST, and DELETE methods. It is easy to get started with CoAP because many developers are familiar with REST.
CoAP can carry different payload types including XML and JSON and uses UDP as the transport protocol.
XMPP
XMPP is an open standard (RFC6120) and is based on XML technology for real-time communication. It’s used for a range of applications including VoIP, instant messaging, and IoT.
XMPP has been around for a while and has proven scalability and security. There are many servers that have used XMPP for many years. Software is available for any programming language making it easy to get started. Because XMPP was originally an instant messaging protocol and uses XML, it has more overhead compared to a lightweight protocol like MQTT.
Standards
Besides protocols, there are many standards that we can use for IoT solutions. One of the most important choices to make is how to connect our devices to the Internet.
Network Types
There are wired and wireless network types. Let’s start with an illustration of different network types and the distance they cover:
Let’s take a look at each network type.
Nano Network
A nano network is a set of small devices (a few hundred nanometers or a few micrometers) that can perform only simple tasks. These devices could be sensors, actuators, or data storage or computing devices. Nano networks allow new applications in fields such as environmental research, military technology, and the biomedical field. IEEE created the P1906.1 workgroup to develop a common framework for nano-scale and molecular communication.
Body Area Network (BAN)
BAN is a wireless network for devices near or inside the body. BAN devices include wearable technology such as smartwatches or earbuds but also devices inside the body such as implants. This network type is also known as a wireless body area network (WBAN), body sensor network (BSN), or medical body area network (MBAN). The latest standard for WBANs is IEEE 802.15.6.
Personal Area Network (PAN)
A PAN is a network that connects devices within a person’s workspace. This includes devices like laptops, smartphones, and tablets. We can use a PAN for connectivity between these devices or connect to another network type (LAN or WAN) where one device becomes the gateway for all other devices. PAN networks can be wired (for example USB) or wireless. A wireless personal area network (WPAN) is a PAN that uses short-distance low-power wireless technology. For example, Bluetooth or Zigbee. A WPAN covers anywhere between a few centimeters to a few meters.
Local Area Network (LAN)
The LAN is the network type we are all familiar with. It’s a network that covers a limited area like an office building. Ethernet and Wi-Fi are the two most common technologies on the LAN.
Campus Area Network (CAN)
A CAN is a network that covers multiple LANs in a smaller geographical area like a university. The range of a CAN is about 1 to 5 kilometers.
Metropolitan Area Network (MAN)
The MAN is a larger network that covers the size of a metropolitan area. MANs connect multiple LANs in a city into a larger network. The MAN can offer a connection for all these LANs to a WAN. We use technologies like Metro Ethernet here.
Radio Access Network (RAN)
A RAN uses radio access technology. RANs have been in use since the beginning of cellular technology. This network uses a base station and antennas to cover a region. This includes 3G, 4G, and 5G network connections.
Wide Area Network (WAN)
A WAN network provides connectivity between LANs that are kilometers apart. For IoT we also have Low Power Wide Area Networks (LPWAN). These are low-bandwidth networks designed for long-range communication, with battery-powered devices in mind. LoRaWAN is an example of a LPWAN.
Requirements
How do we decide which network type we should use for our IoT network? It depends on the following factors:
- Does the network support many devices?
- How reliable is the network?
- Is it possible to transmit real-time data with minimal delays?
- How secure is the network?
- How much does it cost to connect our devices?
Wired connections are reliable and offer high bandwidth but are not always feasible due to cost or because we use mobile devices that require a wireless connection. Wireless technology is a common choice for IoT networks. As a rule of thumb in wireless networking, range decreases as bandwidth increases.
The following graphic shows some common wireless technologies and their relation to bandwidth and range:
An important aspect to consider when choosing a network type is power consumption. Especially when we use battery-powered devices.