Alibaba Cloud for IoT connection

Introduction

The Internet of Things (IOT) market will become larger and larger, and it is now more popular in all walks of life, such as factories and household appliances. At present, the major IoT platforms include Xiaomi, Alibaba, eWelink, Tuya, etc. Ali's Feiyan platform is more friendly and convenient for cloud access to products, and Alios can quickly build mass-produced products.

Actual combat

This example uses XR872 as the hardware basis.

Set up Alios environment

Set up the environment

You can port LinkkitSDK without using Alios

Alibaba Cloud creates products

Login URL

1. Click to activate for freeInsert picture description here

2. Create a new project

Insert picture description here

3. Create products and define functional attributes (used in mqtt topic settings and sending data)

Insert picture description here

4. Complete all definitions of cloud products

 在模组选择流程如果没找到目标芯片或者模组可以随意选择。
 
 设备调试流程中保存一组四元组,接下来的设备端开发用得到。
 
 人机交互流程中,如果不自己开发APP,一定要选择使用公版APP控制产品,接下来就是配网等相关流程的选择,我们把一键配网放在第一个就好了。

Device development

The template routine is used here: app/example/linkkitapp

First set the
application_start function in the quadruple app_entry.c and add
set_devinfo(PS,PK,DN,DS);

Next, modify the interaction control with the cloud
. The user_property_set_event_handler function in linkkit_example_solo.c is the data callback function issued by the cloud, and the JSON format data issued by the cloud is processed here.
E.g:

 cJSON *root = NULL,*item_number_p = NULL;
  root = cJSON_Parse(request);
 item_number_p = cJSON_GetObjectItem(root, "PowerSwitch_1");
 int control_cmd = item_number_p - >valueint;//此时就获得了云端下发的控制状态,其他控制逻辑可根据此展开

Please see the chapter on setting up the environment for reporting.

Linkage display

Download the cloud smart APP, scan the QR code of the distribution network in the human-computer interaction process just set up, enter the password correctly, and then use the serial port to send awss_active (plus carriage return and line feed) to the chip, then the chip enters the network configuration mode, and click on the phone to start configuration After the network is successfully configured, the APP will automatically jump to the product control interface, and the product can be controlled in the cloud.
Insert picture description here

Guess you like

Origin blog.csdn.net/tulongyongshi/article/details/106734500