Last modified by Xiaoling on 2022/09/02 18:11

From version 24.3
edited by Xiaoling
on 2022/05/31 14:11
Change comment: There is no comment for this version
To version 44.3
edited by Xiaoling
on 2022/05/31 14:33
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -1,3 +1,5 @@
1 +**Contents: **
2 +
1 1  {{toc/}}
2 2  
3 3  
... ... @@ -21,9 +21,12 @@
21 21  * Notification mechanism, notify the transmission of both sides when an exception occurs
22 22  
23 23  
26 +
24 24  = 3. What does this example shows? How it works? =
25 25  
29 +(((
26 26  The server we use here is ThingSpeak which has an intuitive chart to show the test result for our test.The ThingSpeak IoT service now supports MQTT subscriptions to receive instant updates when [[ThingSpeak>>url:https://thingspeak.com/]] channel gets updated. The method here is general and can be used with other IoT servers for MQTT connection as well.
31 +)))
27 27  
28 28  [[image:image-20220531135402-1.png]]
29 29  
... ... @@ -37,19 +37,28 @@
37 37  
38 38  [[image:image-20220531135521-3.png]]
39 39  
45 +(((
40 40  Schematic diagram: uplink.In this section, we will try to program LG01 to uplink data to ThingSpeak. The data flow in this example.We have already tried ① and ② in the above simple LoRa example. Now we will try the step ③ first, after it work as expect, we will integrate these three steps together for a complete uplink example.
47 +)))
41 41  
42 42  
43 43  
44 44  [[image:image-20220531135607-4.png]]
45 45  
53 +(((
46 46  Schematic diagram:downlink.In this section, we will try to program LG01 to fetch download data from ThingSpeak, then broadcast this data to local LoRa network. The end node will get this message and check if they need to do something. Similar with Uplink Example, we will first try to do it in PC, then do it in Linux side, and finally integrate it with LoRa.
55 +)))
47 47  
57 +(((
48 48  MQTT agreement to achieve the need: client and server There are three identities in the MQTT protocol: Publish, Broker (server), Subscribe. Among them, the publisher and the subscriber of the message are all clients, the broker is the server, and the publisher can be both the subscriber and the subscriber. MQTT transmission of information is divided into: Topic and payload in two parts Topic, can be understood as the type of message subscribers Subscribe, you will receive the theme of the message content (payload) The payload, which can be understood as the content of the message, refers to the specific content to be used by the subscribers.
59 +)))
49 49  
61 +(((
50 50  To use the server, we need to register an account on [[ThingSpeak>>url:https://thingspeak.com/]] . Then create a channel and type the channel info. As shown below, the Channel ID is the unique ID to store our data in [[ThingSpeak>>url:https://thingspeak.com/]] .
63 +)))
51 51  
52 52  
66 +
53 53  = 4. Preparation =
54 54  
55 55  == 4.1 Hardware ==
... ... @@ -64,7 +64,6 @@
64 64  The LoRa End node keeps getting temperature and humidity from the sensor and sends out via LoRa periodically.
65 65  )))
66 66  
67 -
68 68  == 4.2 Software ==
69 69  
70 70  1. [[4.3.4 version>>url:http://www.dragino.com/downloads/index.php?dir=motherboards/ms14/Firmware/IoT/]]
... ... @@ -72,12 +72,10 @@
72 72  1. [[MQTT_Simple_Server MQTT_Simeple_Server>>url:https://github.com/dragino/Arduino-Profile-Examples/tree/master/libraries/Dragino/examples/LoRa/MQTT_Simple_Server]]
73 73  1. [[DHTlib>>url:https://github.com/goodcheney/Lora/blob/patch-1/Lora%20Shield/Examples/DHTlib.zip]]
74 74  
75 -
76 76  == 4.3 Server(For example) ==
77 77  
78 78  * [[ThingSpeak>>url:https://thingspeak.com/]]
79 79  
80 -
81 81  == 4.4 Configure IoT Server ==
82 82  
83 83  * Need this keys:
... ... @@ -98,7 +98,6 @@
98 98  [[image:image-20220531140304-12.png]]
99 99  )))
100 100  
101 -
102 102  == 4.5 Configure LG01 settings ==
103 103  
104 104  Tips:Please confirm that your LG01 version is 4.3.3.
... ... @@ -185,17 +185,33 @@
185 185  
186 186  === 4.6.2 Input the command at the console(LG01 new version:4.3.4) ===
187 187  
188 -1. [[~[~[image:https://wiki.dragino.com/images/8/84/3_1.png~|~|height="99" width="93"~]~]>>url:https://wiki.dragino.com/index.php/File:3_1.png]](((
198 +1. [[image:image-20220531141150-24.png]](((
189 189  Open this Application.
200 +
201 +
202 +
190 190  )))
191 -1. [[~[~[image:https://wiki.dragino.com/images/thumb/6/6e/MQTT_Command_2.png/400px-MQTT_Command_2.png~|~|height="76" width="400"~]~]>>url:https://wiki.dragino.com/index.php/File:MQTT_Command_2.png]](((
204 +1. (((
205 +[[image:image-20220531141400-27.png]]
206 +
192 192  Check the settings.
208 +
209 +
210 +
193 193  )))
194 -1. [[~[~[image:https://wiki.dragino.com/images/thumb/8/8d/MQTT_Command_1.png/400px-MQTT_Command_1.png~|~|height="343" width="400"~]~]>>url:https://wiki.dragino.com/index.php/File:MQTT_Command_1.png]](((
212 +1. (((
213 +[[image:image-20220531141601-30.png]]
214 +
195 195  input this command.
216 +
217 +
218 +
196 196  )))
197 -1. [[~[~[image:https://wiki.dragino.com/images/thumb/d/de/MQTT_Command_3.png/400px-MQTT_Command_3.png~|~|height="207" width="400"~]~]>>url:https://wiki.dragino.com/index.php/File:MQTT_Command_3.png]](((
220 +1. [[image:image-20220531141515-29.png]](((
198 198  Check the result.
222 +
223 +
224 +
199 199  )))
200 200  
201 201  == 4.7 Updata data to Server(Through MQTT) ==
... ... @@ -207,25 +207,42 @@
207 207  1. Send reply after then receive LoRa node data.
208 208  1. Sketch will write active content to /tmp/iot/status periodically (every 5 minutes).(Watchdog feature)
209 209  
210 -
211 -1. [[~[~[image:https://wiki.dragino.com/images/thumb/8/82/MQTT_Sketch_2.png/400px-MQTT_Sketch_2.png~|~|height="233" width="400"~]~]>>url:https://wiki.dragino.com/index.php/File:MQTT_Sketch_2.png]](((
236 +1. [[image:image-20220531141656-31.png]](((
212 212  Open the sketch [[MQTT_Simple_Server>>url:https://github.com/dragino/Arduino-Profile-Examples/tree/master/libraries/Dragino/examples/LoRa/MQTT_Simple_Server]].(Board:Dragino Yun + UNO or LG01/OLG01,Port:Network ports.)and upload.
238 +
239 +
240 +
213 213  )))
214 -1. [[~[~[image:https://wiki.dragino.com/images/thumb/7/73/MQTT_Sketch2.png/400px-MQTT_Sketch2.png~|~|height="540" width="400"~]~]>>url:https://wiki.dragino.com/index.php/File:MQTT_Sketch2.png]](((
242 +1. [[image:image-20220531141800-32.png]](((
215 215  Open Serial monitor.
244 +
245 +
246 +
216 216  )))
217 -1. [[~[~[image:https://wiki.dragino.com/images/thumb/9/98/MQTT_Sketch_1.png/400px-MQTT_Sketch_1.png~|~|height="261" width="400"~]~]>>url:https://wiki.dragino.com/index.php/File:MQTT_Sketch_1.png]](((
248 +1. [[image:image-20220531141842-33.png]](((
218 218  Open the Sketch [[MQTT_Client>>url:https://github.com/dragino/Arduino-Profile-Examples/tree/master/libraries/Dragino/examples/IoTServer/ThingSpeak/MQTT_Client]]. (Board:Arduino/Genuino Uno.Port:Serial ports.)and upload.
250 +
251 +
252 +
219 219  )))
220 -1. [[~[~[image:https://wiki.dragino.com/images/thumb/3/3d/MQTT_Sketch3.png/400px-MQTT_Sketch3.png~|~|height="371" width="400"~]~]>>url:https://wiki.dragino.com/index.php/File:MQTT_Sketch3.png]](((
254 +1. [[image:image-20220531141927-34.png]](((
221 221  Open Serial monitor.
256 +
257 +
258 +
222 222  )))
223 223  1. Go to IoT Server to check the result.
224 224  1. (((
225 -[[~[~[image:https://wiki.dragino.com/images/thumb/4/43/MQTT_result_1.png/400px-MQTT_result_1.png~|~|alt="MQTT result 1.png" height="181" width="400"~]~]>>url:https://wiki.dragino.com/index.php/File:MQTT_result_1.png]]
262 +[[image:image-20220531142023-35.png]]
263 +
264 +
265 +
226 226  )))
227 227  1. (((
228 -[[~[~[image:https://wiki.dragino.com/images/thumb/7/70/MQTT_result_2.png/400px-MQTT_result_2.png~|~|alt="MQTT result 2.png" height="190" width="400"~]~]>>url:https://wiki.dragino.com/index.php/File:MQTT_result_2.png]]
268 +[[image:image-20220531142155-36.png]]
269 +
270 +
271 +
229 229  )))
230 230  
231 231  = 5. FAQ =
... ... @@ -236,18 +236,25 @@
236 236  
237 237  For example: for ThingSpeak, a MQTT publish command is:
238 238  
239 -{{{mosquitto_pub -h mqtt.thingspeak.com -p 1883 -u dragino -P QZXTAKE88V3S7O2J -i dragino_Client -t channels/200893/publish/B9Z0R25QNVEBKIFY -m "field1=34&field2=89&status=MQTTPUBLISH"
240 -}}}
282 +(% class="box infomessage" %)
283 +(((
284 +**mosquitto_pub -h mqtt.thingspeak.com -p 1883 -u dragino -P QZXTAKE88V3S7O2J  -i dragino_Client -t channels/200893/publish/B9Z0R25QNVEBKIFY -m "field1=34&field2=89&status=MQTTPUBLISH"**
285 +)))
241 241  
242 242  What now we need to put in the LG01 is how to combine this command.
243 243  
244 244  1. LG01 web console -> Sensor -> MQTT
245 245  1. Choose general Server
246 -1. [[~[~[image:https://wiki.dragino.com/images/thumb/e/ea/MQTT_Configure1.png/600px-MQTT_Configure1.png~|~|height="367" width="600"~]~]>>url:https://wiki.dragino.com/index.php/File:MQTT_Configure1.png]](((
291 +1. [[image:image-20220531142342-37.png]](((
247 247  Refer to your server to fill in.
293 +
294 +
295 +
248 248  )))
249 -1. [[~[~[image:https://wiki.dragino.com/images/0/07/MQTT_Configure2.png~|~|height="93" width="538"~]~]>>url:https://wiki.dragino.com/index.php/File:MQTT_Configure2.png]](((
297 +1. [[image:image-20220531142447-38.png]](((
250 250  Ex:ThingSpeak Server
299 +
300 +
251 251  )))
252 252  
253 253  According to MQTT commands: mosquitto_pub, we need to put
... ... @@ -266,7 +266,7 @@
266 266  
267 267  User can also enable MQTT debug in the LG01 ~-~-> IoT Server settings and run logread in Linux console to see how the mqtt command is compose. below is an example:
268 268  
269 -[[~[~[image:https://wiki.dragino.com/images/thumb/8/81/MQTT_Configure3.png/600px-MQTT_Configure3.png~|~|height="114" width="600"~]~]>>url:https://wiki.dragino.com/index.php/File:MQTT_Configure3.png]]
319 +[[image:image-20220531142525-39.png]]
270 270  
271 271  MQTT Logread example
272 272  
... ... @@ -275,20 +275,33 @@
275 275  
276 276  LG01 for 4.3.3 version,we have added watchdog feature. In order to avoid the gateway running process will get stuck. So add writing action on every times.
277 277  
278 -* [[~[~[image:https://wiki.dragino.com/images/thumb/f/f2/Wathcdog.png/400px-Wathcdog.png~|~|height="184" width="400"~]~]>>url:https://wiki.dragino.com/index.php/File:Wathcdog.png]](((
328 +* [[image:image-20220531142558-40.png]](((
279 279  Enable Sensor->Micro-Controller settings
330 +
331 +
332 +
280 280  )))
281 -* [[~[~[image:https://wiki.dragino.com/images/thumb/8/82/MQTT_Sketch_2.png/400px-MQTT_Sketch_2.png~|~|height="233" width="400"~]~]>>url:https://wiki.dragino.com/index.php/File:MQTT_Sketch_2.png]](((
334 +* [[image:image-20220531142629-41.png]](((
282 282  Open the sketch [[MQTT_Simple_Server>>url:https://github.com/dragino/Arduino-Profile-Examples/tree/master/libraries/Dragino/examples/LoRa/MQTT_Simple_Server]].(Board:Dragino Yun + UNO or LG01/OLG01,Port:Network ports.)and upload.
336 +
337 +
338 +
283 283  )))
284 -* [[~[~[image:https://wiki.dragino.com/images/2/21/Loop.png~|~|height="181" width="388"~]~]>>url:https://wiki.dragino.com/index.php/File:Loop.png]](((
340 +* [[image:image-20220531142659-42.png]](((
285 285  Each time the function loops, it uses the watchdog function once.
342 +
343 +
344 +
286 286  )))
287 -* [[~[~[image:https://wiki.dragino.com/images/thumb/3/35/Dog.png/400px-Dog.png~|~|height="161" width="400"~]~]>>url:https://wiki.dragino.com/index.php/File:Dog.png]](((
346 +* [[image:image-20220531142720-43.png]](((
288 288  Open SSH and check watchdog result.If the result change constantly,the feature enable successfully.
348 +
349 +
350 +
289 289  )))
290 -* [[~[~[image:https://wiki.dragino.com/images/thumb/a/ac/Checkdog.png/400px-Checkdog.png~|~|height="222" width="400"~]~]>>url:https://wiki.dragino.com/index.php/File:Checkdog.png]](((
352 +* [[image:image-20220531142748-44.png]](((
291 291  If the time doesnt's change,you can refer it to calculate for checking status.
292 292  )))
293 293  
294 -== ==
356 +(% class="wikigeneratedid" id="H" %)
357 +
image-20220531141150-24.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.Xiaoling
Size
... ... @@ -1,0 +1,1 @@
1 +14.6 KB
Content
image-20220531141303-26.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.Xiaoling
Size
... ... @@ -1,0 +1,1 @@
1 +35.4 KB
Content
image-20220531141400-27.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.Xiaoling
Size
... ... @@ -1,0 +1,1 @@
1 +17.0 KB
Content
image-20220531141515-29.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.Xiaoling
Size
... ... @@ -1,0 +1,1 @@
1 +36.1 KB
Content
image-20220531141601-30.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.Xiaoling
Size
... ... @@ -1,0 +1,1 @@
1 +34.5 KB
Content
image-20220531141656-31.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.Xiaoling
Size
... ... @@ -1,0 +1,1 @@
1 +38.8 KB
Content
image-20220531141800-32.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.Xiaoling
Size
... ... @@ -1,0 +1,1 @@
1 +32.9 KB
Content
image-20220531141842-33.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.Xiaoling
Size
... ... @@ -1,0 +1,1 @@
1 +39.2 KB
Content
image-20220531141927-34.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.Xiaoling
Size
... ... @@ -1,0 +1,1 @@
1 +26.8 KB
Content
image-20220531142023-35.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.Xiaoling
Size
... ... @@ -1,0 +1,1 @@
1 +34.5 KB
Content
image-20220531142155-36.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.Xiaoling
Size
... ... @@ -1,0 +1,1 @@
1 +42.9 KB
Content
image-20220531142342-37.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.Xiaoling
Size
... ... @@ -1,0 +1,1 @@
1 +27.4 KB
Content
image-20220531142447-38.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.Xiaoling
Size
... ... @@ -1,0 +1,1 @@
1 +4.7 KB
Content
image-20220531142525-39.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.Xiaoling
Size
... ... @@ -1,0 +1,1 @@
1 +69.1 KB
Content
image-20220531142558-40.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.Xiaoling
Size
... ... @@ -1,0 +1,1 @@
1 +43.9 KB
Content
image-20220531142629-41.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.Xiaoling
Size
... ... @@ -1,0 +1,1 @@
1 +38.2 KB
Content
image-20220531142659-42.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.Xiaoling
Size
... ... @@ -1,0 +1,1 @@
1 +5.1 KB
Content
image-20220531142720-43.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.Xiaoling
Size
... ... @@ -1,0 +1,1 @@
1 +13.3 KB
Content
image-20220531142748-44.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.Xiaoling
Size
... ... @@ -1,0 +1,1 @@
1 +11.5 KB
Content