title: 基于SIM7600的4GDTU设计(一)
tags: SIM7600
date: 2019-12-29 20:29:00
首先为了达到精简和实用性,本计划单单采用MQTT协议来完成此款DTU的设计,因为如果把设备做的过于繁杂就打不到项目的独立和专一性,同时设计和开发的工作量也会比较大。
DTU功能如下:
通讯协议:仅支持MQTT(为达到独立性和减小开发难度)
硬件:STM32+SIMCOM7600+485芯片等
软件:配套APP
前端:具备DTU的远程配置页面
主要命令码:
tsATCmds ATCmds[] = //AT指令
{
{"ATE0\r\n","OK",200,NO_REC,100}, //空指令测试
{"AT+CSQ\r\n","OK",200,NO_REC,3}, //测试信号
{"AT+CREG?\r\n","+CREG: 0,1",200,NO_REC,150}, //测试驻网 150次重发机制
{"AT+CMQTTDISC?\r\n","+CMQTTDISC: 0,1",1000,NO_REC,5}, //是否连接服务器
{"AT+CMQTTSTART\r\n","OK",1000,NO_REC,3}, //开始连接服务器
{"AT+CMQTTACCQ=0,","+CMQTTSTART: 0",3000,NO_REC,3}, //发送ID
{"AT+CMQTTCONNECT=0,","OK",1000,NO_REC,3}, //连接MQTT
{"AT+CMQTTSUB=0,",">",3000,NO_REC,3}, //开始订阅
{"\r\n","OK",1000,NO_REC,3}, //订阅TOPIC名称
{"AT+CMQTTTOPIC=0,",">",1000,NO_REC,8}, //开始发布
{"\r\n","OK",1000,NO_REC,3}, //发布TOPIC名称
{"AT+CMQTTPAYLOAD=0,",">",1000,NO_REC,5}, //发布消息
{"\r\n","OK",2000,NO_REC,3}, //消息内容
{"AT+CMQTTPUB=0,1,60\r\n","+CMQTTPUB",1000,NO_REC,3}, //发布消息
{"AT+CRESET\r\n","+CPIN: READY",5000,1}, //复位模组
{"AT+CMQTTDISC?\r\n","+CMQTTDISC: 0,0",1000,NO_REC,3}, //自检命令
{"ATI\r\n","OK",1000,NO_REC,3}, //设备信息
{"AT+HTTPINIT\r\n","OK",2000,NO_REC,3}, //HTTP初始化 ATI
{"AT+HTTPPARA=\"URL\",\"https://www.cnblogs.com/pengwenzheng/p/12100814.html\"\r\n","OK",1000,NO_REC,3}, //HTTP设置IP地址
{"AT+HTTPACTION=0\r\n","+HTTPACTION: 0,200",2000,NO_REC,3}, //HTTP设置GET
{"AT+HTTPREAD=0,1024\r\n","CITC@",1000,NO_REC,6}, //HTTP读取数据包
{"AT+HTTPTERM\r\n","OK",1000,NO_REC,3}, //HTTP关闭
};
前端界面: 以合宙DTU的管理平台为例
部分代码截图:
未完待续 2019年12月29日