AT Application: https://github.com/espressif/esp-at
AT+MQTT Documentation: https://docs.espressif.com/projects/esp-at/en/latest/
AT+MQTT Integration into AWS IoT
This article explains how to connect devices to AWS IoT using AT commands.
AT+MQTTcommand description AT+MQTT Command Set
Preparation
Please refer to AWS IoT Developer Guide and obtain:
xxx.cert.pem(device certificate)xxx.private.key(private key)AmazonRootCA1.pem(root CA certificate)xxx-ats.iot.us-east-2.amazonaws.com(endpoint)
Suggestion:
- All devices must have a device certificate, private key, and root CA certificate installed in order to communicate with
AWS IoT. For details, please refer to AWS IoT Developer Guide - Select
Ohioas your region - Note how to activate certificates described in the developer guide
- Read
AWSIoT Developer Guide repeatedly to deeper understanding
MQTT Integration into AWS IoT based on Two-Way Authentication
Replace Certificate
AmazonRootCA1.pemreplacescomponents/customized_partitions/raw_data/mqtt_ca/mqtt_ca.crtxxx.cert.pemreplacescomponents/customized_partitions/raw_data/mqtt_cert/mqtt_client.crtxxx.private.keyreplacescomponents/customized_partitions/raw_data/mqtt_key/mqtt_client.key
Compile Flashing AT Firmware
Please refer to Compiling ESP-AT Project to recompile and flash AT firmware
Integrate AT+MQTT into AWS IoT Commands
AT+CWMODE=1
AT+CWJAP="ssid","password"
AT+CIPSNTPCFG=1,8,"ntp1.aliyun.com"
AT+CIPSNTPTIME?
AT+MQTTUSERCFG=0,4,"esp32-at","espressif","1234567890",0,0,""
AT+MQTTCONN=0,"xxx-ats.iot.us-east-2.amazonaws.com",8883,1
AT+MQTTSUB=0,"esp32/at",1
AT+MQTTPUB=0,"esp32/at","hello aws!",1,0
Notes:
- If the second parameter of
AT+MQTTUSERCFGis4, it is authenticated by both sides and cannot be changed. - In
AT+MQTTCONN=0,"<endpoint>",8883,1,endpointis theendpointin preparation phase, and port8883cannot be changed - Other
AT+MQTTparameters are user-definable
Example LOG
LOG for normal interaction is as follows:
LOGonESP32side

LOGonAWSside


本文详细介绍了如何使用ESP32的AT+MQTT命令集与AWS IoT进行集成,包括设备证书、私钥和根CA证书的准备,以及基于双向认证的MQTT集成步骤。
1310

被折叠的 条评论
为什么被折叠?



