<
From version < 32.16 >
edited by Xiaoling
on 2022/06/02 15:30
To version < 35.2 >
edited by Xiaoling
on 2022/06/02 15:44
>
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -290,6 +290,7 @@
290 290  )))
291 291  
292 292  
293 +
293 293  === 3.3.2 Configure sensors ===
294 294  
295 295  (((
... ... @@ -308,80 +308,41 @@
308 308  mm: 0: no CRC, 1: add CRC-16/MODBUS in the end of this command
309 309  )))|(% style="width:256px" %)AT+CFGDEV=xx xx xx xx xx xx xx xx xx xx xx xx,m
310 310  
311 -=== 3.3.3 Configure read commands for each sampling ===
312 312  
313 -(((
314 -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.
315 -)))
316 316  
317 -(((
318 -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.
319 -)))
314 +=== 3.3.3 Configure read commands for each sampling ===
320 320  
321 321  (((
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 +
322 322  To save the LoRaWAN network bandwidth, we might need to read data from different sensors and combine their valid value into a short payload.
323 -)))
324 324  
325 -(((
326 326  This section describes how to achieve above goals.
327 -)))
328 328  
329 -(((
330 -During each sampling, the RS485-BL can support 15 commands to read sensors. And combine the return to one or several uplink payloads.
331 -)))
323 +During each sampling, the RS485-LN can support 15 commands to read sensors. And combine the return to one or several uplink payloads.
332 332  
333 -(((
334 -**Command from RS485-BL to Sensor:**
335 -)))
336 336  
337 -(((
338 -RS485-BL can send out pre-set max 15 strings via **AT+COMMAD1**, **ATCOMMAND2**,…, to **AT+COMMANDF** . All commands are of same grammar.
339 -)))
326 +**Each RS485 commands include two parts:**
340 340  
341 -(((
342 -**Handle return from sensors to RS485-BL**:
343 -)))
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.
344 344  
345 -(((
346 -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**
347 -)))
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.
348 348  
349 -* (((
350 -**AT+DATACUT**
351 -)))
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
352 352  
353 -(((
354 -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.
355 -)))
334 +**AT+CMDDL1=1000** to send the open time to 1000ms
356 356  
357 -* (((
358 -**AT+SEARCH**
359 -)))
360 360  
361 -(((
362 -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.
363 -)))
364 -
365 -(((
366 -**Define wait timeout:**
367 -)))
368 -
369 -(((
370 -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
371 -)))
372 -
373 -(((
374 374  After we got the valid value from each RS485 commands, we need to combine them together with the command **AT+DATAUP**.
375 -)))
376 376  
377 -**Examples:**
378 378  
379 379  Below are examples for the how above AT Commands works.
380 380  
381 -**AT+COMMANDx : **This command will be sent to RS485/TTL devices during each sampling, Max command length is 14 bytes. The grammar is:
382 382  
383 -(% border="1" class="table-bordered" %)
384 -|(((
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" %)(((
385 385  **AT+COMMANDx=xx xx xx xx xx xx xx xx xx xx xx xx,m**
386 386  
387 387  **xx xx xx xx xx xx xx xx xx xx xx xx: The RS485 command to be sent**
... ... @@ -389,90 +389,40 @@
389 389  **m: 0: no CRC, 1: add CRC-16/MODBUS in the end of this command**
390 390  )))
391 391  
392 -(((
393 393  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.
394 -)))
395 395  
396 -(((
397 -In the RS485-BL, we should use this command AT+COMMAND1=01 03 0B B8 00 02,1 for the same.
398 -)))
356 +In the RS485-LN, we should use this command AT+COMMAND1=01 03 0B B8 00 02,1 for the same.
399 399  
400 -(((
401 -**AT+SEARCHx**: This command defines how to handle the return from AT+COMMANDx.
402 -)))
403 403  
404 -(% border="1" class="table-bordered" %)
405 -|(((
406 -**AT+SEARCHx=aa,xx xx xx xx xx**
407 -
408 -* **aa: 1: prefix match mode; 2: prefix and suffix match mode**
409 -* **xx xx xx xx xx: match string. Max 5 bytes for prefix and 5 bytes for suffix**
410 -
411 -
412 -)))
413 -
414 -**Examples:**
415 -
416 -~1. For a return string from AT+COMMAND1: 16 0c 1e 56 34 2e 30 58 5f 36 41 30 31 00 49
417 -
418 -If we set AT+SEARCH1=1,1E 56 34.      (max 5 bytes for prefix)
419 -
420 -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**
421 -
422 -[[image:1653269403619-508.png]]
423 -
424 -2. For a return string from AT+COMMAND1:  16 0c 1e 56 34 2e 30 58 5f 36 41 30 31 00 49
425 -
426 -If we set AT+SEARCH1=2, 1E 56 34+31 00 49
427 -
428 -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**
429 -
430 -[[image:1653269438444-278.png]]
431 -
432 432  **AT+DATACUTx : **This command defines how to handle the return from AT+COMMANDx, max return length is 45 bytes.
433 433  
434 -|(((
361 +(% border="1" style="background-color:#4bacc6; color:white; width:725px" %)
362 +|(% style="width:722px" %)(((
435 435  **AT+DATACUTx=a,b,c**
436 436  
437 437  * **a: length for the return of AT+COMMAND**
438 438  * **b:1: grab valid value by byte, max 6 bytes. 2: grab valid value by bytes section, max 3 sections.**
439 -* **c: define the position for valid value.  **
367 +* **c: define the position for valid value. **
440 440  )))
441 441  
442 -Examples:
443 443  
371 +**Examples:**
372 +
444 444  * Grab bytes:
445 445  
446 -[[image:1653269551753-223.png||height="311" width="717"]]
375 +[[image:image-20220602153621-1.png]]
447 447  
377 +
448 448  * Grab a section.
449 449  
450 -[[image:1653269568276-930.png||height="325" width="718"]]
380 +[[image:image-20220602153621-2.png]]
451 451  
382 +
452 452  * Grab different sections.
453 453  
454 -[[image:1653269593172-426.png||height="303" width="725"]]
385 +[[image:image-20220602153621-3.png]]
386 +)))
455 455  
456 -(% style="color:red" %)**Note:**
457 -
458 -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.
459 -
460 -Example:
461 -
462 -(% style="color:red" %)AT+COMMAND1=11 01 1E D0,0
463 -
464 -(% style="color:red" %)AT+SEARCH1=1,1E 56 34
465 -
466 -(% style="color:red" %)AT+DATACUT1=0,2,1~~5
467 -
468 -(% style="color:red" %)Return string from AT+COMMAND1: 16 0c 1e 56 34 2e 30 58 5f 36 41 30 31 00 49
469 -
470 -(% style="color:red" %)String after SEARCH command: 2e 30 58 5f 36 41 30 31 00 49
471 -
472 -(% style="color:red" %)Valid payload after DataCUT command: 2e 30 58 5f 36
473 -
474 -[[image:1653269618463-608.png]]
475 -
476 476  === 3.3.4 Compose the uplink payload ===
477 477  
478 478  (((
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
Copyright ©2010-2024 Dragino Technology Co., LTD. All rights reserved
Dragino Wiki v2.0