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 are 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. Obtain Link SDK for C.
    1. Log on to the IoT Platform console.
    2. In the left-side navigation pane, click Documentation and Tools. Click The Internet of Things Link SDK to go to Link SDK page. Find the SDK and download it.
  2. Log on to the Linux virtual machine (VM).
  3. Upload Link SDK for C that is downloaded in Step 1 and use the unzip command to decompress the file.
  4. Modify the device certificate 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.
    • 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 products and devices. 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.
  5. In the SDK root directory, run the make command to compile the sample code.
    make distclean

    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.Street lamp-TSL data

What to do next

Subscribe to device messages from IoT Platform