Device to Cloud Getting Started Onboard Lwm2m Devices Step by step

Introduction


This chapter describes how you can onboard your LwM2M device to D2C.

To onboard a LwM2M device to D2C perform the following steps:

  1. Register the device in the device inventory and LwM2M server of D2C
  2. Configure your LwM2M device for D2C
  3. Verify if your LwM2M device can connect to the LwM2M server of D2C

The second step is performed on your LwM2M device and depends heavily on the type of device and it’s manufacturer. The way to configure the LwM2M settings on devices, such as server name, server ports, or LwM2M registration interval is different for each manufacturer. Some manufacturers provide a smartphone app for their devices, allowing configuration using NFC. Other manufacturers require transferring a configuration file from a local computer to the device via a serial interface.

To guide you in configuring various, commercially available LwM2M devices for D2C, we have included descriptions for different devices in the section Configure LwM2M device for D2C .

👉 Future version of D2C: support of L2M2M bootstrapping service.

Register LwM2M device with D2C


As described above, a LwM2M device to be integrated with D2C must be registered in the device inventory and the LwM2M server of D2C. The interactive steps required for this registration using the D2C web application are outlined below.

Step 1:
Open D2C service in IoT Hub


To register a new LwM2M device with D2C, log in to the IoT Hub at https://hub.iot.telekom.com and navigate to the D2C service. To do so, you can either use the tile Data Provisioning on the landing page of the IoT Hub, or navigate to https://hub.iot.telekom.com/d2c/en with your browser.

â„šī¸ INFO
If your D2C tenant is not automatically selected, select it with the Tenant button. You can find it at the top right corner of the D2C window.

Step 2:
Open the Add LwM2M device dialog and define device details


In the Overview tab of the D2C web application, click the Add device button. A list of supported IoT procols drops down. Click on LwM2M to open the Add LwM2M device dialog.

Overview tab of D2C web application

Overview tab of D2C web application

Add LwM2M device dialog

Add LwM2M device dialog

The following information is required for a LwM2M device as a minimum:

FieldDescription
Device IDThe unique identifier used in the LwM2M registration process of the device. Typically, this is the device’s IMEI or serial number.
Possible characters are: A-Z, a-z, 0-9, -, _
PSK IDFor device security the id of the pre shared key (PSK) for the DTLS layer. Normally you can use the Device ID above as PSK ID.
PSK Secret (base64)For device security the secret of the PSK for the DTLS layer. Make sure the key is encoded as a base64 string.

â„šī¸
For many devices, the PSK secret is a binary value and the manufacture provides it as hex string to you. Since D2C requires the PSK secret as a base64 encoded string you can convert the binary secret from hex encoding to base64 encoding with:
echo "<hex string>" | xxd -r -p | base64
All other input fields which are described below are optional and can be ignored for the time being.

For the IoT protocol LwM2M, the optional fields can be divided into the User-Defined and Device-Defined fields. You can modify the User-Defined fields using the D2C web application or the D2C API anytime. The Device-Defined fields, however, are provided by the device through the LwM2M protocol and are updated every time the device sends the LwM2M object 3 (device) to the LwM2M server of D2C. This means that even if you set values for the Device-Defined fields during the initial creation of the LwM2M device, these values will be overwritten during the next communication between the device and the LwM2M server of D2C.

User-Defined device fieldDescription
Device nameCustom name or identifier of the device which helps the user work with the devices. Device name doesn’t need to be unique.
Device propertiesAny number of key/value pairs to characterize or classify the device.
Uplink message propertiesAny number of key/value pairs which are sent along with every uplink message to the registered application.
Groups.List of Device Groups the device is assigned to. Device Groups link a device to one or more applications. Uplink messages of a device are forwarded to the applications which are assigned to the same Device Group.
Device-Defined device fieldDescriptionLwM2M source resource
ManufacturerManufacturer of the device/3/0/0
ModelModel of the device/3/0/1
Device typeType of the device/3/0/17
Hardware versionHardware version of the device/3/0/18
Firmware versionFirmware version of the device/3/0/3
Software versionSoftware version of the device/3/0/19
LocationLocation of the device according to scheme of RFC 5870 https://en.wikipedia.org/wiki/Geo_URI_scheme
Sample: “geo:52.5162,13.3777”
latitude: /6/0/0, longitude: /6/0/1

Step 3:
Confirm creation of LwM2M device


After you have entered at least the Device ID, the PSK ID, and the PSK Secret, you can click the Add device button located at the bottom right of the Add LwM2M device dialog. If there are no input errors, a positive confirmation window will be displayed, which you can dismiss in the top right corner (see below).

Confirmation that the creation of the LwM2M device has been successfully initiated

Device to Cloud Architecture
â„šī¸
The positive feedback from the Add LwM2M device dialog indicates that the creation of the new device has been successfully initiated. The creation of the device object itself is performed asynchronously by the D2C system in the background, as various distributed operations need to be executed on different backend systems depending on the IoT protocol.

Once you have closed the confirmation window, you can change to the Devices tab in the home screen of D2C web application, and see your newly created LwM2M device (see figure below).

Devices tab with list of devices

Device to Cloud Architecture
🎉🚀🙌🤩✨ CONGRATULATIONS
You have completed the first step. Your LwM2M device has now been registered in both the device inventory and the LwM2M server, and you can proceed with the next step to configure your LwM2M device for D2C.
## Configure LwM2M device for D2C --- ### D2C configuration parameters After successfully registering your LwM2M device in **D2C**, the next step is to configure your device so that it can communicate with the LwM2M server of **D2C**.

The way your device is configured depends on its manufacturer. Each manufacturer has its own approach to configuring the basic communication parameters of IoT devices. Some manufacturers provide additional smartphone apps available in the Google Play Store or Apple App Store, which allow IoT devices to be configured via NFC. Other manufacturers require a configuration file to be uploaded to the device via a serial interface. In the latter case, the format of the configuration file is manufacturer-specific.

Regardless of the method you have to use, you will need to set the following D2C-specific parameters to connect to the LwM2M server.

Parameter nameParameter ValueDescription
DTLS URI of LwM2M serverlwm2m.scs.iot.telekom.com:5684The DTLS encrypted coap interface of LwM2M server.
Sample: coaps://lwm2m.scs.iot.telekom.com:5684
PLMN IDe.g. 26201 for Telekom in GermanyPublic Land Mobile Network id of the mobile operator.
For some devices it is not required since they read the info automatically from the SIM card.
See Network Roaming Info for PLMN IDs of other mobile operators and other countries.
Frequency Bande.g. 8 for NB-IoT of Telekom in Germany
e.g. 20,3 for LTE-M of Telekom in Germany
Frequency band of the NB-IoT or LTE-M network the device shall use. The frequency band is specific for every mobile operator in every country.
For some devices, it is not required, since they read the info automatically from the SIM card.
See Network Roaming Info for frequency bands of other mobile operators and other countries.
APNe.g. internet.m2mportal.de for TelekomName of the Access Point through which the device can access the mobile network.
For some devices, it is not required, since they read the info automatically from the SIM card.

Device-specific D2C configuration

As mentioned above, the configuration of LwM2M devices varies greatly depending on the manufacturer. For this reason, it is not possible to provide a general description of device configuration in a Get Started guide like this. To still support you in setting up an NB-IoT/LwM2M device, we have provided detailed configuration examples for devices from some manufacturers.

DeviceDescription
adeunis SERENITYNB-IoT LwM2M CO2 and VOC sensor from adeunis .

Verify connection beween LwM2M device and D2C


In the previous sections, you have registered your LwM2M device in D2C and configured it to connect to the LwM2M server of D2C. The next step is to verify whether your device can actually connect to D2C.

Typically, your device should automatically connect to the mobile network after being powered on and initiate the so-called LwM2M Client Registration Process with the LwM2M server of D2C. During these processes, most IoT devices indicate errors by blinking red LEDs and success by blinking green LEDs.

The LwM2M Client Registration Process results in a registration message being received as an Uplink Message by D2C, which is displayed with its timestamp in the D2C web application (see image).

D2C GUI with list of devices and the timestamp of the last received message

D2C GUI with list of devices and the timestamp of the last received message
----