esp-at application: AT+MQTT docking with Amazon cloud

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+MQTT command 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:

  1. 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
  2. Select Ohio as your region
  3. Note how to activate certificates described in the developer guide
  4. Read AWS IoT Developer Guide repeatedly to deeper understanding

MQTT Integration into AWS IoT based on Two-Way Authentication

Replace Certificate
  • AmazonRootCA1.pem replaces components/customized_partitions/raw_data/mqtt_ca/mqtt_ca.crt
  • xxx.cert.pem replaces components/customized_partitions/raw_data/mqtt_cert/mqtt_client.crt
  • xxx.private.key replaces components/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:

  1. If the second parameter of AT+MQTTUSERCFG is 4, it is authenticated by both sides and cannot be changed.
  2. In AT+MQTTCONN=0,"<endpoint>",8883,1, endpoint is the endpoint in preparation phase, and port 8883 cannot be changed
  3. Other AT+MQTT parameters are user-definable

Example LOG

LOG for normal interaction is as follows:

  • LOG on ESP32 side
    Add description here
  • LOG on AWS side
    Add description here
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值