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)
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,25 +42,17 @@ 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 66 = 4. Preparation = ... ... @@ -77,6 +77,7 @@ 77 77 The LoRa End node keeps getting temperature and humidity from the sensor and sends out via LoRa periodically. 78 78 ))) 79 79 67 + 80 80 == 4.2 Software == 81 81 82 82 1. [[4.3.4 version>>url:http://www.dragino.com/downloads/index.php?dir=motherboards/ms14/Firmware/IoT/]] ... ... @@ -84,10 +84,12 @@ 84 84 1. [[MQTT_Simple_Server MQTT_Simeple_Server>>url:https://github.com/dragino/Arduino-Profile-Examples/tree/master/libraries/Dragino/examples/LoRa/MQTT_Simple_Server]] 85 85 1. [[DHTlib>>url:https://github.com/goodcheney/Lora/blob/patch-1/Lora%20Shield/Examples/DHTlib.zip]] 86 86 75 + 87 87 == 4.3 Server(For example) == 88 88 89 89 * [[ThingSpeak>>url:https://thingspeak.com/]] 90 90 80 + 91 91 == 4.4 Configure IoT Server == 92 92 93 93 * Need this keys: ... ... @@ -108,6 +108,7 @@ 108 108 [[image:image-20220531140304-12.png]] 109 109 ))) 110 110 101 + 111 111 == 4.5 Configure LG01 settings == 112 112 113 113 Tips:Please confirm that your LG01 version is 4.3.3. ... ... @@ -232,6 +232,7 @@ 232 232 1. Send reply after then receive LoRa node data. 233 233 1. Sketch will write active content to /tmp/iot/status periodically (every 5 minutes).(Watchdog feature) 234 234 226 + 235 235 1. [[image:image-20220531141656-31.png]]((( 236 236 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. 237 237 ... ... @@ -352,5 +352,4 @@ 352 352 If the time doesnt's change,you can refer it to calculate for checking status. 353 353 ))) 354 354 355 -(% class="wikigeneratedid" id="H" %) 356 - 347 +== ==