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,7 +9,6 @@ 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 - 13 13 == 1.1 Support Devices == 14 14 15 15 ... ... @@ -16,7 +16,7 @@ 16 16 This MQTT forward instruction is for below devices: 17 17 18 18 * Firmware Version > LG02_LG08-5.3.1580178039 [[Firmware Download>>url:http://www.dragino.com/downloads/index.php?dir=LoRa_Gateway/LPS8/Firmware/Release/]] 19 -* LG01N, OLG01N ((% style="color:red" %)**Warning**(%%): LG01-P LG01-S use another instruction: [[MQTT for LG01-P/LG01S>>doc:Through MQTT to upload data.WebHome]]) 18 +* LG01N, OLG01N ((% style="color:red" %)**Warning**(%%): LG01-P LG01-S use another instruction: [[MQTT for LG01-P/LG01S>>doc:Main.Through MQTT to upload data.WebHome]]) 20 20 * LG02, OLG02 21 21 * LG308, DLOS8 22 22 * LPS8 ... ... @@ -24,8 +24,6 @@ 24 24 * MS14 series if installed with the same firmware. (in this case, the MQTT forward will work , but no LoRa support) 25 25 26 26 27 - 28 - 29 29 = 2. Firmware Change Log for MQTT feature = 30 30 31 31 ... ... @@ -37,11 +37,8 @@ 37 37 ** Initiate version 38 38 39 39 40 - 41 - 42 42 = 3. MQTT forward operating principle = 43 43 44 - 45 45 == 3.1 Network Structure == 46 46 47 47 ... ... @@ -50,14 +50,11 @@ 50 50 * **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. 51 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. 52 52 53 - 54 - 55 55 [[image:image-20220527133547-1.png]] 56 56 57 57 General MQTT structure 58 58 59 59 60 - 61 61 == 3.2 How sensor data is forwarded == 62 62 63 63 ... ... @@ -64,7 +64,6 @@ 64 64 In this MQTT forward feature, the key point is how the gateway process the sensor data. 65 65 66 66 67 - 68 68 === 3.2.1 Upstream === 69 69 70 70 ... ... @@ -72,8 +72,6 @@ 72 72 73 73 ((( 74 74 The data flow works as below diagram. 75 - 76 - 77 77 ))) 78 78 79 79 [[image:image-20220527134000-2.png]] ... ... @@ -90,8 +90,6 @@ 90 90 91 91 ((( 92 92 93 - 94 - 95 95 ))) 96 96 97 97 === 3.2.2 Downstream === ... ... @@ -101,8 +101,6 @@ 101 101 102 102 ((( 103 103 Below are the data flow for downstream. 104 - 105 - 106 106 ))) 107 107 108 108 [[image:image-20220527134038-3.png]] ... ... @@ -110,7 +110,6 @@ 110 110 Downstream path 111 111 112 112 113 - 114 114 == 3.3 Macro Definition == 115 115 116 116 ... ... @@ -119,7 +119,6 @@ 119 119 ((( 120 120 Currently the (% style="color:#4f81bd" %)**-t (topic)**(%%) and (% style="color:#4f81bd" %)**-m (message)**(%%) support Macros. 121 121 122 - 123 123 124 124 ))) 125 125 ... ... @@ -133,8 +133,6 @@ 133 133 * HOSTNAME: Device Hostname 134 134 135 135 136 - 137 - 138 138 === 3.3.2 -m message macro === 139 139 140 140 ... ... @@ -145,8 +145,6 @@ 145 145 * JSON: Convert META to json format. 146 146 147 147 148 - 149 - 150 150 === 3.3.3 Example for Macro === 151 151 152 152 ... ... @@ -172,7 +172,6 @@ 172 172 ))) 173 173 174 174 175 - 176 176 == 3.4 Modify the MQTT to support more options == 177 177 178 178 ... ... @@ -300,10 +300,8 @@ 300 300 ))) 301 301 302 302 303 - 304 304 = 4. Example to communicate to a simple MQTT server = 305 305 306 - 307 307 == 4.1 Overview == 308 308 309 309 ... ... @@ -310,7 +310,6 @@ 310 310 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/]]. 311 311 312 312 313 - 314 314 == 4.2 Simulate via MQTT.fx utility == 315 315 316 316 ... ... @@ -339,7 +339,6 @@ 339 339 Downstream: Subscribe a topic to get downstream 340 340 341 341 342 - 343 343 == 4.3 Simulate via Dragino Command Line == 344 344 345 345 ... ... @@ -361,7 +361,6 @@ 361 361 mosquitto_pub 362 362 363 363 364 - 365 365 (% style="color:blue" %)**For Downstream** 366 366 367 367 Use [[mosquitto_sub>>url:https://mosquitto.org/man/mosquitto_sub-1.html]] to subscribe the change on the topic. ... ... @@ -371,7 +371,6 @@ 371 371 mosquitto_sub 372 372 373 373 374 - 375 375 == 4.4 Configure Dragino UI for MQTT connection == 376 376 377 377 ... ... @@ -395,7 +395,6 @@ 395 395 forward to MQTT 396 396 397 397 398 - 399 399 === 4.4.1 Configure the MQTT Client for Upstream === 400 400 401 401 ... ... @@ -416,7 +416,6 @@ 416 416 MQTT Publish configure 417 417 418 418 419 - 420 420 [[image:image-20220527135929-13.png]] 421 421 422 422 MQTT Channel settings ... ... @@ -445,7 +445,6 @@ 445 445 MQTT Publish 446 446 447 447 448 - 449 449 === 4.4.2 Configure the MQTT Client for Downstream === 450 450 451 451 ... ... @@ -509,14 +509,11 @@ 509 509 * Downstream: Listening broadcast message from gateway, and print it in console. 510 510 * The LoRa parameter settings in Arduino should match the LoRa settings in gateway, as below: 511 511 512 - 513 - 514 514 [[image:image-20220527140354-18.png]] 515 515 516 516 LoRa Parameter should match 517 517 518 518 519 - 520 520 Below is the test result after the Arduino Sketch is running. 521 521 522 522 [[image:image-20220527140459-19.png]] ... ... @@ -524,13 +524,11 @@ 524 524 Upstream Data Flow 525 525 526 526 527 - 528 528 [[image:image-20220527140542-20.png]] 529 529 530 530 Downstream Data Flow 531 531 532 532 533 - 534 534 === 4.5.2 Use LoRaWAN Protocol for communication ~-~- For LG308/LPS8/DLOS8 === 535 535 536 536 ... ... @@ -567,44 +567,36 @@ 567 567 [[image:image-20220613191345-4.png]] 568 568 569 569 570 - 571 571 (% style="color:blue" %)**Step 4**(%%): Map the Device Address to Remote ID in MQTT server. 572 572 573 573 [[image:image-20220613190635-2.png]] 574 574 575 575 576 - 577 577 (% style="color:blue" %)**Step 5: Upstream**(%%): Save the change, we can see the log info via "sytem log", End Node and MQTT Server 578 578 579 579 [[image:image-20220527141843-24.png]] 580 580 581 581 582 - 583 - 584 584 [[image:image-20220527141933-25.png]] 585 585 586 586 Choose ASCII Format 587 587 588 588 589 - 590 590 [[image:image-20220527142028-26.png]] 591 591 592 592 LHT65 Decoder 593 593 594 594 595 - 596 596 (% style="color:blue" %)**Step 6: Set up subscribe**(%%)**:** Subscribe a topci for downstream. 597 597 598 598 [[image:image-20220613191426-5.png]] 599 599 600 600 601 - 602 602 (% style="color:blue" %)**Step 7: Downstream**(%%): Save the change, we can see the log info via "sytem log", End Node and MQTT Server. 603 603 604 604 [[image:image-20220527142239-28.png]] 605 605 606 606 607 - 608 608 === 4.5.3 MQTT Downstream format === 609 609 610 610 ... ... @@ -633,7 +633,6 @@ 633 633 Check out this link for more mosquito-related directives [[https:~~/~~/mosquitto.org/man/mosquitto_pub-1.html>>https://mosquitto.org/man/mosquitto_pub-1.html]] 634 634 635 635 636 - 637 637 = 5. How to Debug = 638 638 639 639 ... ... @@ -640,7 +640,6 @@ 640 640 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. 641 641 642 642 643 - 644 644 = 6. How to ask for Support = 645 645 646 646