Building an End-to-End IoT “Thing Model” on Alibaba Cloud

Common IoT solutions include the device, the cloud, and the application. Some solutions also involve big data and AI data analysis. Traditional Internet of Things (IoT) development emphasizes an ordered data transfer. That is, data collected by devices (things) will be sent to the cloud, which will then be sent to the application sequentially. However, with the rapid growth of IoT devices, this approach is not ideal as it is not scalable. Alibaba Cloud introduces a new approach to IoT development called the “Thing Model”. In this model, two ends of the IoT development can run in parallel, significantly saving labor and material costs.

What Is the “Thing Model”?

The “object model” is actually a description of what the device is, what it can do, and what services it can provide. In general, the thing model appears as a “feature” of the device, including at least one property, service or event. Alibaba Cloud IoT Platform’s “Link Platform” and “Link Develop” both integrate the “thing model”. After the developer defines the product’s functionality, the system will automatically generate the “thing model” of the product.

  1. Services: start, open, close, pause;
  2. Events: current status, cleaning and maintenance.

Building a Simple IoT Solution on Alibaba Cloud

A typical IoT solution includes device, cloud, and application. This example uses the Developerkit demoboard with built-in AliOS Things as the device, to upload the three-axis coordinate value of the onboard accelerometer to the cloud, dump the data in Table Store, and finally display it through a visual line chart.

  1. Type: struct
  2. Read/write type: read only

Device Configuration

After operations on the platform are complete, let’s go back to the device development line.

#define PRODUCT_KEY             "a1xxxxxxxxo"
#define DEVICE_NAME "QSxxxxxxxxxxxxxxxxHc"
#define DEVICE_SECRET "O6xxxxxxxxxxxxxxxxxxxxxxxxxxxxEi"
Build complete
Making .gdbinit
firmware upload succeed
netmgr connect SSID PASSWORD
# netmgr connect mywifi mypassword
[330060]<I> Will connect via at cmd: AT+WJAP=mywifi,mypassword
# [330100]<I> AT command AT+WJAP=mywifi,mypassword succeed, rsp:
[337560]<I> AT command AT+WJAPIP? succeed, rsp:
[337580]<I> AT command AT+WMAC? succeed, rsp:

Data Dump

By default, the IoT Platform stores the data uploaded by the device in the public cloud. In actual business scenarios, there is often a need to dump data to a private database. In this case, we need to use the data forwarding function.

items.Accelerometer.value.X, items.Accelerometer.value.Y, items.Accelerometer.value.Z, deviceName() as deviceName, timestamp('yyyy-MM-dd HH:mm:ss') as time

Data Visualization with DataV

We now have a functional IoT system with all data under our control. But if we want to visualize this data in real time, we can integrate Alibaba Cloud DataV. DataV is a data visualization tool launched by Alibaba Cloud. It can help non-professional engineers to easily build professional visual applications through a graphical UI, so that more people can experience the charm of data visualization.

"table_name": "your table name",
"direction": "BACKWARD",
"columns": [],
"range": {
"limit": 30,
"start": {
"deviceName": "your device name",
"time": "2019-01-30 17:12:44"
"end": {
"deviceName": "your device name",
"time": "2018-08-08 17:56:14"


In this article, we have built an end-to-end IoT accelerometer solution using Alibaba Cloud’s suite of IoT products. We first came into contact with the concept of the thing model, and then built two IoT-related platforms of Alibaba Cloud. After that, we learned device application development based on AliOS Things, and then gave some developers a better understanding of how data dump and data visualization are implemented.

Follow me to keep abreast with the latest technology news, industry insights, and developer trends.