IoT Native Blog

Power saving in cellular LPWAN

Lean protocols for the IoT: MQTT, CoAP and LwM2M

MQTT, CoAP and LwM2M

The volume of data that an IoT device transmits during communication has a great effect on its energy demands. The more data the device transmits, the longer it must remain active and the greater its energy consumption. In addition to network-based methods such as PSM and eDRX which determine a device’s activity intervals at the network level, choosing the right communication protocol can also conserve just as much energy, and perhaps even make PSM or eDRX obsolete.

Blog series “Power Saving in cellular LPWAN”

 

Unlike PSM and eDRX whose functions depend heavily on individual network operators, the choice of communication protocols applies universally and makes optimizing device power consumption consistent everywhere, This is a prerequisite for scaling a product for mass deployments, because the developer doesn’t need to account for the SIM and which network operator is in use.

MQTT: slim, but not slim enough

The Message Queuing Telemetry Transport protocol (MQTT) was designed for use in machine-to-machine (M2M) communications back in 1999, long before anybody ever talked about “The Internet of Things”. Today, it is a standard protocol for device communication. MQTT uses the Transport Control Protocol (TCP) for data transport. The communication works according to a client/server model. The IoT device is the client and talks to a server designated as a “broker”, for example, a cloud service provided by Amazon Web Service (AWS).

 

The core element of MQTT is to organize its data in so called “topics.” The topic is a hierarchically sorted string. In an example of a weather station, it could be organized as “weatherstation_a/temperature/ground” for a ground temperature sensor of weather station A, while “weatherstation_a/temperature/air” would define an air temperature sensor of that same station. Depending on which value needs to be retrieved, an IoT application can subscribe to these topics to read that individual data.

 

The disadvantage of these strings is that they can be uneconomical in data transmission.These strings can become long, which increase the volume of data that a sensor transmits and thus drains energy unnecessarily. For simple sensors where computing power and energy consumption are strictly limited, this architecture can quickly become a problem.

CoAP: Leaner, thanks to UDP

The Constrained Application Protocol (CoAP) handles resources more economically. Unlike MQTT, it relies on the User Datagram Protocol (UDP). Unlike TCP, UPD is a connectionless, packet-oriented protocol. For example with TCP, all data packets arrive at the recipient numbered and need to be confirmed before the next data packet is sent on its way. UDP sends the data packets all one after the other, without additional error checking. This saves effort, time, and most importantly, energy.

 

That is why CoAP is more suitable wherever devices must pay close attention to their resource needs. Battery-powered devices usually have simple hardware with limited computing power. They are not designed to perform complex computing operations, but rather transmit data quickly and simply while consuming as little energy as possible.

LwM2M: The newcomer based on CoAP

Lightweight M2M (LwM2M) is the response to market demand for a common standard for managing low-power devices on the Internet of Things. Developed by the Open Mobile Alliance, LwM2M is still quite young. LwM2M was first introduced in February 2017.

What is LwM2M?

Lightweight M2M is based on CoAP and aims to simplify and standardize device management in the Internet of Things. It is therefore not only designed for messaging, but also includes elements for device management as well.

 

For the exchange of information between device and platform, LwM2M uses a standardized data model that is independent of the respective device manufacturer. The model is hierarchically divided into three object levels: Object, Object Instance and Resource. Each object is assigned a unique ID, which is then combined to form a path and a CoAP URL.

 

Lightweight M2M is the modern answer to MQTT, which has outgrown its initial usefulness. However, it is not yet fully supported by the main IoT cloud platforms such as AWS or Azure. Unlike MQTT, which is all about messaging, LwM2M can do more:

 

  1. secure bootstrapping: the mechanism to connect a device to the management platform securely and to manage all necessary keys and certificates.
  2. remote maintenance: the ability to remotely configure a device or perform certain functions.
  3. firmware update: the execution of a secure firmware update over the network (over-the-air update) to provide the device with new functions or to correct functional errors.
  4. fault management: enabling the device to report malfunctions.
  5. reporting: enabling the device to report status changes and query current configuration settings.

 

You can think of LwM2M somewhat like a web browser that enables additional value-added services from the pure HTTP transport protocol. CoAP, the communication foundation of LwM2M, is not that far from the Hypertext Transfer Protocol (HTTP).

In the third a part of our blog series about Power Saving in LPWAN, you will learn how the use of lean protocols affect energy consumption on a real life example.