Projects in the industrial and consumer IoT environment are exciting and diverse. Many disciplines are required simultaneously: hardware and antenna design, industrialisation, communication, low power, visualisation and control, cloud integration, firmware development and updates and much more. The technology mix is constantly growing and many standards and alliances are fighting for market share. LwM2M - the Lightweight Machine-to-Machine protocol - is a protocol that is not yet so well known.
If a project grows beyond the prototype phase, questions arise in an IoT project that can have a significant impact on the overall design and costs.
Fortunately, there is no need to reinvent the wheel. LwM2M, a standard for M2M communication, provides answers to these questions and much more.
Machine-to-Machine - M2M
Machine-to-machine, or M2M for short, is an automated exchange of information between different end devices. Sensors and actuators communicate with a server (control centre/SCADA, cloud, database, workflow engine) via various access networks (such as mobile radio, Bluetooth, WiFi, 802.15.4) using the Internet.
M2M communication is a point-to-point connection. A temperature sensor sends its data to a database via the mobile network and thus communicates directly with the database server. However, IoT communication can also function directly in a network. For example, a luminaire with an integrated motion sensor can send a control command to luminaires in the same luminaire group and switch them on. M2M is the key topic in the industrial environment in particular. Sophisticated processes and machine learning and visualisations run on a central infrastructure to which IoT devices exchange data via M2M.
The Lightweight M2M Protokoll - LwM2M
LwM2M is an M2M protocol focussing on IoT devices: Secure, economical data transmission, low power and fault tolerance are key design requirements. Many of the current wireless modules (WiFi / LTE / NB-IoT / Cat-M / ...) already support LwM2M. This support means that a project with industrial requirements can be implemented very quickly. From the firmware developer's perspective, the integration of LwM2M is often reduced to a few lines of AT commands.
LwM2M uses UDP and COAP as transport protocols. The data is encrypted using DTLS. The LwM2M standard defines resources that are addressed in the style of an Internet web address (REST) and operators (Read / Write / Execute / Observe / ...) to handle these resources.
Example:
The resources are addressed via the object ID / resource ID. In the first two examples, the object with ID 3 (/3/x/x), the "Device" object, was addressed. If an IoT device registers on the server, it reports which objects it supports. The LwM2M standard defines many predefined objects. These predefined objects allow a tracking IoT device to report to the server with object 6, for example, and the server knows that this is tracking data and in which format it is being sent.
Are there alternatives?
MQTT is certainly the best-known representative for IoT projects and M2M communication and is supported by many cloud platforms. However, MQTT only defines one communication channel and does not solve any of the questions posed at the beginning. LwM2M allows much greater flexibility thanks to its active control. It is possible to decide in real time when the server wants which data from which IoT device. For example, the behaviour of an IoT device can be adjusted at any time, even if it has been in operation for a long time.
Economical data transmission
Economical data transmission is usually a key issue in IoT projects. Every byte that has to be transferred due to protocol overhead is a drain on the battery and is usually directly proportional to the cost of the amount of data transferred. LwM2M has therefore designed the entire protocol definition with this goal in mind.