Connecting NB-IoT Devices

This section uses the NB-IoT device simulator as an example to describe how to connect devices to the platform using LwM2M over CoAP for data reporting and command delivery.

Prerequisites

Creating a Product

If an LwM2M/CoAP product already exists, skip this step.

  1. Choose Products in the navigation pane and click Create Product in the upper right corner.
  2. Set the parameters as prompted and click Create.

    Set Basic Info

    Resource Space

    The platform automatically allocates the created product to the default resource space. If you want to allocate the product to another resource space, select the resource space from the drop-down list. If a resource space does not exist, create it first.

    Product Name

    Customize the product name. The value can contain letters, numbers, underscores (_), and hyphens (-).

    Protocol

    Select LWM2M over CoAP.

    Data Type

    Select Binary.

    Manufacturer

    Customize the manufacturer name. The value can contain letters, numbers, underscores (_), and hyphens (-).

    Define Product Model

    Product Model

    In this example, we import a product model, rather than using a preset product model. For details, see Uploading a Product Model.

    Industry

    Select the industry to which the product model belongs.

    Device Type

    Customize the device type.

Uploading a Product Model and Codec

To quickly connect an NB-IoT device to the platform, use the product model and codec we provide.

  1. Download coap_profile.zip to obtain the product model.
  2. Select the product created in 1 and click View to access its details.
  3. On the Model Definition tab page, click Import Local Profile to upload the product model file obtained in 1.

  4. Download coap_CIGPlug-in.zip to obtain the codec.
  5. Click the Codec Development tab, select Upload Codec, and deploy the codec obtained in 4 to the platform.

Registering a Device

This topic describes the procedure for registering an NB-IoT device on the IoTDA console.

  1. Choose Devices > All Devices, and click Individual Register in the upper right corner.
  2. Set the parameters as prompted and click OK.

    Parameter

    Description

    Resource Space

    Ensure that the device and the product created in 1 belong to the same resource space.

    Product

    Select the product created in 1.

    Node ID

    This parameter specifies the unique physical identifier of the device. The value can be customized and consists of letters and numbers.

    Device Name

    Customize the device name.

    Authentication Type

    Select Secret.

    Secret

    Customize the device secret. If this parameter is not specified, the platform automatically generates a secret, and the registered NB-IoT device is insecure.

Performing Connection Authentication

  1. Download and decompress the NB-IoT device simulator, and double-click NB-IoTDeviceSimulator_zh.jar to run the simulator. (You are advised to run the simulator in Windows OS. Currently, macOS is not supported.)

    The package contains the following files:

    • NB-IoTDeviceSimulator_en.jar: English simulator
    • Californium.properties: simulator configuration file
    • setting.properties: configuration file for connecting the device simulator to the platform

    The Java running environment is required for this operation. If the Java running environment is unavailable, download and install it.

  2. When a message is displayed requesting you to confirm whether to enable DTLS encrypted transmission, click No if a secret is not entered during device registration, or Yes if a secret is entered.

  3. Enter IP address, VerifyCode, and psk, and click Register Device to bind the simulator to the platform.

    If DTLS encryption transmission is disabled, you do not need to enter a PSK.

    Set the three parameters as follows:
    • IP address: access domain name displayed on the IoTDA console. (You can also use the IP address. You can run the ping [domain name] command to obtain the IP address.)
    • VerifyCode: The node ID set during device registration.
    • PSK: The secret set during device registration.

  4. On the IoTDA console, choose Devices > All Devices and view the device status. If the device is online, the simulator is connected to the platform.

Reporting Data

  1. Simulate data reporting. If the reporting level is 5, enter a hexadecimal code stream 0005 in the NB-IoT device simulator. (00 indicates the message type, and 05 indicates the reporting level.) Then click Send Data.

  2. On the IoTDA console, choose Devices > All Devices, and click View in the row that contains the device to access the device details.
  3. On the device details page, check whether the reporting level is 5.

Delivering Commands

  1. On the IoTDA console, go to the product details page, click the Online Debugging tab, and click Debug in the row that contains the target device.
  2. In the application simulator, select service and command, select the ON command, and click Send.

  3. In the log area, ON is the data delivered by CIG. The simulator displays a message requesting you to respond to the platform. Click Yes.

  4. Check whether the command status is Delivered in the application simulator.