利来囯际W66

关注官方微信

中文.

Usage of MQTT Gateway

Published Time:2019-08-26 Author:Shanghai ZLAN Views:8274

JSON data acquisition gateway is a gateway that can collect data from various sensors and upload it to the server in JSON format.

JSON数据采集网关工作原理示意图

JSON (JavaScript Object Notation) is the data format in Java. For example, {" power ":" 100 ", "time" : "10:12:23"} is becoming a common server data interchange format due to its ease of use and ease of reading for computers and people alike.

Due to the development of the Internet of Things and the popularity of cloud computers and cloud servers, data sent on the Internet of Things in JSON format is becoming more and more popular. However, the data acquisition instrument generally adopts RS485 data bus, Modbus RTU, GB 645 and other instrument protocols. The underlying equipment engineer is familiar with such equipment protocols, but the server development engineer is not. The underlying device engineer does not know how to send JSON-formatted data over the network to the server development engineer. So you need a device that can be a bridge for this kind of data conversion.

The JSON data acquisition gateway plays this role by implementing the following steps:

1. First, the data acquisition gateway will send query data to the connected RS485 device according to the configuration.

2. After receiving the data, the gateway will extract the data inside and convert it into the specified format, such as integer, decimal, etc., and then store the returned data of this instruction corresponding to the JSON keyword.

3. The gateway will send JSON-formatted data packets to the server at regular intervals.

The current gateway can achieve the following functions:

1. The protocols for upper computer docking can be: MQTT protocol +JSON, pure JSON TCP/IP data, HTTP POST+JSON and HTTP GET JSON data.

2. The lower computer protocol supports the customization of Modbus RTU protocol, 645 instrument protocol and non-standard protocol.

3. All the upward protocol JSON format and the downward protocol can be designed through the interface without programming.

4. Support to add device ID, time, and any string in JSON format. Supports nested writing methods in JSON format.

5. Upload data support unsigned data and signed data, support decimal point representation, support 4-byte length data, support Boolean variable.




The following is an example to demonstrate the use of the JSON data acquisition gateway.

1. First, confirm that the firmware version of the device is 1.581 or above (for 2043). Use ZLVircom5.18 to search for the device, enter the device edit, and click the button "Firmware and Configuration"

2. Select the web directory to download, select an empty directory to save the configuration, and then click JSON configuration.

3. Select the time interval of sending server and the way of sending server here, such as MQTT, POST, GET, etc. Then click "Add/View" button to design each JSON and corresponding Modbus register.

4. Enter the keyword of this JSON as POWER, and select the station address, function code, register address of its Modbus address, and the data type and decimal point of the collected data. The Modbus register contents thus captured will be written to the end of power, similar to {" power ":" 100 "}.

5. If there is still a design, click "Design next"; otherwise, click "Save design". Click "Save JSON Settings" in the previous dialog box, and then download the configuration to the device in the next dialog box.


After that, the device will automatically collect Modbus data with the station address 1, function code 3 and register 0, and send it to the server every 5 seconds according to the JSON format (of course, the device needs to be connected to the server first).

Using this method, device engineers no longer have to worry about how to connect Modbus instruments to the cloud in JSON format.




利来囯际W66