Changes for page MQTT Forward Instruction
Last modified by Kilight Cao on 2024/08/31 16:26
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -9,6 +9,7 @@ 9 9 Dragino LoRa/LoRaWAN gateway support MQTT forwarding. It can forward the sensor data from LoRa network to MQTT server , and vice verse. 10 10 11 11 12 + 12 12 == 1.1 Support Devices == 13 13 14 14 ... ... @@ -22,6 +22,9 @@ 22 22 * LIG16 23 23 * MS14 series if installed with the same firmware. (in this case, the MQTT forward will work , but no LoRa support) 24 24 26 + 27 + 28 + 25 25 = 2. Firmware Change Log for MQTT feature = 26 26 27 27 ... ... @@ -32,6 +32,9 @@ 32 32 * LG02_LG08-5.3.1580178039 33 33 ** Initiate version 34 34 39 + 40 + 41 + 35 35 = 3. MQTT forward operating principle = 36 36 37 37 ... ... @@ -41,13 +41,16 @@ 41 41 Below shows the network structure for MQTT forwarding. 42 42 43 43 * **For Uplink:** The sensor sends data to LoRa Gateway via LoRa wireless, The gateway will process these data and forward to remote MQTT Broker via Internet. 44 -* **For Downlink:** The gateway subscribe a topic in the MQTT broker, when there is update on the topic, the gateway will know and broadcast the data to Local LoRa network ,51 +* **For Downlink:** The gateway subscribe a topic in the MQTT broker, when there is update on the topic, the gateway will know and broadcast the data to Local LoRa network. 45 45 53 + 54 + 46 46 [[image:image-20220527133547-1.png]] 47 47 48 48 General MQTT structure 49 49 50 50 60 + 51 51 == 3.2 How sensor data is forwarded == 52 52 53 53 ... ... @@ -54,12 +54,16 @@ 54 54 In this MQTT forward feature, the key point is how the gateway process the sensor data. 55 55 56 56 67 + 57 57 === 3.2.1 Upstream === 58 58 70 + 59 59 Assume there are two sensor nodes, their ID are Node1 ID: 6734 , Node2 ID: 7456. In the remote MQTT broker there are two topics: Topic1: /channel/765800, Topic2: /channel/367860. We can set up in the gateway to map Node1 to Topic1 and Node2 to Topic2. So when there is a sensor data from Node1, the gateway will forward the data to Topic1, when there is sensor data from Node2, the gateway will forward to Topic2. 60 60 61 61 ((( 62 62 The data flow works as below diagram. 75 + 76 + 63 63 ))) 64 64 65 65 [[image:image-20220527134000-2.png]] ... ... @@ -76,6 +76,8 @@ 76 76 77 77 ((( 78 78 93 + 94 + 79 79 ))) 80 80 81 81 === 3.2.2 Downstream === ... ... @@ -85,6 +85,8 @@ 85 85 86 86 ((( 87 87 Below are the data flow for downstream. 104 + 105 + 88 88 ))) 89 89 90 90 [[image:image-20220527134038-3.png]] ... ... @@ -92,6 +92,7 @@ 92 92 Downstream path 93 93 94 94 113 + 95 95 == 3.3 Macro Definition == 96 96 97 97 ... ... @@ -100,6 +100,7 @@ 100 100 ((( 101 101 Currently the (% style="color:#4f81bd" %)**-t (topic)**(%%) and (% style="color:#4f81bd" %)**-m (message)**(%%) support Macros. 102 102 122 + 103 103 104 104 ))) 105 105 ... ... @@ -113,6 +113,8 @@ 113 113 * HOSTNAME: Device Hostname 114 114 115 115 136 + 137 + 116 116 === 3.3.2 -m message macro === 117 117 118 118 ... ... @@ -123,6 +123,8 @@ 123 123 * JSON: Convert META to json format. 124 124 125 125 148 + 149 + 126 126 === 3.3.3 Example for Macro === 127 127 128 128 ... ... @@ -286,6 +286,7 @@ 286 286 This section is an example to show how to set up LG01-N to communicate with a MQTT server. The MQTT server is a simple utility set up in a local PC. Note: User can set up same server via [[this instruction>>url:http://www.steves-internet-guide.com/install-mosquitto-broker/]]. 287 287 288 288 313 + 289 289 == 4.2 Simulate via MQTT.fx utility == 290 290 291 291 ... ... @@ -317,6 +317,7 @@ 317 317 318 318 == 4.3 Simulate via Dragino Command Line == 319 319 345 + 320 320 For first try of MQTT connection, simulate via command line is recommend, there are many servers / connection type for MQTT. They are using different connection parameters. Simulating the connection via command line will help us rapidly connect to server and debug. 321 321 322 322 In the Dragino Gateway, we use [[mosquitto client>>url:https://mosquitto.org/]] for MQTT connection. ... ... @@ -345,8 +345,10 @@ 345 345 mosquitto_sub 346 346 347 347 374 + 348 348 == 4.4 Configure Dragino UI for MQTT connection == 349 349 377 + 350 350 This chapter are step by step to show to configure the Dragino Menu for MQTT auto connection. 351 351 352 352 ((( ... ... @@ -455,6 +455,7 @@ 455 455 In above section, we have configured the UI to support MQTT upstream and downstream. We can simulate via Linux command. In this section, we will guide how to communicate with remote LoRa End Node for upstream and downstream. 456 456 457 457 486 + 458 458 === 4.5.1 Use LoRa Raw protocol for communication ~-~- For LG01/LG02 === 459 459 460 460 ... ... @@ -480,6 +480,8 @@ 480 480 * Downstream: Listening broadcast message from gateway, and print it in console. 481 481 * The LoRa parameter settings in Arduino should match the LoRa settings in gateway, as below: 482 482 512 + 513 + 483 483 [[image:image-20220527140354-18.png]] 484 484 485 485 LoRa Parameter should match ... ... @@ -511,11 +511,11 @@ 511 511 When use test this feature, please use the version higher then : (% style="color:#4f81bd" %)**LG02_LG08~-~-build-v5.4.1593400722-20200629-1120**(%%), in this version, the upload format is changed and readable, which is easier for integration. 512 512 513 513 514 -(% style="color: #4f81bd" %)**Video Instruction**(%%): (% style="color:blue" %)[[https:~~/~~/youtu.be/qJTY441-t90>>url:https://youtu.be/qJTY441-t90]]545 +(% style="color:blue" %)**Video Instruction**(%%): (% style="color:blue" %)[[https:~~/~~/youtu.be/qJTY441-t90>>url:https://youtu.be/qJTY441-t90]] 515 515 ))) 516 516 517 517 ((( 518 -(% style="color:blue d" %)**Step 1**(%%): Refer [[Communicate with ABP End Node>>Communicate with ABP End Node without LoRaWAN Network Server --- LG308]] to know how to set up LG308 to work with LoRaWAN End node.549 +(% style="color:blue" %)**Step 1**(%%): Refer [[Communicate with ABP End Node>>Communicate with ABP End Node without LoRaWAN Network Server --- LG308]] to know how to set up LG308 to work with LoRaWAN End node. 519 519 ))) 520 520 521 521 ((( ... ... @@ -588,7 +588,7 @@ 588 588 589 589 (% class="box infomessage" %) 590 590 ((( 591 -**mosquitto_pub -h 10.130.2.192 -p 1883 -t dragino-1d25dc/ -m "260211D,time,txt,hello,20,1,SF12,923300000,2 > /var/iot/push/test"**622 +**mosquitto_pub -h 10.130.2.192 -p 1883 -t dragino-1d25dc/ -m "260211D,time,txt,hello,20,1,SF12,923300000,2"** 592 592 ))) 593 593 594 594 Or use [[MQTT.fx>>https://mqttfx.jensd.de/index.php/download]] ... ... @@ -609,6 +609,7 @@ 609 609 User can login the gateway's console and run (% style="color:#4f81bd" %)**logread -f**(%%). It will shows the output when there is packet arrive.User can see if it is correct. 610 610 611 611 643 + 612 612 = 6. How to ask for Support = 613 613 614 614