Last modified by Xiaoling on 2025/04/23 15:57

From version 41.2
edited by Xiaoling
on 2022/06/06 10:54
Change comment: There is no comment for this version
To version 40.50
edited by Xiaoling
on 2022/06/06 10:44
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -383,7 +383,6 @@
383 383  )))
384 384  
385 385  
386 -
387 387  === 3.3.2 Configure sensors ===
388 388  
389 389  (((
... ... @@ -407,7 +407,6 @@
407 407  Detail of AT+CFGDEV command see [[AT+CFGDEV detail>>||anchor="HRS485DebugCommand28AT2BCFGDEV29"]].
408 408  
409 409  
410 -
411 411  === 3.3.3 Configure read commands for each sampling ===
412 412  
413 413  (((
... ... @@ -474,209 +474,117 @@
474 474  After we got the valid value from each RS485 commands, we need to combine them together with the command **AT+DATAUP**.
475 475  )))
476 476  
477 -(((
478 478  **Examples:**
479 -)))
480 480  
481 -(((
482 482  Below are examples for the how above AT Commands works.
483 -)))
484 484  
485 -(((
486 486  **AT+COMMANDx : **This command will be sent to RS485/TTL devices during each sampling, Max command length is 14 bytes. The grammar is:
487 -)))
488 488  
489 489  (% border="1" class="table-bordered" style="background-color:#4f81bd; color:white; width:500px" %)
490 490  |(% style="width:498px" %)(((
491 -(((
492 492  **AT+COMMANDx=xx xx xx xx xx xx xx xx xx xx xx xx,m**
493 -)))
494 494  
495 -(((
496 496  **xx xx xx xx xx xx xx xx xx xx xx xx: The RS485 command to be sent**
497 -)))
498 498  
499 -(((
500 500  **m: 0: no CRC, 1: add CRC-16/MODBUS in the end of this command**
501 501  )))
502 -)))
503 503  
504 -(((
505 505  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.
506 -)))
507 507  
508 -(((
509 509  In the RS485-BL, we should use this command AT+COMMAND1=01 03 0B B8 00 02,1 for the same.
510 -)))
511 511  
512 -(((
513 513  **AT+SEARCHx**: This command defines how to handle the return from AT+COMMANDx.
514 -)))
515 515  
516 516  (% border="1" class="table-bordered" style="background-color:#4f81bd; color:white; width:500px" %)
517 517  |(% style="width:577px" %)(((
518 -(((
519 519  **AT+SEARCHx=aa,xx xx xx xx xx**
520 -)))
521 521  
522 -* (((
523 -**aa: 1: prefix match mode; 2: prefix and suffix match mode**
500 +* **aa: 1: prefix match mode; 2: prefix and suffix match mode**
501 +* **xx xx xx xx xx: match string. Max 5 bytes for prefix and 5 bytes for suffix**
524 524  )))
525 -* (((
526 -**xx xx xx xx xx: match string. Max 5 bytes for prefix and 5 bytes for suffix**
527 -)))
528 -)))
529 529  
530 -(((
531 531  **Examples:**
532 -)))
533 533  
534 -(((
535 535  1)For a return string from AT+COMMAND1: 16 0c 1e 56 34 2e 30 58 5f 36 41 30 31 00 49
536 -)))
537 537  
538 -(((
539 539  If we set AT+SEARCH1=1,1E 56 34.      (max 5 bytes for prefix)
540 -)))
541 541  
542 -(((
543 543  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**
544 -)))
545 545  
546 -(((
547 547  [[image:1653271044481-711.png]]
548 -)))
549 549  
550 -(((
551 551  2)For a return string from AT+COMMAND1:  16 0c 1e 56 34 2e 30 58 5f 36 41 30 31 00 49
552 -)))
553 553  
554 -(((
555 555  If we set AT+SEARCH1=2, 1E 56 34+31 00 49
556 -)))
557 557  
558 -(((
559 559  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**
560 -)))
561 561  
562 -(((
563 563  [[image:1653271276735-972.png]]
564 -)))
565 565  
566 -(((
567 567  **AT+DATACUTx : **This command defines how to handle the return from AT+COMMANDx, max return length is 45 bytes.
568 -)))
569 569  
570 570  (% style="background-color:#4f81bd; color:white; width:510px" %)
571 571  |(% style="width:726px" %)(((
572 -(((
573 573  **AT+DATACUTx=a,b,c**
574 -)))
575 575  
576 -* (((
577 -**a: length for the return of AT+COMMAND**
528 +* **a: length for the return of AT+COMMAND**
529 +* **b:1: grab valid value by byte, max 6 bytes. 2: grab valid value by bytes section, max 3 sections.**
530 +* **c: define the position for valid value.  **
578 578  )))
579 -* (((
580 -**b:1: grab valid value by byte, max 6 bytes. 2: grab valid value by bytes section, max 3 sections.**
581 -)))
582 -* (((
583 -**c: define the position for valid value.  **
584 -)))
585 -)))
586 586  
587 -(((
588 588  **Examples:**
589 -)))
590 590  
591 -* (((
592 -Grab bytes:
593 -)))
535 +* Grab bytes:
594 594  
595 -(((
596 596  [[image:1653271581490-837.png||height="313" width="722"]]
597 -)))
598 598  
599 -(((
600 -
601 -)))
602 602  
603 -* (((
604 -Grab a section.
605 -)))
540 +* Grab a section.
606 606  
607 -(((
608 608  [[image:1653271648378-342.png||height="326" width="720"]]
609 -)))
610 610  
611 -(((
612 -
613 -)))
614 614  
615 -* (((
616 -Grab different sections.
617 -)))
545 +* Grab different sections.
618 618  
619 -(((
620 620  [[image:1653271657255-576.png||height="305" width="730"]]
621 -)))
622 622  
623 623  (((
624 -(((
625 625  (% style="color:red" %)**Note:**
626 626  )))
627 -)))
628 628  
629 629  (((
630 -(((
631 631  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.
632 632  )))
633 -)))
634 634  
635 635  (((
636 -(((
637 637  **Example:**
638 638  )))
639 -)))
640 640  
641 641  (((
642 -(((
643 643  (% style="color:red" %)AT+COMMAND1=11 01 1E D0,0
644 644  )))
645 -)))
646 646  
647 647  (((
648 -(((
649 649  (% style="color:red" %)AT+SEARCH1=1,1E 56 34
650 650  )))
651 -)))
652 652  
653 653  (((
654 -(((
655 655  (% style="color:red" %)AT+DATACUT1=0,2,1~~5
656 656  )))
657 -)))
658 658  
659 659  (((
660 -(((
661 661  (% style="color:red" %)Return string from AT+COMMAND1: 16 0c 1e 56 34 2e 30 58 5f 36 41 30 31 00 49
662 662  )))
663 -)))
664 664  
665 665  (((
666 -(((
667 667  (% style="color:red" %)String after SEARCH command: 2e 30 58 5f 36 41 30 31 00 49
668 668  )))
669 -)))
670 670  
671 671  (((
672 -(((
673 673  (% style="color:red" %)Valid payload after DataCUT command: 2e 30 58 5f 36
674 674  )))
675 -)))
676 676  
677 -(((
678 678  [[image:1653271763403-806.png]]
679 -)))
680 680  
681 681  
682 682  === 3.3.4 Compose the uplink payload ===
... ... @@ -683,14 +683,10 @@
683 683  
684 684  (((
685 685  Through AT+COMMANDx and AT+DATACUTx we got valid value from each RS485 commands, Assume these valid value are RETURN1, RETURN2, .., to RETURNx. The next step is how to compose the LoRa Uplink Payload by these RETURNs. The command is **AT+DATAUP.**
686 -
687 -
688 688  )))
689 689  
690 690  (((
691 691  (% style="color:#037691" %)**Examples: AT+DATAUP=0**
692 -
693 -
694 694  )))
695 695  
696 696  (((
... ... @@ -823,8 +823,26 @@
823 823  
824 824  == 3.4 Uplink Payload ==
825 825  
826 -[[image:image-20220606105412-1.png]]
728 +(% border="1" style="background-color:#4f81bd; color:white; width:850px" %)
729 +|**Size(bytes)**|(% style="width:130px" %)**2**|(% style="width:93px" %)**1**|(% style="width:509px" %)**Length depends on the return from the commands**
730 +|Value|(% style="width:130px" %)(((
731 +(((
732 +Battery(mV)
733 +)))
827 827  
735 +(((
736 +&
737 +)))
738 +
739 +(((
740 +Interrupt _Flag
741 +)))
742 +)))|(% style="width:93px" %)(((
743 +PAYLOAD_VER
744 +
745 +
746 +)))|(% style="width:509px" %)If the valid payload is too long and exceed the maximum support payload length in server, server will show payload not provided in the LoRaWAN server.
747 +
828 828  Below is the decoder for the first 3 bytes. The rest bytes are dynamic depends on different RS485 sensors.
829 829  
830 830  (((
image-20220606105412-1.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.Xiaoling
Size
... ... @@ -1,1 +1,0 @@
1 -13.9 KB
Content