Changes for page MQTT Forward Instruction
Last modified by Xiaoling on 2025/07/31 16:59
From version 57.1
edited by Kilight Cao
on 2024/08/31 16:26
on 2024/08/31 16:26
Change comment:
There is no comment for this version
Summary
-
Page properties (2 modified, 0 added, 0 removed)
-
Attachments (0 modified, 0 added, 43 removed)
- image-20220527133547-1.png
- image-20220527134000-2.png
- image-20220527134038-3.png
- image-20220527134251-4.png
- image-20220527134332-5.png
- image-20220527134929-6.png
- image-20220527135037-7.png
- image-20220527135215-8.png
- image-20220527135310-9.png
- image-20220527135440-10.png
- image-20220527135742-11.png
- image-20220527135828-12.png
- image-20220527135929-13.png
- image-20220527140023-14.png
- image-20220527140100-15.png
- image-20220527140148-16.png
- image-20220527140238-17.png
- image-20220527140354-18.png
- image-20220527140459-19.png
- image-20220527140542-20.png
- image-20220527141235-21.png
- image-20220527141450-22.png
- image-20220527141727-23.png
- image-20220527141843-24.png
- image-20220527141933-25.png
- image-20220527142028-26.png
- image-20220527142115-27.png
- image-20220527142239-28.png
- image-20220527142638-29.png
- image-20220527142706-30.png
- image-20220527142733-31.png
- image-20220527142820-32.png
- image-20220613190254-1.png
- image-20220613190635-2.png
- image-20220613191154-3.png
- image-20220613191345-4.png
- image-20220613191426-5.png
- image-20220613192816-6.png
- image-20220714155901-1.png
- image-20240831160038-1.png
- image-20240831162021-2.png
- image-20240831162254-3.png
- image-20240831162454-4.png
Details
- Page properties
-
- Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. Kilight1 +XWiki.Xiaoling - Content
-
... ... @@ -1,241 +1,0 @@ 1 -**~ Table of Contents:** 2 - 3 -{{toc/}} 4 - 5 - 6 -= 1. Introduction = 7 - 8 - 9 -Dragino LoRa/LoRaWAN gateway support MQTT forwarding. It can forward the sensor data from LoRa network to MQTT server , and vice verse. 10 - 11 - 12 -== 1.1 Support Devices == 13 - 14 - 15 -This MQTT forward instruction is for below devices: 16 - 17 -* 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]]) 18 -* LG02, OLG02 19 -* LG308, DLOS8, LPS8, LIG16 20 -* MS14 series if installed with the same firmware. (in this case, the MQTT forward will work , but no LoRa support) 21 -* LG308N, DLOS8N, LPS8N 22 -* LPS8V2 23 - 24 -The MQTT Client Utility used in Dragino is **mosquitto_pub** and **mosquitto_sub**. User can add more options to the mqtt commands. 25 - 26 -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]]** 27 - 28 - 29 -= 2. Example to communicate to a simple MQTT server = 30 - 31 -== 2.1 Overview == 32 - 33 - 34 -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/]]. 35 - 36 - 37 -== 2.2 Simulate via MQTT.fx utility == 38 - 39 - 40 -The [[MQTT.fx>>url:http://mqttfx.jensd.de/index.php/download]] is a MQTT client tool. We can use this to simulate a MQTT connection to our MQTT broker first to make sure the MQTT broker works. This will also help us understand how it works. 41 - 42 -((( 43 -In this test, the MQTT broker and MQTT.fx are installed in the same PC, so the MQTT server address in MQTT.fx should be localhost. Below shows how to connect to the server. 44 -))) 45 - 46 -[[image:image-20220527134929-6.png]] 47 - 48 -Connect to MQTT Broker 49 - 50 - 51 -After connected, use publish to public some thing to MQTT server. This to simulate upsteam 52 - 53 -[[image:image-20220527135037-7.png]] 54 - 55 -Upstream: Publish message to MQTT Broker 56 - 57 - 58 -To simulate a downstream, use MQTT.fx to subscribe a topic, and publish something to this topic. as Below: 59 - 60 -[[image:image-20220527135215-8.png]] 61 - 62 -Downstream: Subscribe a topic to get downstream 63 - 64 - 65 - 66 -= 3. Add LoRa support to communicate with remote sensor = 67 - 68 - 69 -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. 70 - 71 - 72 - 73 -== 3.1 Use LoRa Raw protocol for communication ~-~- For LG01/LG02 == 74 - 75 - 76 -((( 77 -We can use **[[LoRa Shield>>url:http://www.dragino.com/products/lora/item/102-lora-shield.html]]** to send LoRa Raw data to Gateway and receive data from gateway. 78 -))) 79 - 80 -((( 81 -The example Sketch for LoRa Shield +Arduino is here: **[[LoRa_Shield_Sketch_For_MQTT>>url:http://www.dragino.com/downloads/index.php?dir=LoraShield/]]** 82 -))) 83 - 84 -((( 85 -And this link is the required library: **[[arduino-LoRa-master>>url:http://www.dragino.com/downloads/index.php?dir=LoraShield/]]**. Unzip this library and put in Arduino library location. 86 - 87 - 88 -))) 89 - 90 -((( 91 -What does the Arduino Sketch do? The Arduino Sketch will: 92 -))) 93 - 94 -* Upstream: Keep sending a LoRa Message every minutes with this payload : <4567>tem=xx&hum=yy (Where xx and yy are temperature and humidity value generated randomly). 95 -* Downstream: Listening broadcast message from gateway, and print it in console. 96 -* The LoRa parameter settings in Arduino should match the LoRa settings in gateway, as below: 97 - 98 -[[image:image-20220527140354-18.png]] 99 - 100 -LoRa Parameter should match 101 - 102 - 103 -Below is the test result after the Arduino Sketch is running. 104 - 105 -[[image:image-20220527140459-19.png]] 106 - 107 -Upstream Data Flow 108 - 109 - 110 -[[image:image-20220527140542-20.png]] 111 - 112 -Downstream Data Flow 113 - 114 - 115 -== 3.2 Use LoRaWAN Protocol for communication ~-~- For LG308/LPS8/DLOS8/LG308N/LPS8N/DLOS8N == 116 - 117 - 118 -((( 119 -Since firmware (% style="color:#4f81bd" %)**LG02_LG08~-~-build-v5.3.1585192026-20200326-1109,**(%%) Dragino LoRaWAN gateways support the communication to LoRaWAN (% style="color:#4f81bd" %)**ABP end node**(%%) locally without the need of LoRaWAN server. This feature allow us to integrate MQTT in the gateway to support LoRaWAN to MQTT forwarding or visa verse. 120 -))) 121 - 122 -((( 123 -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. 124 - 125 - 126 -(% style="color:blue" %)**Video Instruction**(%%): (% style="color:blue" %)[[https:~~/~~/youtu.be/qJTY441-t90>>url:https://youtu.be/qJTY441-t90]] 127 -))) 128 - 129 -((( 130 -(% 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. 131 -))) 132 - 133 -((( 134 -(% style="color:blue" %)**Step 2**(%%): Make sure your Radio settings match the End Node settings. 135 -))) 136 - 137 -[[image:image-20220527141235-21.png]] 138 - 139 -Use Same Frequency Band as End Node 140 - 141 - 142 -((( 143 -((( 144 -(% style="color:blue" %)**Step 3**(%%): Set up publish format and MQTT channel. The LG308 will store the Data from End node in (% style="color:#4f81bd" %)**HEX format**(%%) in the file. 145 -))) 146 -))) 147 - 148 -[[image:image-20220613191345-4.png]] 149 - 150 - 151 -(% style="color:blue" %)**Step 4**(%%): Map the Device Address to Remote ID in MQTT server. 152 - 153 -[[image:image-20220613190635-2.png]] 154 - 155 - 156 -(% style="color:blue" %)**Step 5: Upstream**(%%): Save the change, we can see the log info via "sytem log", End Node and MQTT Server 157 - 158 -[[image:image-20220527141843-24.png]] 159 - 160 - 161 -[[image:image-20220527141933-25.png]] 162 - 163 -Choose ASCII Format 164 - 165 - 166 -[[image:image-20220527142028-26.png]] 167 - 168 -LHT65 Decoder 169 - 170 - 171 -(% style="color:blue" %)**Step 6: Set up subscribe**(%%)**:** Subscribe a topci for downstream. 172 - 173 -[[image:image-20220613191426-5.png]] 174 - 175 - 176 -(% style="color:blue" %)**Step 7: Downstream**(%%): Save the change, we can see the log info via "sytem log", End Node and MQTT Server. 177 - 178 -[[image:image-20220527142239-28.png]] 179 - 180 - 181 - 182 -mosquitto_pub -h $server_address -p $server_port -t $Client_ID -m "**dev_addr,imme/time,txt/hex,payload**" 183 - 184 -(% class="box infomessage" %) 185 -((( 186 -**mosquitto_pub -h 10.130.2.192 -p 1883 -t dragino-1d25dc/ -m "260211D,time,txt,hello"** 187 -))) 188 - 189 -mosquitto_pub -h $server_address -p $server_port -t $Client_ID -m "**dev_addr,imme/time,txt/hex,payload,txpw,txbw,SF,frequency,rxwindow**" 190 - 191 -(% class="box infomessage" %) 192 -((( 193 -**mosquitto_pub -h 10.130.2.192 -p 1883 -t dragino-1d25dc/ -m "260211D,time,txt,hello,20,1,SF12,923300000,2"** 194 -))) 195 - 196 -(% style="color:red" %)**Notice: The text use for Downstream must meet the requirement from [[LG308 Downstream Payload>>Communicate with ABP End Node without LoRaWAN Network Server --- LG308||anchor="H2.2Downstream"]]** 197 - 198 -Or use [[MQTT.fx>>https://mqttfx.jensd.de/index.php/download]] 199 - 200 -[[image:image-20220613192816-6.png||height="440" width="1056"]] 201 - 202 - 203 -== 3.3 Use LoRaWAN Protocol for communication ~-~- For LPS8V2 == 204 - 205 -((( 206 - 207 - 208 -(% style="color:blue" %)**Step 1**(%%): Refer **[[Register Node to Chirpstack>>http://wiki.dragino.com/xwiki/bin/view/Main/Notes%20for%20ChirpStack/#H2.1A0RegisterNode]]** and **[[Register Gateway to Chirpstack>>http://wiki.dragino.com/xwiki/bin/view/Main/Notes%20for%20ChirpStack/#H4.A0SemtechUDPforChirpStackv4]]**to know How do register node devices and gateways to the built-in chirpstack server 209 -))) 210 - 211 -((( 212 -(% style="color:blue" %)**Step 2**(%%): Make sure your node data is normal on the built-in server 213 - 214 -Click "**Event**" on the node device interface on chirpstack, and then click "**+up**" to view the detailed data information of the node device 215 - 216 -[[image:image-20240831160038-1.png||height="680" width="1321"]] 217 -))) 218 - 219 - 220 -(% style="color:blue" %)**Step 3**(%%): Set up MQTT Forworder. 221 - 222 -[[image:image-20240831162021-2.png||height="684" width="1191"]] 223 - 224 - 225 -(% style="color:blue" %)**Step 4:** (%%)Check result 226 - 227 -Users can check the data through the MQTT server, or use the MQtt.fx tool. 228 - 229 -[[image:image-20240831162254-3.png||height="661" width="1284"]] 230 - 231 -[[image:image-20240831162454-4.png]] 232 - 233 -= 4. How to ask for Support = 234 - 235 - 236 -If a user still not have trouble making it works. please send a mail to support@dragino.com with the below info: 237 - 238 -* Detail of your LoRaWAN end node. 239 -* Gateway Model and firmware version 240 -* A set of screenshots you configure in the gateway according to our instruction 241 -* A full log of "logread -f"
- image-20220527133547-1.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.Xiaoling - Size
-
... ... @@ -1,1 +1,0 @@ 1 -199.3 KB - Content
- image-20220527134000-2.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.Xiaoling - Size
-
... ... @@ -1,1 +1,0 @@ 1 -115.8 KB - Content
- image-20220527134038-3.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.Xiaoling - Size
-
... ... @@ -1,1 +1,0 @@ 1 -94.2 KB - Content
- image-20220527134251-4.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.Xiaoling - Size
-
... ... @@ -1,1 +1,0 @@ 1 -35.1 KB - Content
- image-20220527134332-5.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.Xiaoling - Size
-
... ... @@ -1,1 +1,0 @@ 1 -34.7 KB - Content
- image-20220527134929-6.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.Xiaoling - Size
-
... ... @@ -1,1 +1,0 @@ 1 -61.6 KB - Content
- image-20220527135037-7.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.Xiaoling - Size
-
... ... @@ -1,1 +1,0 @@ 1 -65.1 KB - Content
- image-20220527135215-8.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.Xiaoling - Size
-
... ... @@ -1,1 +1,0 @@ 1 -125.6 KB - Content
- image-20220527135310-9.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.Xiaoling - Size
-
... ... @@ -1,1 +1,0 @@ 1 -87.9 KB - Content
- image-20220527135440-10.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.Xiaoling - Size
-
... ... @@ -1,1 +1,0 @@ 1 -111.5 KB - Content
- image-20220527135742-11.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.Xiaoling - Size
-
... ... @@ -1,1 +1,0 @@ 1 -18.2 KB - Content
- image-20220527135828-12.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.Xiaoling - Size
-
... ... @@ -1,1 +1,0 @@ 1 -35.1 KB - Content
- image-20220527135929-13.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.Xiaoling - Size
-
... ... @@ -1,1 +1,0 @@ 1 -31.0 KB - Content
- image-20220527140023-14.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.Xiaoling - Size
-
... ... @@ -1,1 +1,0 @@ 1 -182.2 KB - Content
- image-20220527140100-15.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.Xiaoling - Size
-
... ... @@ -1,1 +1,0 @@ 1 -8.2 KB - Content
- image-20220527140148-16.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.Xiaoling - Size
-
... ... @@ -1,1 +1,0 @@ 1 -34.0 KB - Content
- image-20220527140238-17.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.Xiaoling - Size
-
... ... @@ -1,1 +1,0 @@ 1 -126.3 KB - Content
- image-20220527140354-18.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.Xiaoling - Size
-
... ... @@ -1,1 +1,0 @@ 1 -62.7 KB - Content
- image-20220527140459-19.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.Xiaoling - Size
-
... ... @@ -1,1 +1,0 @@ 1 -151.0 KB - Content
- image-20220527140542-20.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.Xiaoling - Size
-
... ... @@ -1,1 +1,0 @@ 1 -165.4 KB - Content
- image-20220527141235-21.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.Xiaoling - Size
-
... ... @@ -1,1 +1,0 @@ 1 -83.3 KB - Content
- image-20220527141450-22.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.Xiaoling - Size
-
... ... @@ -1,1 +1,0 @@ 1 -46.5 KB - Content
- image-20220527141727-23.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.Xiaoling - Size
-
... ... @@ -1,1 +1,0 @@ 1 -23.6 KB - Content
- image-20220527141843-24.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.Xiaoling - Size
-
... ... @@ -1,1 +1,0 @@ 1 -164.3 KB - Content
- image-20220527141933-25.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.Xiaoling - Size
-
... ... @@ -1,1 +1,0 @@ 1 -100.1 KB - Content
- image-20220527142028-26.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.Xiaoling - Size
-
... ... @@ -1,1 +1,0 @@ 1 -95.2 KB - Content
- image-20220527142115-27.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.Xiaoling - Size
-
... ... @@ -1,1 +1,0 @@ 1 -9.3 KB - Content
- image-20220527142239-28.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.Xiaoling - Size
-
... ... @@ -1,1 +1,0 @@ 1 -181.1 KB - Content
- image-20220527142638-29.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.Xiaoling - Size
-
... ... @@ -1,1 +1,0 @@ 1 -62.3 KB - Content
- image-20220527142706-30.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.Xiaoling - Size
-
... ... @@ -1,1 +1,0 @@ 1 -43.1 KB - Content
- image-20220527142733-31.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.Xiaoling - Size
-
... ... @@ -1,1 +1,0 @@ 1 -10.3 KB - Content
- image-20220527142820-32.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.Xiaoling - Size
-
... ... @@ -1,1 +1,0 @@ 1 -155.6 KB - Content
- image-20220613190254-1.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.Kilight - Size
-
... ... @@ -1,1 +1,0 @@ 1 -55.7 KB - Content
- image-20220613190635-2.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.Kilight - Size
-
... ... @@ -1,1 +1,0 @@ 1 -44.1 KB - Content
- image-20220613191154-3.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.Kilight - Size
-
... ... @@ -1,1 +1,0 @@ 1 -56.1 KB - Content
- image-20220613191345-4.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.Kilight - Size
-
... ... @@ -1,1 +1,0 @@ 1 -55.4 KB - Content
- image-20220613191426-5.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.Kilight - Size
-
... ... @@ -1,1 +1,0 @@ 1 -55.8 KB - Content
- image-20220613192816-6.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.Kilight - Size
-
... ... @@ -1,1 +1,0 @@ 1 -22.1 KB - Content
- image-20220714155901-1.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.Xiaoling - Size
-
... ... @@ -1,1 +1,0 @@ 1 -75.2 KB - Content
- image-20240831160038-1.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.Kilight - Size
-
... ... @@ -1,1 +1,0 @@ 1 -151.6 KB - Content
- image-20240831162021-2.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.Kilight - Size
-
... ... @@ -1,1 +1,0 @@ 1 -64.5 KB - Content
- image-20240831162254-3.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.Kilight - Size
-
... ... @@ -1,1 +1,0 @@ 1 -91.9 KB - Content
- image-20240831162454-4.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.Kilight - Size
-
... ... @@ -1,1 +1,0 @@ 1 -57.6 KB - Content