Esp8266+Aliyun+STM32 lighting (2)

Table of contents

1 Introduction

2. Alibaba Cloud configuration

2.1 Add device

 2.2 Publishing Devices

 3. Use AT command to configure ESP according to the parameters to make the device go online

1 Introduction

After completing the ESP8266 firmware burning , connect the ESP8266 module to Alibaba Cloud.

2. Alibaba Cloud configuration

2.1 Add device

Click the console in the upper right corner of the home page, as shown in the following figure:

 Then search for the IoT platform, as shown in the figure below:

 Then click Open in the public instance column, as shown in the following figure:

 After the opening is completed, the interface is as shown in the figure below:

 To create a product, the process is shown in the figure below:

 Then customize the product name and select a custom category, as shown in the figure below:

   Click OK to enter the device interface, as shown in the figure below:

 Add devices, as shown in the following figure:

 After adding the device, the schematic diagram is as follows:

 2.2 Publishing Devices

Click the view button in the product, as shown in the figure below:

 Then click Publish, as shown below:

 Confirm all, and then publish, as shown in the following figure:

You can observe that the status changes to Published, as shown in the following figure:

 3. Use AT command to configure ESP according to the parameters to make the device go online

 Send the following commands through the serial port debugging assistant:

AT
OK
ready//上电启动信息

AT+CWMODE=1
OK
AT+CIPSNTPCFG=1,8,"ntp1.aliyun.com"
OK

Then turn on the hotspot through the mobile phone and send it through the following command:

AT+CWJAP="WiFi名","WiFi密码"
WIFI CONNECTED
WIFI GOT IP
OK

Then check the parameters of the Aliyun account, click on the device, view, as shown in the following figure:

 Then click on the MQTT connection parameters to view:

 You can view the user name and password, as shown in the following figure:

 Then enter the following AT commands:

AT+MQTTUSERCFG=0,1,"NULL","用户名","密码",0,0,""

OK

 Then enter the following AT commands:

AT+MQTTCLIENTID=0,"ClienId"//clientId第二个参数注意每个逗号后加分隔符“\”,已踩过坑,例如:t|securemode=3\,signmethod=hmacsha1\,
OK

 Connect domain name:

AT+MQTTCONN=0,"a1Py84SEWWJ.iot-as-mqtt.cn-shanghai.aliyuncs.com",1883,1

 Then refresh the device on the Alibaba Cloud interface, and you can see that the device is online:

 Then execute the subscription command:

AT+MQTTSUB=0,"订阅的主题",1//订阅的主题可在云端设备的“自定义Topic列表”复制进去

OK

Change to the name of the device:

 Send a message:

 

Guess you like

Origin blog.csdn.net/weixin_44597885/article/details/129992619