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

From version 22.2
edited by Xiaoling
on 2022/05/31 14:09
Change comment: There is no comment for this version
To version 38.1
edited by Xiaoling
on 2022/05/31 14:25
Change comment: Uploaded new attachment "image-20220531142525-39.png", version {1}

Summary

Details

Page properties
Content
... ... @@ -153,40 +153,65 @@
153 153  )))
154 154  1. [[image:image-20220531140915-21.png]](((
155 155  First, we need to make sure the LG01 has internet access. We can log in the SSH and ping an Internet address and see if it get through. As below
156 +
157 +
156 156  )))
157 -1. [[~[~[image:https://wiki.dragino.com/images/thumb/6/63/3_3.png/400px-3_3.png~|~|height="213" width="400"~]~]>>url:https://wiki.dragino.com/index.php/File:3_3.png]](((
159 +1. [[image:image-20220531140955-22.png]](((
158 158  LG01 has built-in Linux tool mosquitto. It is a very powerful tool for http communication. We can use this tool to handle MQTT API call in LG01. Input this command and replace your keys.
161 +
162 +
163 +
159 159  )))
160 -1. [[~[~[image:https://wiki.dragino.com/images/thumb/3/35/3_4.png/500px-3_4.png~|~|height="180" width="500"~]~]>>url:https://wiki.dragino.com/index.php/File:3_4.png]](((
165 +1. [[image:image-20220531141026-23.png]](((
161 161  Go to Server check out result.We success to use LG01 to uplink data to ThingSpeak,the mosquitto_pub command is executed in the Linux side, finally, we will have to call mosquitto_pub command with sensor data variable in Arduino side. This is through the process class in Arduino and we will show it in the final sketch.
162 162  )))
163 163  
164 164  * This command:
165 165  
166 -{{{mosquitto_pub -h mqtt.thingspeak.com -p 1883 -u dragino -P UZ4NGHKJMKS9WR5E -i dragino_Client -t channels/399171/publish/A4NNF6G8G63JOIUV -m "field1=23.5&field2=57.5&status=MQTTPUBLISH"
167 -}}}
171 +(% class="box infomessage" %)
172 +(((
173 +**mosquitto_pub -h mqtt.thingspeak.com -p 1883 -u dragino -P UZ4NGHKJMKS9WR5E  -i dragino_Client -t channels/399171/publish/A4NNF6G8G63JOIUV -m "field1=23.5&field2=57.5&status=MQTTPUBLISH"**
174 +)))
168 168  
169 169  * Need replace:
170 170  
171 -{{{UZ4NGHKJMKS9WR5E //MQTT API
172 -399171 //Channel ID
173 -A4NNF6G8G63JOIUV //Write API Key
174 -}}}
178 +(% class="box infomessage" %)
179 +(((
180 +**UZ4NGHKJMKS9WR5E  ~/~/MQTT API
181 +399171            ~/~/Channel ID
182 +A4NNF6G8G63JOIUV  ~/~/Write API Key**
183 +)))
175 175  
176 176  
177 177  === 4.6.2 Input the command at the console(LG01 new version:4.3.4) ===
178 178  
179 -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]](((
188 +1. [[image:image-20220531141150-24.png]](((
180 180  Open this Application.
190 +
191 +
192 +
181 181  )))
182 -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]](((
194 +1. (((
195 +[[image:image-20220531141400-27.png]]
196 +
183 183  Check the settings.
198 +
199 +
200 +
184 184  )))
185 -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]](((
202 +1. (((
203 +[[image:image-20220531141601-30.png]]
204 +
186 186  input this command.
206 +
207 +
208 +
187 187  )))
188 -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]](((
210 +1. [[image:image-20220531141515-29.png]](((
189 189  Check the result.
212 +
213 +
214 +
190 190  )))
191 191  
192 192  == 4.7 Updata data to Server(Through MQTT) ==
... ... @@ -199,24 +199,42 @@
199 199  1. Sketch will write active content to /tmp/iot/status periodically (every 5 minutes).(Watchdog feature)
200 200  
201 201  
202 -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]](((
227 +1. [[image:image-20220531141656-31.png]](((
203 203  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.
229 +
230 +
231 +
204 204  )))
205 -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]](((
233 +1. [[image:image-20220531141800-32.png]](((
206 206  Open Serial monitor.
235 +
236 +
237 +
207 207  )))
208 -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]](((
239 +1. [[image:image-20220531141842-33.png]](((
209 209  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.
241 +
242 +
243 +
210 210  )))
211 -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]](((
245 +1. [[image:image-20220531141927-34.png]](((
212 212  Open Serial monitor.
247 +
248 +
249 +
213 213  )))
214 214  1. Go to IoT Server to check the result.
215 215  1. (((
216 -[[~[~[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]]
253 +[[image:image-20220531142023-35.png]]
254 +
255 +
256 +
217 217  )))
218 218  1. (((
219 -[[~[~[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]]
259 +[[image:image-20220531142155-36.png]]
260 +
261 +
262 +
220 220  )))
221 221  
222 222  = 5. FAQ =
... ... @@ -227,18 +227,25 @@
227 227  
228 228  For example: for ThingSpeak, a MQTT publish command is:
229 229  
230 -{{{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"
231 -}}}
273 +(% class="box infomessage" %)
274 +(((
275 +**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"**
276 +)))
232 232  
233 233  What now we need to put in the LG01 is how to combine this command.
234 234  
235 235  1. LG01 web console -> Sensor -> MQTT
236 236  1. Choose general Server
237 -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]](((
282 +1. [[image:image-20220531142342-37.png]](((
238 238  Refer to your server to fill in.
284 +
285 +
286 +
239 239  )))
240 -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]](((
288 +1. [[image:image-20220531142447-38.png]](((
241 241  Ex:ThingSpeak Server
290 +
291 +
242 242  )))
243 243  
244 244  According to MQTT commands: mosquitto_pub, we need to put
image-20220531140955-22.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.Xiaoling
Size
... ... @@ -1,0 +1,1 @@
1 +36.1 KB
Content
image-20220531141026-23.png
Author
... ... @@ -1,0 +1,1 @@
1 +XWiki.Xiaoling
Size
... ... @@ -1,0 +1,1 @@
1 +22.8 KB
Content
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