Last modified by Xiaoling on 2023/04/20 18:14
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -1,14 +1,19 @@ 1 - 1 + **Contents:** 2 2 3 - = Introduction =3 +{{toc/}} 4 4 5 + 6 += 1. Introduction = 7 + 5 5 The Dragino LoRaWAN gateway can commuicate with LoRaWAN ABP End Node without the need of LoRaWAN server. It can be used in some cases such as: 6 6 7 7 * No internet connection. 8 8 * User wants to get data forward in gateway and forward to their server base on MQTT/HTTP, etc. (Combine ABP communication method and [[MQTT forward together>>url:https://wiki.dragino.com/index.php/MQTT_Forward_Instruction]]). 9 9 13 +((( 10 10 11 -The basic of this feature is the decoding of LoRaWAN ABP End Node. Requirements: 15 +The basic of this feature is the decoding of **LoRaWAN ABP End Node**. Requirements: 16 +))) 12 12 13 13 1. LoRaWAN End Node in ABP mode. Make sure your end node works in this mode. End node most are default set to OTAA mode 14 14 1. LoRaWAN Gateway model: [[LPS8>>url:http://www.dragino.com/products/lora-lorawan-gateway/item/148-lps8.html]], [[LG308>>url:http://www.dragino.com/products/lora-lorawan-gateway/item/140-lg308.html]], [[DLOS8>>url:http://www.dragino.com/products/lora-lorawan-gateway/item/160-dlos8.html]] ,[[LIG16>>url:http://www.dragino.com/products/lora-lorawan-gateway/item/171-lig16.html]] ... ... @@ -15,37 +15,40 @@ 15 15 1. Firmware version for below instruction:[[Since LG02_LG08~~-~~-build-v5.4.1593400722-20200629-1120>>url:http://www.dragino.com/downloads/index.php?dir=LoRa_Gateway/LPS8/Firmware/Release/]] 16 16 17 17 18 -= How it works = 23 += 2. How it works = 19 19 20 20 21 - \\Video Instruction: [[https:~~/~~/youtu.be/ZBjXwmp7rwM>>url:https://youtu.be/ZBjXwmp7rwM]]26 +**Video Instruction**: [[https:~~/~~/youtu.be/ZBjXwmp7rwM>>url:https://youtu.be/ZBjXwmp7rwM]] 22 22 23 - 24 -\\ 25 - 26 26 Assume we have the LoRaWAN tracker LGT92 which works in ABP mode and US915 band. It has below keys: 27 27 28 -{{{AT+NWKSKEY=72 32 63 95 dd 8f e2 b2 13 66 e4 35 93 8f 55 df 30 +(% class="box infomessage" %) 31 +((( 32 +AT+NWKSKEY=72 32 63 95 dd 8f e2 b2 13 66 e4 35 93 8f 55 df 29 29 AT+APPSKEY=b3 17 f8 14 7a 43 27 8a 6a 31 c4 47 3d 55 5d 33 30 30 AT+DADDR=2602111D 31 - }}}35 +))) 32 32 37 +((( 33 33 and we have the LG308 works and US915 band and support ABP decryption. User can input these keys in LG308 so the LG308 can communicate with LGT92. 39 +))) 34 34 35 35 We need to input above keys in LG308 and enable ABP decryption. 36 36 37 -[[ ~[~[image:https://wiki.dragino.com/images/thumb/5/55/LG308_MQTT_1.png/600px-LG308_MQTT_1.png~|~|height="329" width="600"~]~]>>url:https://wiki.dragino.com/index.php/File:LG308_MQTT_1.png]]43 +[[image:https://wiki.dragino.com/images/thumb/5/55/LG308_MQTT_1.png/600px-LG308_MQTT_1.png||height="329" width="600"]] 38 38 39 39 Input the ABP keys in LG308 40 40 41 41 42 -== Upstream == 48 +== 2.1 Upstream == 43 43 44 44 Now when this End Node (Dev Addr=2602111D) send a uplink packet. When this packet arrive LG308, LG308 will decode it and put the decode data on the file /var/iot/channels/2602111D . So we have this data for further process with other applications in LG308. 45 45 52 +((( 46 46 We can see the log of LG308 to know this packet arrive 54 +))) 47 47 48 -[[ ~[~[image:https://wiki.dragino.com/images/thumb/1/16/ABP_DECODE_2.png/600px-ABP_DECODE_2.png~|~|height="205" width="600"~]~]>>url:https://wiki.dragino.com/index.php/File:ABP_DECODE_2.png]]56 +[[image:https://wiki.dragino.com/images/thumb/1/16/ABP_DECODE_2.png/600px-ABP_DECODE_2.png||height="205" width="600"]] 49 49 50 50 LG308 log by "logread -f" command 51 51 ... ... @@ -52,59 +52,70 @@ 52 52 53 53 The data of End Node is stored in the file /var/iot/channels/2602111D. We can use hexdump command to check it. 54 54 55 -{{{root@dragino-1d25dc:~# hexdump /var/iot/channels/2602111D 56 -0000000 4646 4646 4646 3946 3030 3030 3030 3546 --> Got RSSI and SNR 57 -0000010 cc0c 0b63 0266 017f ff7f ff00 --> Payload 63 +(% class="box" %) 64 +((( 65 +root@dragino-1d25dc:~~# hexdump /var/iot/channels/2602111D 66 +0000000 (% class="mark" %)**4646 4646 4646 3946 3030 3030 3030 3546**(%%) ~-~-> Got RSSI and SNR 67 +0000010 (% class="mark" %)**cc0c 0b63 0266 017f ff7f ff00 **(%%) ~-~-> Payload 58 58 000001c 59 - }}}69 +))) 60 60 61 61 * RSSI: 4646 4646 4646 3946 = 0xFFFF FF9F : So RSSI = (0xFFFF FF9F - 0x100000000) = -97 62 62 * SNR: 3030 3030 3030 3546 = 0x0000 005F = 95, need to divide 10 so SNR is 9.5 63 63 * Payload: 0xcc0c 0b63 0266 017f ff7f ff00 64 64 65 - 66 -{{{Notice 1: The data file stored in LG308 for the end node is bin file. If the end node sends ASCII string to gateway, the output will as below: 67 -in LGT92, use AT+SEND=12:hello world to send ASCII string 68 -root@dragino-1d25dc:~# hexdump /var/iot/channels/2602111D 75 +(% class="box" %) 76 +((( 77 +(% class="mark" %)**Notice 1**(%%): The data file stored in LG308 for the end node is bin file. If the end node sends ASCII string to gateway, the output will as below: 78 +in LGT92, use **AT+SEND=12**:hello world to send ASCII string 79 +root@dragino-1d25dc:~~# hexdump /var/iot/channels/2602111D 69 69 0000000 4646 4646 4646 3946 3030 3030 3030 3546 70 -0000010 6865 6c6c 6f20 776f 726c 6400 81 +0000010 6865 6c6c 6f20 776f 726c 6400 ~-~-> Got ASCII code "hello world" 71 71 000001c 72 - }}}83 +))) 73 73 74 -{{{Notice 2: The upstream payload length should match the LoRaWAN length requirement (max length depends on Frequency and DR), otherwise the gateway can't decode the payload. 75 -}}} 85 +(% class="box" %) 86 +((( 87 +(% class="mark" %)**Notice 2**(%%): The upstream payload length should match the LoRaWAN length requirement (max length depends on Frequency and DR), otherwise the gateway can't decode the payload. 88 +))) 76 76 77 -=== Decode Method === 90 +=== 2.2.1 Decode Method === 78 78 79 -The decode methods: ASCII String, Decode_LHT65 doesn't affect how the sensor data is stored, they are to define how should the sensor data to be sent. 92 +The decode methods: **ASCII String, Decode_LHT65** doesn't affect how the sensor data is stored, they are to define how should the sensor data to be sent. 80 80 81 81 For example we have a LHT65 , works in ABP mode and gateway successful get the data, which are: 82 82 83 -{{{root@dragino-1baf44:~# hexdump /var/iot/channels/01826108 96 +(% class="box" %) 97 +((( 98 +root@dragino-1baf44:~~# hexdump /var/iot/channels/01826108 84 84 0000000 4646 4646 4646 4537 3030 3030 3030 3438 85 -0000010 ccd1 7fff 7fff 017f ff7f ff00 100 +0000010 ccd1 7fff 7fff 017f ff7f ff00 86 86 000001c 87 - }}}102 +))) 88 88 89 89 If we choose ASCII decoder, the MQTT process will send out with mqtt-data: 90 90 91 -{{{Sun Sep 27 04:33:16 2020 user.notice root: [IoT.MQTT]:pub_topic[-t]: dragino-1baf44/01826108/data 106 +(% class="box" %) 107 +((( 108 +Sun Sep 27 04:33:16 2020 user.notice root: [IoT.MQTT]:pub_topic[-t]: dragino-1baf44/01826108/data 92 92 Sun Sep 27 04:33:16 2020 user.notice root: [IoT.MQTT]:decoder: ASCII 93 93 Sun Sep 27 04:33:16 2020 user.notice root: [IoT.MQTT]:mqtt_data[-m]: ffffffe700000048ccd17fff7fff017fff7fff00 94 - }}}111 +))) 95 95 96 96 If we choose Decode_LHT65, the MQTT process will send out with mqtt-data 97 97 98 -{{{Sun Sep 27 04:36:45 2020 user.notice root: [IoT.MQTT]:pub_topic[-t]: dragino-1baf44/01826108/data 115 +(% class="box" %) 116 +((( 117 +Sun Sep 27 04:36:45 2020 user.notice root: [IoT.MQTT]:pub_topic[-t]: dragino-1baf44/01826108/data 99 99 Sun Sep 27 04:36:45 2020 user.notice root: [IoT.MQTT]:decoder: Dragino_LHT65 100 100 Sun Sep 27 04:36:45 2020 user.notice root: [IoT.MQTT]:mqtt_data[-m]: {"Hum_SHT":32.7,"BatV":3.281,"TempC_DS":32.9, 101 101 "EXT":"Temperature Sensor","RSSI":-24,"TempC_SHT":85.0,"SNR":8.2,"ext_sensor":0} 102 - }}}121 +))) 103 103 104 104 Above scripts are store in /etc/lora/decoder/. User can put their scripts here and select it in the UI. 105 105 106 106 107 -=== How to Decode My End Node === 126 +=== 2.2.2 How to Decode My End Node === 108 108 109 109 1/ Configure the ABP keys for your end node in the gateway. enable ABP decode in Web UI 110 110 ... ... @@ -126,9 +126,8 @@ 126 126 * the last line return is what will be used for MQTT 127 127 * User can use other language ,not limited to Lua, just make sure the return is what you want to send. 128 128 148 +== 2.2 Downstream == 129 129 130 -== Downstream == 131 - 132 132 In LG308, we can create a file in the directory /var/iot/push for downstream purpose. We recommend using each command to generate this file. This file will be used for transmission and auto-deleted after used 133 133 134 134 The file should use below format: ... ... @@ -221,7 +221,7 @@ 221 221 2:3132333435363738 --> ASCII string "12345678" 222 222 }}} 223 223 224 -= Example 1: Communicate with LT-22222-L = 242 += 3. Example 1: Communicate with LT-22222-L = 225 225 226 226 Script can be download from: [[Example Script 1>>url:http://www.dragino.com/downloads/index.php?dir=LoRa_Gateway/LPS8/Firmware/customized_script/&file=talk_to_lt-22222-l_v0.1.sh]] 227 227 ... ... @@ -262,7 +262,7 @@ 262 262 263 263 ~1. Input keys 264 264 265 -[[ ~[~[image:https://wiki.dragino.com/images/thumb/b/bf/LPS8_LT-22222_1.png/600px-LPS8_LT-22222_1.png~|~|height="335" width="600"~]~]>>url:https://wiki.dragino.com/index.php/File:LPS8_LT-22222_1.png]]283 +[[image:https://wiki.dragino.com/images/thumb/b/bf/LPS8_LT-22222_1.png/600px-LPS8_LT-22222_1.png||height="335" width="600"]] 266 266 267 267 Input Keys in LPS8 268 268 ... ... @@ -270,26 +270,26 @@ 270 270 271 271 3. Choose Built-in server 272 272 273 -[[ ~[~[image:https://wiki.dragino.com/images/thumb/d/d7/LPS8_LT-22222_2.png/600px-LPS8_LT-22222_2.png~|~|height="264" width="600"~]~]>>url:https://wiki.dragino.com/index.php/File:LPS8_LT-22222_2.png]]291 +[[image:https://wiki.dragino.com/images/thumb/d/d7/LPS8_LT-22222_2.png/600px-LPS8_LT-22222_2.png||height="264" width="600"]] 274 274 275 275 Choose Built-in server 276 276 277 277 4. Run the script. 278 278 279 -[[ ~[~[image:https://wiki.dragino.com/images/thumb/3/39/LPS8_LT-22222_3.png/600px-LPS8_LT-22222_3.png~|~|height="389" width="600"~]~]>>url:https://wiki.dragino.com/index.php/File:LPS8_LT-22222_3.png]]297 +[[image:https://wiki.dragino.com/images/thumb/3/39/LPS8_LT-22222_3.png/600px-LPS8_LT-22222_3.png||height="389" width="600"]] 280 280 281 281 Run the script 282 282 283 283 5. Output: 284 284 285 -[[ ~[~[image:https://wiki.dragino.com/images/thumb/f/fe/LPS8_LT-22222_4.png/600px-LPS8_LT-22222_4.png~|~|height="433" width="600"~]~]>>url:https://wiki.dragino.com/index.php/File:LPS8_LT-22222_4.png]]303 +[[image:https://wiki.dragino.com/images/thumb/f/fe/LPS8_LT-22222_4.png/600px-LPS8_LT-22222_4.png||height="433" width="600"]] 286 286 287 287 Output from LPS8 288 288 289 289 290 -= Example 2: Communicate to TCP Server = 308 += 4. Example 2: Communicate to TCP Server = 291 291 292 -[[ ~[~[image:https://wiki.dragino.com/images/thumb/7/75/LPS8_TCP_0.png/600px-LPS8_TCP_0.png~|~|height="370" width="600"~]~]>>url:https://wiki.dragino.com/index.php/File:LPS8_TCP_0.png]]310 +[[image:https://wiki.dragino.com/images/thumb/7/75/LPS8_TCP_0.png/600px-LPS8_TCP_0.png||height="370" width="600"]] 293 293 294 294 Network Structure 295 295 ... ... @@ -304,13 +304,13 @@ 304 304 305 305 Assume we already set up ABP keys in the gateway: 306 306 307 -[[ ~[~[image:https://wiki.dragino.com/images/thumb/b/bf/LPS8_LT-22222_1.png/600px-LPS8_LT-22222_1.png~|~|height="335" width="600"~]~]>>url:https://wiki.dragino.com/index.php/File:LPS8_LT-22222_1.png]]325 +[[image:https://wiki.dragino.com/images/thumb/b/bf/LPS8_LT-22222_1.png/600px-LPS8_LT-22222_1.png||height="335" width="600"]] 308 308 309 309 Input Keys in LPS8 310 310 311 311 run socket tool in PC 312 312 313 -[[ ~[~[image:https://wiki.dragino.com/images/thumb/4/4b/LPS8_TCP_2.png/600px-LPS8_TCP_2.png~|~|height="212" width="600"~]~]>>url:https://wiki.dragino.com/index.php/File:LPS8_TCP_2.png]]331 +[[image:https://wiki.dragino.com/images/thumb/4/4b/LPS8_TCP_2.png/600px-LPS8_TCP_2.png||height="212" width="600"]] 314 314 315 315 Socket tool 316 316 ... ... @@ -317,7 +317,7 @@ 317 317 318 318 Input Server address and port 319 319 320 -[[ ~[~[image:https://wiki.dragino.com/images/thumb/c/c6/LPS8_TCP_3.png/600px-LPS8_TCP_3.png~|~|height="306" width="600"~]~]>>url:https://wiki.dragino.com/index.php/File:LPS8_TCP_3.png]]338 +[[image:https://wiki.dragino.com/images/thumb/c/c6/LPS8_TCP_3.png/600px-LPS8_TCP_3.png||height="306" width="600"]] 321 321 322 322 Input Server address and port 323 323 ... ... @@ -324,7 +324,7 @@ 324 324 325 325 See value receive in socket tool. : 326 326 327 -[[ ~[~[image:https://wiki.dragino.com/images/thumb/2/20/LPS8_TCP_4.png/600px-LPS8_TCP_4.png~|~|height="219" width="600"~]~]>>url:https://wiki.dragino.com/index.php/File:LPS8_TCP_4.png]]345 +[[image:https://wiki.dragino.com/images/thumb/2/20/LPS8_TCP_4.png/600px-LPS8_TCP_4.png||height="219" width="600"]] 328 328 329 329 value receive in socket tool 330 330