Changes for page Through MQTT to upload data
Last modified by Xiaoling on 2022/09/02 18:11
Summary
-
Page properties (1 modified, 0 added, 0 removed)
-
Attachments (0 modified, 0 added, 5 removed)
Details
- Page properties
-
- Content
-
... ... @@ -1,5 +3,3 @@ 1 -**Contents: ** 2 - 3 3 {{toc/}} 4 4 5 5 ... ... @@ -23,12 +23,9 @@ 23 23 * Notification mechanism, notify the transmission of both sides when an exception occurs 24 24 25 25 26 - 27 27 = 3. What does this example shows? How it works? = 28 28 29 -((( 30 30 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 -))) 32 32 33 33 [[image:image-20220531135402-1.png]] 34 34 ... ... @@ -42,28 +42,19 @@ 42 42 43 43 [[image:image-20220531135521-3.png]] 44 44 45 -((( 46 46 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 -))) 48 48 49 49 50 50 51 51 [[image:image-20220531135607-4.png]] 52 52 53 -((( 54 54 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 -))) 56 56 57 -((( 58 58 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 -))) 60 60 61 -((( 62 62 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 -))) 64 64 65 65 66 - 67 67 = 4. Preparation = 68 68 69 69 == 4.1 Hardware == ... ... @@ -78,6 +78,7 @@ 78 78 The LoRa End node keeps getting temperature and humidity from the sensor and sends out via LoRa periodically. 79 79 ))) 80 80 67 + 81 81 == 4.2 Software == 82 82 83 83 1. [[4.3.4 version>>url:http://www.dragino.com/downloads/index.php?dir=motherboards/ms14/Firmware/IoT/]] ... ... @@ -86,13 +86,11 @@ 86 86 1. [[DHTlib>>url:https://github.com/goodcheney/Lora/blob/patch-1/Lora%20Shield/Examples/DHTlib.zip]] 87 87 88 88 89 - 90 90 == 4.3 Server(For example) == 91 91 92 92 * [[ThingSpeak>>url:https://thingspeak.com/]] 93 93 94 94 95 - 96 96 == 4.4 Configure IoT Server == 97 97 98 98 * Need this keys: ... ... @@ -111,14 +111,11 @@ 111 111 ))) 112 112 1. ((( 113 113 [[image:image-20220531140304-12.png]] 114 - 115 - 116 - 117 117 ))) 118 118 101 + 119 119 == 4.5 Configure LG01 settings == 120 120 121 - 122 122 Tips:Please confirm that your LG01 version is 4.3.3. 123 123 124 124 [[image:image-20220531140248-11.png]] ... ... @@ -241,7 +241,8 @@ 241 241 1. Send reply after then receive LoRa node data. 242 242 1. Sketch will write active content to /tmp/iot/status periodically (every 5 minutes).(Watchdog feature) 243 243 244 -1. [[image:image-20220531143822-49.png]]((( 226 + 227 +1. [[image:image-20220531141656-31.png]]((( 245 245 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. 246 246 247 247 ... ... @@ -253,7 +253,7 @@ 253 253 254 254 255 255 ))) 256 -1. [[image:image-2022053114 3748-48.png]](((239 +1. [[image:image-20220531141842-33.png]]((( 257 257 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. 258 258 259 259 ... ... @@ -267,13 +267,13 @@ 267 267 ))) 268 268 1. Go to IoT Server to check the result. 269 269 1. ((( 270 -[[image:image-2022053114 3707-47.png]]253 +[[image:image-20220531142023-35.png]] 271 271 272 272 273 273 274 274 ))) 275 275 1. ((( 276 -[[image:image-2022053114 3632-46.png]]259 +[[image:image-20220531142155-36.png]] 277 277 278 278 279 279 ... ... @@ -357,9 +357,8 @@ 357 357 358 358 359 359 ))) 360 -* [[image:image-2 0220531142748-44.png]](((343 +* [[~[~[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]]((( 361 361 If the time doesnt's change,you can refer it to calculate for checking status. 362 362 ))) 363 363 364 -(% class="wikigeneratedid" id="H" %) 365 - 347 +== ==
- image-20220531143604-45.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.Xiaoling - Size
-
... ... @@ -1,1 +1,0 @@ 1 -42.6 KB - Content
- image-20220531143632-46.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.Xiaoling - Size
-
... ... @@ -1,1 +1,0 @@ 1 -42.4 KB - Content
- image-20220531143707-47.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.Xiaoling - Size
-
... ... @@ -1,1 +1,0 @@ 1 -34.2 KB - Content
- image-20220531143748-48.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.Xiaoling - Size
-
... ... @@ -1,1 +1,0 @@ 1 -38.8 KB - Content
- image-20220531143822-49.png
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -XWiki.Xiaoling - Size
-
... ... @@ -1,1 +1,0 @@ 1 -38.1 KB - Content