SIM7000G MQTT at Aliyun Publish&Subscribe


Background

Recently I need to setup an enviroment to test SIM7000G. In order to verify the modem stability in terms of hardwares, we will setup a workflow like this:
在这里插入图片描述



STEP1: Go online

AT command configration

MQTT APPLICATION NOTE
SSCOM_DOWNLOAD
在这里插入图片描述

Ger the modem online

I use NB-IoT protocol here, if the setup is LTE-CATM or GPRS, just check the sim7000x AT comnual.

在这里插入图片描述
COMMAND:

AT+CNMP=38//LTE模式

AT+CMNB=2//NB-IoT模式

AT+NBSC=1//打开扰码设置

AT+CSQ//网络信号质量

AT+CGATT?//查询网络是否附着

AT+CPSI?//查询网络注册信息

AT+CGNAPN//查询APN

AT+CSTT="iot.1nce.net"//设置对应的APN(根据自己卡的信息进行设置)

AT+CIICR//激活移动场景

AT+CIICR//获取本地IP地址

AT+CIPSHUT//关闭移动场景

Now we got the device online already



STEP2: Setup the Aliyun IoT

1. Register and log in to Aliyun IoT platform
2. Build a new product
3. Add a new device to the new product
4. Modem conects to the device via MQTT protocol
5. Set the Topic rule in Product page.
6. Publish or Subscribe packets to the topic

Build a new product

在这里插入图片描述

Add a new device to the new product

在这里插入图片描述
在这里插入图片描述

Modem conects to the device via MQTT protocol

COMMAND:


AT+CNACT=1,"iot.1nce.net"//设置APN for MQTT

AT+CNACT?//检查是否连接成功

AT+SMCONF="URL",iot-06z00a18ae93m7j.mqtt.iothub.aliyuncs.com,1883//设置mqtt_url

AT+SMCONF="KEEPTIME",60//保持时间60s

AT+SMCONF="USERNAME",7000c&i0skjc3rzVY//用户名设置

AT+SMCONF="PASSWORD",408c0124beac2d5ee1271ae710314e7d8edc212d1d992fd48a0ff03b0337d412//密码设置

AT+SMCONF="CLIENTID","i0skjc3rzVY.7000c|securemode=2,signmethod=hmacsha256timestamp=1670342856035|"//clientid设置

AT+SMCONN//连接到MQTT

AT+SMDISC//disconnect MQTT(optional)


在这里插入图片描述

After that, you will see the device online showed at the Aliyun.

在这里插入图片描述

Set the Topic rule

在这里插入图片描述

Subscribe topic

COMMANDS:

AT+SMSUB="/i0skjc3rzVY/7000c/user/send",1//Subscribe订阅topic:/i0skjc3rzVY/7000c/user/send

AT+SMUNSUB="/i0skjc3rzVY/7000c/user/send"//Unsubscribe取消订阅

AT+SMPUB="/i0skjc3rzVY/7000c/user/send"2010//Publish发布信息,可用AT+SMPUB=?查询格式

Subscribe the topic
在这里插入图片描述

Then can find the Subscribed topic at Topic list

Two functions here:

  • Check packets sended by device at “Device Log”
  • Publish packets to device

在这里插入图片描述

Publish “ABCDEFG” to topic “/i0skjc3rzVY/7000c/user/send”
Got the packet !!!
在这里插入图片描述



STEP3: Multiple device pub$sub

Unfortunetely Aliyun has a wield configuration at MQTT broker. Different devices doesn’t share one broker.
Device_A has its own topic name rule

it means:
Device_A can only subscribe /…/Device_A/user/send
&
Device_B cannot publish packets to /…/Device_A/user/send

在这里插入图片描述


***But aliyun gave an annoying way to achieve that. — “DATA Forwading” *** GOOD JOBS 😦

Here I will use MQTT.fx as the Device B

MQTT.fx 1.7.1

在这里插入图片描述
在这里插入图片描述

Then we got two devices connected

  • 7000c (MODEM)
  • 7000G (MQTT.fx)


DATA Forwarding configuration

在这里插入图片描述


Create Parser:

在这里插入图片描述

Create Data Source

在这里插入图片描述
Then just follow the document in aliyun, it’s being changed. So it makes no sense to share too much details

Here also introduct the setup method but it’s old GUI.(Very useful)

https://blog.csdn.net/m0_55986434/article/details/127142854

Finally got MQTT.fx to modem done
在这里插入图片描述

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值