Alibaba Cloud IoT Platform provides device SDKs that allow devices to connect with the platform. This article describes how to achieve communication between a device and IoT Platform by using the data_model_basic_demo sample code. A street lamp is developed in this example.

Background information

  • In this article, Link SDK for C is used on the Linux operating system. We recommend that you use 64-bit Ubuntu 16.04 to compile the SDK.
  • The following software is required for SDK development and compilation:

    make (version 4.1 or later) and gcc (version 5.4.0 or later)

    Run the following command to install the software:

    sudo apt-get install -y build-essential make gcc


  1. For information about how to obtain Link SDK for C, see SDK Download.
  2. Decompress Link SDK for C and modify the device certificate information in the SDK.
    IoT Platform provides the updated sample code based on this quick start. Click data_model_basic_demo.c to download the latest sample code. Then, go to the \LinkSDK\demos directory, and replace the data_model_basic_demo.c file with the downloaded file.
    Note Parameters:
    • Replace the ${YourProductKey}, ${YourDeviceName}, and ${YourDeviceSecret} variables in the file with the ProductKey, DeviceName, and DeviceSecret that you obtained when you created the device. For more information about how to create a device, see Create a product and a device. The device uses this certificate for authentication and connects to IoT Platform.
    • Replace the ${RegionID} variable in the sample code with the ID of the region where your service resides. You can view the region in the upper-left corner of the IoT Platform console. For more information about valid region IDs, see Regions and zones.
  3. Log on to the Linux virtual machine and run the following command to install the required software:
    sudo apt-get install -y build-essential make gcc
  4. Upload the SDK that was modified in Step 2.
  5. Go to the /LinkSDK SDK root directory and run the make command to compile the sample code.
    make clean

    The generated data-model-basic-demo file is stored in the ./output directory.

  6. Run the sample code.
  7. View the online status and running status of the device.
    • In the left-side navigation pane, choose Devices > Devices. Then, find the device and view the online status. The value Online in the State column indicates that the device is connected to IoT Platform. Power bank cabinet-Device online status
    • Click View in the Actions column to go to the Device Details page. Click the TSL data tab, and then click Status to view the running status of the device.

      In this example, the following operating current is submitted to IoT Platform by using the sample code in the data_model_basic_demo.c.

      Street lamp-TSL data

What to do next

Subscribe to device messages from IoT Platform