Teach you how to connect ESP32 to Alibaba Cloud IoT platform

The mqtt function of esp32 has been introduced in the previous article. This article will introduce how to access the Alibaba Cloud platform of several major Internet platforms.

Reference article:

(5 messages) ESP32 basic application ESP32 and Alibaba Cloud IoT platform realize data mutual transmission (MQTT protocol)_esp32 Alibaba Cloud_while(1)'s Blog-CSDN Blog

It is developed by idf 5.0 of ESP32. According to the above articles and online information, it is necessary to register the device in the background and then connect to the communication when the device is connected to the Alibaba Cloud platform.

First, register the device in the background:

①Select the area and find the public instance

②Enter the public instance, click on the product, and create a product

③ Fill in some necessary information

④Click to confirm the creation is complete

At this point, the product is created and the device is created

After the product is created, it will appear in the product list, click View to enter the details page

View the connection parameters of the device

It can be seen that the device connection parameters are

#define   mqttHostUrl        xxx      

#define   port        xxx

#define   clientId   xxx

#define   username    xxx

#define   passwd    xxx

At this point, we will configure the demo of esp32. If you don’t understand the sixth configuration, please check my previous article.

Since then, the Alibaba Cloud platform has been connected.

Alibaba Cloud sends another message to the device

Since then, communication has been normal.

But there are many small partners who may not receive the news in the last step. Why? We need to go back to the code to find the reason, and we will find that we need to subscribe to the topic to receive successfully

How about subscribing and publishing messages?

First, we find the Alibaba Cloud platform to set up

For the design in the program

Since then, ESP32 can communicate with Alibaba Cloud normally, and you can use Alibaba Cloud IoT platform to debug your own equipment according to your own design needs.

Guess you like

Origin blog.csdn.net/m0_45068979/article/details/131702282