Data communication based on MQTT protocol


 
Overview

    MQTT is an Internet of things transmission protocol developed by IBM. It is designed for lightweight publish / subscribe message transmission. It is suitable for providing reliable communication services for Internet of things devices in low bandwidth and unstable network environment. It has the following characteristics:

  • Very small communication protocol overhead (minimum message size is 2 bytes)
  • Support publish / subscribe mode to simplify application development, especially suitable for mobile application development
  • Three different message delivery levels are provided, so that messages can reach the destination on demand and meet the network transmission requirements of unstable work

    MQTT servers can be built based on open source code or use private cloud servers, such as Alibaba cloud's MQTT server (charged by data traffic).

 
System diagram
COMWAY
 
Establishment of mqtt communication

    In comway 4G DTU, the dynamic program of mqtt must be run to support subsequent mqtt related setting AT commands. The relevant steps are as follows:.

  • Set MQTT port and server address
  • Set the user name and password for MQTT communication
  • Set MQTT publishing topic (publish). By default, only one topic can be published. The data content comes from the field equipment connected to DTU, and the message format is cjson.
  • Set the subscription topic. The subscription topic and data parsing and forwarding need to be customized.
Format and content definition of data message issued by MQTT

    As the client device of mqtt, DTU or RTU can publish topics. The data of the subject comes from the equipment connected to DTU, or each input pin of RTU and connected external equipment.

  • Set acquisition cycle
  • Set the connection server type: MQTT server or socket communication server
  • Set the type of uploaded message content: whether to include device ID
  • Set the instruction type for reading external devices: MODBUS instruction (RTU and TCP) or custom instruction (HEX)

    See the description document for the specific cjson data format.

 


相关文档
 
配置软件
 
测试软件