how to use bc26 with tencent&ali iot platform

nb-iot
Author

dd21

Published

March 29, 2023

Abstract

This is a topic related to the Internet of Things and related technologies. NB-IoT is a low-power, wide-area coverage communication technology for the Internet of Things, while the BC260 module is a hardware device that supports NB-IoT communication. Tencent IoT Platform and Alibaba Cloud IoT Platform are two major IoT cloud platforms that provide functions such as IoT device access, data storage, and processing. With these keywords, it can be seen that the topic is discussing how to connect NB-IoT devices to IoT cloud platforms to achieve IoT applications.

Referance

BC260Y MQTT 指令 腾讯云 (发送的数据格式)物模型协议 BC260Y-CN AT 命令手册 善学坊温湿度采集教程 善学坊nb-iot教程

how to read the AT datasheet

AT+QMTCONN=<TCP_connectID>,<clientID>[,<username>[,<password>]]

- []内的参数为可选参数, 可以填也可以不填写

Ep:
    AT+QMTCONN= <TCP_connectID>,   <clientID>    [,<username>                                      [,<password>]]        
    AT+QMTCONN=       0,           "device22",
    AT+QMTCONN=       0,           "sensor01",   "03P1H9CN2Esensor01;12010126;6PD93;1970357231",     "0a79340c5ccf7121b4e49b3f2089adf259b579ebc10ee9fa8a36202d15b86399;hmacsha256"

test script

qcom可以去善学坊的资料里面找 >https://pan.baidu.com/s/1oFpSJltDWPtv1Uuszk37Zg 密码:3n8u

测试模块能否连接到网络, 其实默认会连接到网络, 如果有IP地址返回就说明可以联网, 但是测试卡除外,测试卡过期了依旧可以获取到ip地址,但是返回的网络连接结果是0,7 查看手册也不知道这个是什么结果.

# 测试bc260是否和pc连接成功
ATI
# 关闭睡眠模式
AT+QSCLK=0
# 查看是否打开全功能 1 表示打开
AT+CFUN?
# 查看手机卡号, 如果没有卡返回ERROR
AT+CIMI
# 查看绑定的运营商 3,5,8 联通, 电信, 移动
AT+QBAND?
# 设置所有频率3,5,8都扫描一遍, 这样就不用设置卡了, 连接可能有点慢
AT+QBAND=0
# 查看网络附着情况
AT+CGATT?
# 网络附着
AT+CGATT=1
# 查看IP地址
AT+CGPADDR?
# 查看网络获取的结果
AT+CEREG?

使用Qcom或者普通的串口助手都行.

config Tencent-iot Platform

https://console.cloud.tencent.com/iotexplorer

auto update data

可选: 虚拟设备调试

打开腾讯连连或者微信扫码

点击上报之前

点击上报之后

到此软件模拟测试都ok, 接下来使用bc260y发送数据

使用Qcom或者普通的串口助手发送AT指令

新建设备

这里使用善学坊提供的mqtt 用户名和密码生成工具 也可以使用 腾讯官方脚本示范

将对应的数据填写到对应的位置, 点击生成后残生usernamepassword待会发送的时候使用.

一共发送5条指令

AT+QMTOPEN=0,"DN2HGX3J4C.iotcloud.tencentdevices.com",1883
AT+QMTCONN=0,"device00","DN2HGX3J4Cdevice00;12010126;VO8NZ;1970364699","91dc0e02b637ba9771d0046da6b16f21b753ec6aaabcb63bc2901ff594c7ae14;hmacsha256"
AT+QMTPUB=0,1,1,0,"$thing/up/property/DN2HGX3J4C/device00"

{"method":"report","clientToken":"123","timestamp":1628646783,"params":{"temp":25}}

# 使用qcom的时候ctrl+z表示按照二进制发送和发送0x1a效果一致
0x1a

mqtt.c mqtt.h

注意要点

使用腾讯连连进行公众号消息推送时务必保证发送的数据格式正确,错误的数据格式可能会有显示,但是后台记录中会有报错信息,这将会导致公众号消息无法推送,使用虚拟设备调试没有问题。