Changes for page RS485-LN – RS485 to LoRaWAN Converter User Manual
Last modified by Karry Zhuang on 2025/03/06 16:34
Summary
-
Page properties (1 modified, 0 added, 0 removed)
-
Attachments (0 modified, 3 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -41,6 +41,7 @@ 41 41 42 42 == 1.2 Specifications == 43 43 44 + 44 44 **Hardware System:** 45 45 46 46 * STM32L072CZT6 MCU ... ... @@ -75,6 +75,8 @@ 75 75 * Automatic RF Sense and CAD with ultra-fast AFC. 76 76 * Packet engine up to 256 bytes with CRC. 77 77 79 + 80 + 78 78 == 1.3 Features == 79 79 80 80 * LoRaWAN Class A & Class C protocol (default Class C) ... ... @@ -86,6 +86,8 @@ 86 86 * Support Modbus protocol 87 87 * Support Interrupt uplink (Since hardware version v1.2) 88 88 92 + 93 + 89 89 == 1.4 Applications == 90 90 91 91 * Smart Buildings & Home Automation ... ... @@ -95,10 +95,13 @@ 95 95 * Smart Cities 96 96 * Smart Factory 97 97 103 + 104 + 98 98 == 1.5 Firmware Change log == 99 99 100 100 [[RS485-LN Image files – Download link and Change log>>url:http://www.dragino.com/downloads/index.php?dir=RS485-LN/]] 101 101 109 + 102 102 == 1.6 Hardware Change log == 103 103 104 104 ((( ... ... @@ -106,6 +106,8 @@ 106 106 v1.2: Add External Interrupt Pin. 107 107 108 108 v1.0: Release 117 + 118 + 109 109 ))) 110 110 ))) 111 111 ... ... @@ -122,6 +122,8 @@ 122 122 ))) 123 123 124 124 [[image:1653268091319-405.png]] 135 + 136 + 125 125 ))) 126 126 127 127 = 3. Operation Mode = ... ... @@ -130,6 +130,8 @@ 130 130 131 131 ((( 132 132 The RS485-LN is configured as LoRaWAN OTAA Class C mode by default. It has OTAA keys to join network. To connect a local LoRaWAN network, user just need to input the OTAA keys in the network server and power on the RS485-LN. It will auto join the network via OTAA. 145 + 146 + 133 133 ))) 134 134 135 135 == 3.2 Example to join LoRaWAN network == ... ... @@ -138,10 +138,15 @@ 138 138 139 139 [[image:1653268155545-638.png||height="334" width="724"]] 140 140 155 + 141 141 ((( 157 +((( 142 142 The RS485-LN in this example connected to two RS485 devices for demonstration, user can connect to other RS485 devices via the same method. The connection is as below: 159 +))) 143 143 161 +((( 144 144 485A+ and 485B- of the sensor are connected to RS485A and RA485B of RS485-LN respectively. 163 +))) 145 145 146 146 [[image:1653268227651-549.png||height="592" width="720"]] 147 147 ... ... @@ -193,6 +193,7 @@ 193 193 194 194 [[image:1652953568895-172.png||height="232" width="724"]] 195 195 215 + 196 196 == 3.3 Configure Commands to read data == 197 197 198 198 ((( ... ... @@ -202,6 +202,8 @@ 202 202 203 203 ((( 204 204 (% style="color:red" %)Note: below description and commands are for firmware version >v1.1, if you have firmware version v1.0. Please check the [[user manual v1.0>>url:http://www.dragino.com/downloads/index.php?dir=RS485-LN/&file=RS485-LN_UserManual_v1.0.1.pdf]] or upgrade the firmware to v1.1 225 + 226 + 205 205 ))) 206 206 ))) 207 207 ... ... @@ -209,19 +209,19 @@ 209 209 210 210 To use RS485-LN to read data from RS485 sensors, connect the RS485-LN A/B traces to the sensors. And user need to make sure RS485-LN use the match UART setting to access the sensors. The related commands for UART settings are: 211 211 212 -(% border="1" style="background-color:#ffffcc; color:green; width:7 95px" %)213 -|((( 234 +(% border="1" style="background-color:#ffffcc; color:green; width:782px" %) 235 +|(% style="width:128px" %)((( 214 214 **AT Commands** 215 -)))|(% style="width: 285px" %)(((237 +)))|(% style="width:305px" %)((( 216 216 **Description** 217 -)))|(% style="width:34 7px" %)(((239 +)))|(% style="width:346px" %)((( 218 218 **Example** 219 219 ))) 220 -|((( 242 +|(% style="width:128px" %)((( 221 221 AT+BAUDR 222 -)))|(% style="width: 285px" %)(((244 +)))|(% style="width:305px" %)((( 223 223 Set the baud rate (for RS485 connection). Default Value is: 9600. 224 -)))|(% style="width:34 7px" %)(((246 +)))|(% style="width:346px" %)((( 225 225 ((( 226 226 AT+BAUDR=9600 227 227 ))) ... ... @@ -230,11 +230,11 @@ 230 230 Options: (1200,2400,4800,14400,19200,115200) 231 231 ))) 232 232 ))) 233 -|((( 255 +|(% style="width:128px" %)((( 234 234 AT+PARITY 235 -)))|(% style="width: 285px" %)(((257 +)))|(% style="width:305px" %)((( 236 236 Set UART parity (for RS485 connection) 237 -)))|(% style="width:34 7px" %)(((259 +)))|(% style="width:346px" %)((( 238 238 ((( 239 239 AT+PARITY=0 240 240 ))) ... ... @@ -243,9 +243,9 @@ 243 243 Option: 0: no parity, 1: odd parity, 2: even parity 244 244 ))) 245 245 ))) 246 -|((( 268 +|(% style="width:128px" %)((( 247 247 AT+STOPBIT 248 -)))|(% style="width: 285px" %)(((270 +)))|(% style="width:305px" %)((( 249 249 ((( 250 250 Set serial stopbit (for RS485 connection) 251 251 ))) ... ... @@ -253,7 +253,7 @@ 253 253 ((( 254 254 255 255 ))) 256 -)))|(% style="width:34 7px" %)(((278 +)))|(% style="width:346px" %)((( 257 257 ((( 258 258 AT+STOPBIT=0 for 1bit 259 259 ))) ... ... @@ -267,6 +267,8 @@ 267 267 ))) 268 268 ))) 269 269 292 + 293 + 270 270 === 3.3.2 Configure sensors === 271 271 272 272 ((( ... ... @@ -285,80 +285,41 @@ 285 285 mm: 0: no CRC, 1: add CRC-16/MODBUS in the end of this command 286 286 )))|(% style="width:256px" %)AT+CFGDEV=xx xx xx xx xx xx xx xx xx xx xx xx,m 287 287 288 -=== 3.3.3 Configure read commands for each sampling === 289 289 290 -((( 291 -RS485-BL is a battery powered device; it will sleep most of time. And wake up on each period and read RS485 / TTL sensor data and uplink. 292 -))) 293 293 294 -((( 295 -During each sampling, we need to confirm what commands we need to send to the sensors to read data. After the RS485/TTL sensors send back the value, it normally includes some bytes and we only need a few from them for a shorten payload. 296 -))) 314 +=== 3.3.3 Configure read commands for each sampling === 297 297 298 298 ((( 317 +During each sampling, we need confirm what commands we need to send to the RS485 sensors to read data. After the RS485 sensors send back the value, it normally include some bytes and we only need a few from them for a shorten payload. 318 + 299 299 To save the LoRaWAN network bandwidth, we might need to read data from different sensors and combine their valid value into a short payload. 300 -))) 301 301 302 -((( 303 303 This section describes how to achieve above goals. 304 -))) 305 305 306 -((( 307 -During each sampling, the RS485-BL can support 15 commands to read sensors. And combine the return to one or several uplink payloads. 308 -))) 323 +During each sampling, the RS485-LN can support 15 commands to read sensors. And combine the return to one or several uplink payloads. 309 309 310 -((( 311 -**Command from RS485-BL to Sensor:** 312 -))) 313 313 314 -((( 315 -RS485-BL can send out pre-set max 15 strings via **AT+COMMAD1**, **ATCOMMAND2**,…, to **AT+COMMANDF** . All commands are of same grammar. 316 -))) 326 +**Each RS485 commands include two parts:** 317 317 318 -((( 319 -**Handle return from sensors to RS485-BL**: 320 -))) 328 +~1. What commands RS485-LN will send to the RS485 sensors. There are total 15 commands from **AT+COMMAD1**, **ATCOMMAND2**,…, to **AT+COMMANDF**. All commands are of same grammar. 321 321 322 -((( 323 -After RS485-BL send out a string to sensor, RS485-BL will wait for the return from RS485 or TTL sensor. And user can specify how to handle the return, by **AT+DATACUT or AT+SEARCH commands** 324 -))) 330 +2. How to get wanted value the from RS485 sensors returns from by 1). There are total 15 AT Commands to handle the return, commands are **AT+DATACUT1**,**AT+DATACUT2**,…, **AT+DATACUTF** corresponding to the commands from 1). All commands are of same grammar. 325 325 326 -* ((( 327 -**AT+DATACUT** 328 -))) 332 +3. Some RS485 device might has longer delay on reply, so user can use AT+CMDDL to set the timeout for getting reply after the RS485 command is sent. For example 329 329 330 -((( 331 -When the return value from sensor have fix length and we know which position the valid value we should get, we can use AT+DATACUT command. 332 -))) 334 +**AT+CMDDL1=1000** to send the open time to 1000ms 333 333 334 -* ((( 335 -**AT+SEARCH** 336 -))) 337 337 338 -((( 339 -When the return value from sensor is dynamic length and we are not sure which bytes the valid data is, instead, we know what value the valid value following. We can use AT+SEARCH to search the valid value in the return string. 340 -))) 341 - 342 -((( 343 -**Define wait timeout:** 344 -))) 345 - 346 -((( 347 -Some RS485 device might has longer delay on reply, so user can use AT+CMDDL to set the timeout for getting reply after the RS485 command is sent. For example, AT+CMDDL1=1000 to send the open time to 1000ms 348 -))) 349 - 350 -((( 351 351 After we got the valid value from each RS485 commands, we need to combine them together with the command **AT+DATAUP**. 352 -))) 353 353 354 -**Examples:** 355 355 356 356 Below are examples for the how above AT Commands works. 357 357 358 -**AT+COMMANDx : **This command will be sent to RS485/TTL devices during each sampling, Max command length is 14 bytes. The grammar is: 359 359 360 -(% border="1" class="table-bordered" %) 361 -|((( 343 +**AT+COMMANDx : **This command will be sent to RS485 devices during each sampling, Max command length is 14 bytes. The grammar is: 344 + 345 +(% border="1" style="background-color:#4bacc6; color:white; width:499px" %) 346 +|(% style="width:496px" %)((( 362 362 **AT+COMMANDx=xx xx xx xx xx xx xx xx xx xx xx xx,m** 363 363 364 364 **xx xx xx xx xx xx xx xx xx xx xx xx: The RS485 command to be sent** ... ... @@ -366,90 +366,40 @@ 366 366 **m: 0: no CRC, 1: add CRC-16/MODBUS in the end of this command** 367 367 ))) 368 368 369 -((( 370 370 For example, if we have a RS485 sensor. The command to get sensor value is: 01 03 0B B8 00 02 46 0A. Where 01 03 0B B8 00 02 is the Modbus command to read the register 0B B8 where stored the sensor value. The 46 0A is the CRC-16/MODBUS which calculate manually. 371 -))) 372 372 373 -((( 374 -In the RS485-BL, we should use this command AT+COMMAND1=01 03 0B B8 00 02,1 for the same. 375 -))) 356 +In the RS485-LN, we should use this command AT+COMMAND1=01 03 0B B8 00 02,1 for the same. 376 376 377 -((( 378 -**AT+SEARCHx**: This command defines how to handle the return from AT+COMMANDx. 379 -))) 380 380 381 -(% border="1" class="table-bordered" %) 382 -|((( 383 -**AT+SEARCHx=aa,xx xx xx xx xx** 384 - 385 -* **aa: 1: prefix match mode; 2: prefix and suffix match mode** 386 -* **xx xx xx xx xx: match string. Max 5 bytes for prefix and 5 bytes for suffix** 387 - 388 - 389 -))) 390 - 391 -**Examples:** 392 - 393 -~1. For a return string from AT+COMMAND1: 16 0c 1e 56 34 2e 30 58 5f 36 41 30 31 00 49 394 - 395 -If we set AT+SEARCH1=1,1E 56 34. (max 5 bytes for prefix) 396 - 397 -The valid data will be all bytes after 1E 56 34 , so it is (% style="background-color:yellow" %)** 2e 30 58 5f 36 41 30 31 00 49** 398 - 399 -[[image:1653269403619-508.png]] 400 - 401 -2. For a return string from AT+COMMAND1: 16 0c 1e 56 34 2e 30 58 5f 36 41 30 31 00 49 402 - 403 -If we set AT+SEARCH1=2, 1E 56 34+31 00 49 404 - 405 -Device will search the bytes between 1E 56 34 and 31 00 49. So it is (% style="background-color:yellow" %)** 2e 30 58 5f 36 41 30** 406 - 407 -[[image:1653269438444-278.png]] 408 - 409 409 **AT+DATACUTx : **This command defines how to handle the return from AT+COMMANDx, max return length is 45 bytes. 410 410 411 -|((( 361 +(% border="1" style="background-color:#4bacc6; color:white; width:725px" %) 362 +|(% style="width:722px" %)((( 412 412 **AT+DATACUTx=a,b,c** 413 413 414 414 * **a: length for the return of AT+COMMAND** 415 415 * **b:1: grab valid value by byte, max 6 bytes. 2: grab valid value by bytes section, max 3 sections.** 416 -* **c: define the position for valid value. 367 +* **c: define the position for valid value. ** 417 417 ))) 418 418 419 -Examples: 420 420 371 +**Examples:** 372 + 421 421 * Grab bytes: 422 422 423 -[[image: 1653269551753-223.png||height="311" width="717"]]375 +[[image:image-20220602153621-1.png]] 424 424 377 + 425 425 * Grab a section. 426 426 427 -[[image: 1653269568276-930.png||height="325" width="718"]]380 +[[image:image-20220602153621-2.png]] 428 428 382 + 429 429 * Grab different sections. 430 430 431 -[[image:1653269593172-426.png||height="303" width="725"]] 385 +[[image:image-20220602153621-3.png]] 386 +))) 432 432 433 -(% style="color:red" %)**Note:** 434 - 435 -AT+SEARCHx and AT+DATACUTx can be used together, if both commands are set, RS485-BL will first process AT+SEARCHx on the return string and get a temporary string, and then process AT+DATACUTx on this temporary string to get the final payload. In this case, AT+DATACUTx need to set to format AT+DATACUTx=0,xx,xx where the return bytes set to 0. 436 - 437 -Example: 438 - 439 -(% style="color:red" %)AT+COMMAND1=11 01 1E D0,0 440 - 441 -(% style="color:red" %)AT+SEARCH1=1,1E 56 34 442 - 443 -(% style="color:red" %)AT+DATACUT1=0,2,1~~5 444 - 445 -(% style="color:red" %)Return string from AT+COMMAND1: 16 0c 1e 56 34 2e 30 58 5f 36 41 30 31 00 49 446 - 447 -(% style="color:red" %)String after SEARCH command: 2e 30 58 5f 36 41 30 31 00 49 448 - 449 -(% style="color:red" %)Valid payload after DataCUT command: 2e 30 58 5f 36 450 - 451 -[[image:1653269618463-608.png]] 452 - 453 453 === 3.3.4 Compose the uplink payload === 454 454 455 455 (((
- image-20220602153621-1.png
-
- Author
-
... ... @@ -1,0 +1,1 @@ 1 +XWiki.Xiaoling - Size
-
... ... @@ -1,0 +1,1 @@ 1 +23.4 KB - Content
- image-20220602153621-2.png
-
- Author
-
... ... @@ -1,0 +1,1 @@ 1 +XWiki.Xiaoling - Size
-
... ... @@ -1,0 +1,1 @@ 1 +22.2 KB - Content
- image-20220602153621-3.png
-
- Author
-
... ... @@ -1,0 +1,1 @@ 1 +XWiki.Xiaoling - Size
-
... ... @@ -1,0 +1,1 @@ 1 +22.3 KB - Content