LwM2M — Lightweight M2M standard — protocol and its benefits
One of the first uses of machine-to-machine communication traces back to 1845, when a simple data-transmission circuit enabled the tsar to go live and transmit telemetry data from his Winter Palace to army headquarters. From these times onwards, the idea of connecting multiple devices and allowing them to communicate has been steadily evolving not only in matters of technological development, but also concept-wise. With wired connectivity gradually giving way to the rapidly spreading wireless communication standards throughout the 21st century, M2M gave rise to the concept of IoT: an overarching phenomenon that envisions systems of connected machines, smart objects, and humans to offer virtually endless opportunities for data transmission and integration, management of devices, and service enablement.
LwM2M protocol — why is it needed?
According to Statista, the global number of connected IoT devices will grow from 23 billion in 2018 to a forecasted mind-boggling 75 billion by the end of 2025. Shaping the way we view the future of technology, this grand and ever-expanding vision is in constant need of dedicated solutions for its proper and innovative deployment. In a world of disparate device standards, there is an ever stronger demand for quicker, easier and more effective communication while using less power.
As an answer to this market need, in 2012 engineers at Open Mobile Alliance SpecWorks (OMA) started working on Lightweight M2M, a communication protocol designed especially for remote device management and telemetry within the Internet of Things as well as in other M2M applications. Acting as the successor to OMA device management standard, Lightweight M2M was designed intrinsically to reduce power and data consumption, thus recognising and responding to the demands of the growing M2M market for dedicated solutions for low-power devices with limited processing and storage capabilities (which are also known by the name of resource-constrained devices).
The Lightweight M2M specification also describes many typical IoT device management functions, such as remote device actions, firmware and software updates (FOTA & SOTA), connectivity monitoring and management including cellular management and provisioning.
Unlike any other Internet of Things protocol on the market, the architecture of LwM2M supports four logical interfaces which help to standardize the way the actual device management and telemetry is done:
- Bootstrapping interface — this interface enables headless device management. This basically means that it is possible to configure a device to provide the right service without the need of preconfiguring it at the factory, which significantly reduces cost and optimises time-to-market for the product or service.
- Client registration interface — informs server about the client’s ‘existence’ and supported functionality. Also, it enables over-the-air firmware and software updates.
- Device management and service enablement interface — LwM2M allows the provider to access object instances and resources, which enables him to change device settings and parameters.
- Information reporting interface — thanks to publish/subscribe interaction, the user is able to obtain error reports from devices when the service no longer works properly as well as send queries about device status.
LwM2M as industry standard
With the constraints of M2M devices in mind, OMA SpecWorks developed the LwM2M standard in a response to the growing needs of vendors and service providers for a non-complex low-cost device management and service enablement protocol that would embrace cutting-edge architectural principles and function well over wireless connections. As an industry standard, Lightweight M2M has been especially designed to overcome some major limitations faced by the IoT scene, such as the management of low-power devices, security challenges and cross-standard interoperability.
As member of Open Mobile Alliance SpecWorks, AVSystem has been actively participating in the creation of the LwM2M standard and has been one of the first to offer a comprehensive plug-and-play solution based on the Lightweight M2M protocol. AVSystem’s Coiote IoT Device Management platform that works as an LwM2M server takes advantage of the key functionalities of the OMA LwM2M to provide a leading solution suitable virtually for the whole of the IoT market, including, but not limited to, such devices as M2M gateways, sensors, controllers, meters, tracking devices, security appliances which support the Lightweight M2M protocol. To complement this product, AVSystem also created Anjay — an LwM2M client, which is an open-source software that allows for easy implementation of the support for LwM2M protocol in any device.
LwM2M makes use of a light and compact protocol, which enables it to function very well over potentially unstable and low bandwidth networks such as cellular or sensor networks. Its lightweight design however, does not change the fact that the protocol still works very efficiently on bigger IoT assets such as business routers or gateways. With an enormous range of possible applications, Lightweight M2M finds its use in such fields as:
- remote controlling,
- automotive industry,
Advantages of LwM2M over other M2M protocols
Apart from being a simple and efficient protocol for the management of low-power devices, LwM2M has a number of features that help it to get ahead of its competition.
Unlike traditional M2M solutions in which a device usually needs to keep up multiple stacks of technologies, protocols and security services, the Lightweight M2M model allows users to have one stack of technology for device management not only on the level of the device itself but also on the application level. What is more, LwM2M offers cross-vendor and cross-platform interoperability, which makes it ideal for service providers who want to avoid vendor lock-in. Combining DTLS, CoAP, Block, Observe, SenML LwM2M and Resource Directory, utilises them to form a device-server interface with a defined object structure. With all the above advantages put together, Lightweight M2M is able to provide perfect time to market as it is available for instant deployment.
As mentioned above, LwM2M, unlike many industry-proven protocols (such as MQTT), has a well-defined data model. The idea is very simple: a tree with maximum depth of 4, consisting of, respectively, Objects, Object Instances, Resources and Resource Instances. Objects can have Object Instances, Resources can have Resource Instances and Resources are located in Object Instances.
Resources are probably the most interesting ones, as this is where you directly interact with the device. If you want to, say, read the temperature value of a given device, you can do it by issuing a READ operation at a Resource level. The Resource informing about the temperature of the device, along with (potentially) some other Resources (informing about e.g. device location, signal strength etc.), can be located in a single Object Instance. So, if you would like to read all the values of the resources in a given Object Instance with only one operation, just execute the READ operation at the Object Instance level. The same logic applies to Object — by issuing a READ operation on the entire Object, you will get results for all Object Instances contained in this Object, all Resources contained in all Object Instances of this Object and so on. As Resources are also defined into certain data types, the information you get, depending on the specifics of the resource can be sent as various data types such as Boolean, integer, float, string and more.
What's more, with the arrival of LwM2M 1.1 version, the standard has been enhanced with numerous features that extend its capabilities. Now the protocol handles not only UDP as its communications protocol, but also TCP, which can be helpful in traversing firewall/NAT restrictions and generally provides a more reliable data transmission (although slower than in the case of UDP). LwM2M 1.1 also added support for Low Power WANs, including 3GPP CIoT & LoRaWAN to its pool. And last but not least, it has further enhanced its already strong telemetry capabilities by supporting JSON using SenML with CBOR serialization.
Another of LwM2M’s strong suits that differentiates it from other M2M protocols available on the market is the way it handles security issues, especially on low-power devices. It is based on the advanced DTLS protocol that supports credentials based on pre-shared keys, raw public keys, or certificates and implements authentication, confidentiality and data integrity between the Server and the Client.
Lastly, the Lightweight M2M protocol offers a well-defined device and data management model structure to enable a number of vendor-agnostic features such as secure device bootstrapping, object or resource access, and device reporting.
To sum things up, the Lightweight M2M protocol offers a flexible, scalable and vendor-agnostic device management with improved time to market which makes it especially suitable for low-power devices with limited processing and storage capabilities. Bearing all that in mind, LwM2M is the best solution to consider for large, complex and long-lived deployments involving cross-platform and cross-standard IoT services.