Crash course in LwM2M

In this course you will learn about:

What is LwM2M designed for?

Lightweight M2M (LwM2M) is a standard created by OMA SpecWorks that specifies device management and service enablement mechanisms designed mainly for devices that have limited processing and storage capabilities (commonly referred to as resource constrained devices). The technology functions very well over potentially unstable and low bandwidth networks such as cellular or sensor networks as well as low link consumption and LPWA radio networks.

How does it work?

In LwM2M, the information exchange occurs between the Server and the Client (which is located on a device).

There are 4 interfaces governing the communication:

  • Bootstrap
  • Client Registration
  • Device Management and Service Enablement
  • Information Reporting

The Bootstrap interface is used to provision the Client with information needed to “register” with the Server. Once the Client has been provisioned, it can then perform the registration via the second interface (Client Registration). Once the Client is registered, the last two interfaces can be used. The Device Management & Service Enablement Interface is used to access Client’s resources with simple operations such as “Write”, “Delete”, “Execute” and the like.

Finally the last interface – Information Reporting is used by a Server to receive notifications when the value of a specified resource has been changed. This can be used to pro-actively monitor the values of certain parameters, adjusting the thresholds to fit each specific use case, per device and in bulk.

How is the object model defined?

Using simple resource constrained devices (which could even be 8-bit systems with very few kilobytes of ROM and RAM) requires also a simple data model. The data model for LwM2M consists of resources which can be grouped into objects. To be more specific, an LwM2M device supports one or more object types. An object can have object instances, and every object type has its own list of resources. Resources can be defined to be certain data types, for instance string, integer, Boolean, float. Thanks to the data model in LwM2M being very well defined, interoperability is ensured, even in multi-protocol and multi-vendor, complex IoT environments.

How is CoAP related to LwM2M?

As mentioned before, LwM2M is designed to consume as little bandwidth as it can. To make this possible, it uses the Constrained Application Protocol (CoAP), (which works in a similar way as the HTTP protocol but is especially designed for resource constrained devices) that helps LwM2M devices to easily communicate with the web. One of its biggest merits that makes it especially suitable for LwM2M is the fact that it supports UDP (User Datagram Protocol) as a transport layer protocol which ensures effective battery consumption for devices. UDP has a big advantage over TCP (used in other M2M protocols) in regards to the speed of packet transmission. This is especially useful for any use cases involving mobile terminals and wireless access.

How is interoperability enabled?

Although LwM2M comes with a few already defined objects and resources, it is not enough to provide structured data models which would allow efficient communication over protocols such as CoAP. Responding to these needs is the IPSO Smart Objects project (now also part of OMA SpecWorks) that aims to ensure the interoperability on the application layer by creating and providing a common design pattern of objects based on LwM2M. The difference between the object model proposed by LwM2M Enabler is that IPSO Smart Objects are designed to be reused and easily adjusted to new use cases.

Furthermore, there is also a possibility of defining your own objects with a special editor provided by OMA and register them with OMNA (Open Mobile Naming Authority). The objects will then be reviewed by individual members of OMA and added to the registry (if they pass the evaluation).

Is there any backup communication channel?

Apart from UDP, LwM2M also supports SMS binding. There are several modes including modes when the Client is reachable only via UDP, only via SMS, or both UDP and SMS. The flow of the communication is pretty straightforward: if the Server sends request via UDP the Client responds via UDP, if the Server sends request via SMS the Client responds via SMS. What is also worth mentioning is the Queue Mode. This mode is particularly useful when the Client (device) is not reachable at all times (be it due to lossy network or just to minimize the power consumption). When the Queue Mode is supported, the Server is obligated to queue all requests, and send them only when the Client is reachable.

Is LwM2M secure?

Yes, it is.

The security is based on CoAP and utilizes DTLS (Datagram Transport Layer Security) as its main security mechanism. Along with UDP and SMS transport channel bindings, DTLS implements authentication, confidentiality and data integrity between the Server and the Client.

There are 3 security modes:

  • certificates,
  • raw public keys,
  • pre-shared keys.

The Client needs to have credentials and the configuration information obtained during the bootstrapping process. Once the bootstrap is done, the server authenticates the Client, and thus the Client can make use of all the security features supported by LwM2M.

What is the difference between LwM2M and MQTT?

The distinction lies in the protocol level. In the layering scheme of the protocol stack, the MQTT ranks lower than LwM2M. Therefore, the comparison should be made between CoAP (rather than LwM2M) and MQTT.

As far as these two are concerned, the difference is found in communication methods: CoAP provides communication based on requests and responses, whereas MQTT relies on publish/subscribe messaging system. It is worth noting that CoAP requires less link consumption compared to MQTT, the reason being that MQTT uses TCP as a transport binding, while CoAP uses UDP.

What are the benefits of using LwM2M?

The Lightweight Machine-to-Machine standard is truly lightweight. It allows to manage devices that have very little power over really low bandwidth networks, while being itself a standard with a very simple and not confusing stack of technology. The devices that LwM2M is designed to manage include sensors, microcontrollers, actuators etc. which can sometimes be installed in a place that is hard to reach. It does not change the fact that such devices are actually on the web and DO need to be managed, secured, updated, monitored etc.

To sum it up, LwM2M responds to these needs by offering:

  • a simple but well-thought-out and well-designed stack of technology
  • ability to manage devices with very little power over really low bandwidth networks
  • very little bandwidth consumption with very light payloads
  • great security based on DTLS
  • enhanced interoperability thanks to a clearly defined data model
  • device and network flexibility and applicability to rapidly changing needs of the IoT market
  • possibility for the IoT market to move into sectors where devices need to be of low cost, low power, limited network or battery lifetime etc.
  • time-to-market improvement - LwM2M is ready to use as a plug-and-play solution
  • open source LwM2M clients and SDKs are available – free to download and use

This website uses cookies. By continuing to use this website you are giving consent to cookies being used.