https://aws.amazon.com/cn/
1.2 进入AWS IOT 管理->物品,创建单个物品
at固件源码:https://github.com/espressif/esp-at.git
修改其中的makefile内容
export ESP_AT_PROJECT_PLATFORM ?= PLATFORM_ESP32
export ESP_AT_MODULE_NAME ?= WROOM-32
成为
export ESP_AT_PROJECT_PLATFORM ?= PLATFORM_ESP8266
export ESP_AT_MODULE_NAME ?= WROOM-02
证书替换
AmazonRootCA1.pem 替换components/customized_partitions/raw_data/mqtt_ca/mqtt_ca.crt
xxx.cert.pem 替换 components/customized_partitions/raw_data/mqtt_cert/mqtt_client.crt
xx.private.key 替换 components/customized_partitions/raw_data/mqtt_key/mqtt_client.key
3.1连接路由
AT+CWMODE=1
AT+CWJAP="miot_default","123456789x" //填入路由ssid和密码
3.2 配置信息
AT+CIPSNTPCFG=1,8,"ntp1.aliyun.com" //
AT+MQTTUSERCFG=0,4,"esp_test","xxx@aithinker.com","Aithinkerxxx",0,0,""//添加产品ID,亚马逊登录账户和密码
AT+MQTTCONN=0,"a2cmlaa8vbcuj-ats.iot.us-west-2.amazonaws.com",8883,1 //建立MQTT连接
3.3 订阅主题
亚马逊云平台先订阅一个主题esp_test/at
AT+MQTTSUB=0,"esp_test/at",1 //设备订阅主题
亚马逊云平台客户端下发数据:
模组得到回复:
+MQTTSUBRECV:0,"esp_test/at",45,{
"message": "Hello from AWS IoT console"
}
3.4 发布消息
AT+MQTTPUB=0,"esp_test/at","hello aws!",1,0 //设备发布消息
亚马逊云平台客户端收到信息: