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
Procedure
- Obtain Link SDK for C.
- Log on to the IoT Platform console.
- 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.
- Log on to the Linux virtual machine (VM).
- Upload Link SDK for C that is downloaded in Step 1 and use the
unzip
command to decompress the file.
- 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.
Note
- 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.
- In the SDK root directory, run the
make
command to compile the sample code.make distclean
make
The generated data-model-basic-demo
file is stored in the ./output directory.
- Run the sample code.
./output/data-model-basic-demo
- View the online status and running status of the device.
- In the left-side navigation pane, choose . 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.

- 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.
