posted: April 09, 2019 

Efficient transport of telemetry data in IoT with the LwM2M protocol

Efficient Transport of Telemetry Data in IoT with the LwM2M Protocol

When you think about the Internet of Things, you may imagine many very different scenarios:

  • automated farms that start irrigation process in perfect moment,
  • smart buildings with precise cooling and heating systems,
  • connected cars sending information to traffic management systems, optimizing transport in real time.

All cases require us to gather data like temperature, humidity, location and speed from numerous sensors deployed in our vehicles, buildings and city streets. Those devices must be energy-efficient to operate on batteries and cheap, because we need a lot of them. Such devices, called constrained, have very little processing power and communicate over low bandwidth, high latency radio interface like Narrowband IoT (NB-IoT). On the other side, we deploy powerful servers, that must process and store data from millions of sensors. Both sides have completely different requirements and architecture, but need to communicate using one protocol that’s simple to implement for IoT devices, compact to transport and easy to process in large amounts.

Where IoT can be used?

This issue caught IETF attention and new data representation format was created. Sensor Measurements Lists (SenML) defined in RFC 8428 describes a format easy to encode without putting much stress on constrained device CPU. On the other hand, format takes into account parsing of huge amounts of measurements by data consumers, enabling large scale deployments. SenML is meant to be carried in HTTP and CoAP protocols, and especially the latter is interesting with regard to IoT applications and limited bandwidth offered by radio interfaces like LoRaWAN, SigFox, LTE Cat-M or NB-IoT.

Let’s consider an electricity meter that sends measurements in regular intervals to enable pricing based on demand or time of the day. Also, electricity producers need historical data to plan grid upgrades and plan electricity production.

The meter makes first measurements each full hour and sends it to the cloud in a form of JSON payload:






Each measurement contains the following fields:

  • n – name, unique device (meter) identifier, in our example we use URN as proposed in Uniform Resource Names for Device Identifiers draft
  • u – unit, measurements unit – kWh
  • t – time of measurements, for values lower than 2^28 (268 435 456) represents time in relation to current time, zero being now. For values higher than or equal 2^28, time is specified as absolute time in POSIX time.
  • v – measurements value

There is quite a lot of repetitive data in meter message, for example device URN is sent in each record. To make it more efficient, SenML defines so-called base fields, that are sent only in the first record prepended (for strings) or added (for numbers) to values in the next records. An example of such base field is Base Name (bn), that is prepended to names. In our example, usage of Base Name will result in this message:






Name field would contain an empty string, so it has been omitted. If we use more base fields our message will be even smaller:






SenML also supports messages from devices that do not have time source and can only send information about relative time. In such a case, message sent from our meter would look like that:






The system which receives a message with zero in time field must be able to determine when exactly that measurement occured, for example considering typical transmission delay.

SenML could also be used in other direction, to send instruction from a server to a smart device. Imagine a connected thermostat that needs to be set on different levels depending on time of the day. The example below will create several entries in device memory:








All presented examples use JSON representation, but SenML also supports CBOR, XML and EXI.

To further strengthen SenML interoperability, Internet Assigned Numbers Authority (IANA) has created registry of SenML labels and units. This enables telemetry collection systems to understand measurements sent by any sensor, without prior integration.

First full version of RFC got introduced fairly recently (August 2018) but SenML has been developed for a long time and it has been recognized as a preferred way of transporting measurements data in several applications. Current version of LwM2M 1.1 defines two additional media types:

Data FormatIANA Media TypeNumeric Content-Formats[CoAP]
SenML JSONapplication/senml+json110
SenML CBORapplication/senml+cbor112

LwM2M 1.1 also introduces new “Send” operation, that works as an upgrade for the previous “Notify” operation and together with SenML creates perfect setup for telemetry services. “Notify” required more complex server and client implementations, where a server has to subscribe to resource measurements with certain settings and a client has to handle subscription fulfillment, taking those settings into account. Also, both client and server have to store subscription ID in case of the restart of a device. “Send” operation enables unsolicited notifications without explicit server request, simplifying the whole process.

AVSystem’s Coiote IoT Device Management platform provides a lot of mechanisms that allow easy access to data collected from sensors as well as management of the sensors involved in the whole process of an IoT deployment.

Achieve IoT project success faster with our expertise.
Speed up your time to market using LwM2M standardization and pre-built integrations for hardware and the cloud.

IoT data collected by IoT sensors

With the latest release of LwM2M 1.1 version, this massively scaling, flexible platform has been further extended to answer even the most demanding needs of the industry. Features such as CoAP over TCP, Send operation or SenML enhance the telemetry capabilities of LwM2M and make the standard even more appealing to be used as a part of IoT deployments for both telcos and enterprises. These new mechanisms combined with others such as Non-IP Data Delivery give LwM2M the leading edge over other protocols, which either offer only device management, application management or telemetry. Thus, Coiote IoT Device Management platform together with LwM2M Anjay SDK that serves as an LwM2M Client create a duo difficult to beat in terms of IoT device management & telemetry offering. As Anjay also supports LwM2M 1.1 both products could be used in efficient telemetry ecosystem based on SenML.


Tomasz Mańka
Senior Presales Engineer

Recommended posts

back icon

This website is using cookies

We use cookies for statistical and marketing purposes and to improve the quality of our services. The information stored in cookies usually allow the identification of a specific device or user’s browser, so they may contain personal data. By continuing to use this website with setting the web browser in a way which alows the use of cookies by the website means your’s consent to the use of cookies. You can change your web browser settings at any time.
More information on the processing of personal data and cookies you can find in our Privacy and cookies policy.