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, 1 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -76,7 +76,6 @@ 76 76 * Automatic RF Sense and CAD with ultra-fast AFC. 77 77 * Packet engine up to 256 bytes with CRC. 78 78 79 - 80 80 == 1.3 Features == 81 81 82 82 * LoRaWAN Class A & Class C protocol (default Class C) ... ... @@ -514,8 +514,330 @@ 514 514 The first byte of this package represents whether the configuration is successful, 00 represents failure, 01 represents success. Except for the first byte, the other is the previous downlink. (All commands except A8 type commands are applicable) 515 515 516 516 517 -3.5.3 Sensor related commands 516 +=== 3.5.3 Sensor related commands === 518 518 519 519 ==== ==== 520 520 521 -==== ==== 520 +==== **RS485 Debug Command** ==== 521 + 522 +This command is used to configure the RS485 devices; they won’t be used during sampling. 523 + 524 +* **AT Command** 525 + 526 +(% class="box infomessage" %) 527 +((( 528 +**AT+CFGDEV=xx xx xx xx xx xx xx xx xx xx xx xx,m** 529 +))) 530 + 531 +m: 0: no CRC, 1: add CRC-16/MODBUS in the end of this command 532 + 533 +* **Downlink Payload** 534 + 535 +Format: A8 MM NN XX XX XX XX YY 536 + 537 +Where: 538 + 539 +* MM: 1: add CRC-16/MODBUS ; 0: no CRC 540 +* NN: The length of RS485 command 541 +* XX XX XX XX: RS485 command total NN bytes 542 +* YY: How many bytes will be uplink from the return of this RS485 command, 543 +** if YY=0, RS485-LN will execute the downlink command without uplink; 544 +** if YY>0, RS485-LN will uplink total YY bytes from the output of this RS485 command; Fport=200 545 +** if YY=FF, RS485-LN will uplink RS485 output with the downlink command content; Fport=200. 546 + 547 +**Example 1** ~-~-> Configure without ask for uplink (YY=0) 548 + 549 +To connect a Modbus Alarm with below commands. 550 + 551 +* The command to active alarm is: 0A 05 00 04 00 01 4C B0. Where 0A 05 00 04 00 01 is the Modbus command to read the register 00 40 where stored the DI status. The 4C B0 is the CRC-16/MODBUS which calculate manually. 552 + 553 +* The command to deactivate alarm is: 0A 05 00 04 00 00 8D 70. Where 0A 05 00 04 00 00 is the Modbus command to read the register 00 40 where stored the DI status. The 8D 70 is the CRC-16/MODBUS which calculate manually. 554 + 555 +So if user want to use downlink command to control to RS485 Alarm, he can use: 556 + 557 +(% style="color:#4f81bd" %)**A8 01 06 0A 05 00 04 00 01 00**(%%): to activate the RS485 Alarm 558 + 559 +(% style="color:#4f81bd" %)**A8 01 06 0A 05 00 04 00 00 00**(%%): to deactivate the RS485 Alarm 560 + 561 +A8 is type code and 01 means add CRC-16/MODBUS at the end, the 3^^rd^^ byte is 06, means the next 6 bytes are the command to be sent to the RS485 network, the final byte 00 means this command don’t need to acquire output. 562 + 563 + 564 +**Example 2** ~-~-> Configure with requesting uplink and original downlink command (**YY=FF**) 565 + 566 +User in IoT server send a downlink command: (% style="color:#4f81bd" %)**A8 01 06 0A 08 00 04 00 01 YY** 567 + 568 + 569 +RS485-LN got this downlink command and send (% style="color:#4f81bd" %)**0A 08 00 04 00 01 **(%%)to Modbus network. One of the RS485 sensor in the network send back Modbus reply **0A 08 00 04 00 00**. RS485-LN get this reply and combine with the original downlink command and uplink. The uplink message is: 570 + 571 + **A8** (% style="color:#4f81bd" %)**0A 08 00 04 00 **(% style="color:red" %)**01 06** ** **(% style="color:green" %)**0A 08 00 04 00 00** 572 + 573 + [[image:1654159460680-153.png]] 574 + 575 + 576 + 577 +==== **Set Payload version** ==== 578 + 579 +This is the first byte of the uplink payload. RS485-BL can connect to different sensors. User can set the PAYVER field to tell server how to decode the current payload. 580 + 581 +* **AT Command:** 582 + 583 +(% class="box infomessage" %) 584 +((( 585 +**AT+PAYVER: Set PAYVER field = 1** 586 +))) 587 + 588 + 589 +* **Downlink Payload:** 590 + 591 +**0xAE 01** ~-~-> Set PAYVER field = 0x01 592 + 593 +**0xAE 0F** ~-~-> Set PAYVER field = 0x0F 594 + 595 + 596 + 597 +==== **Set RS485 Sampling Commands** ==== 598 + 599 +AT+COMMANDx, AT+DATACUTx and AT+SEARCHx 600 + 601 +These three commands are used to configure how the RS485-BL polling data from Modbus device. Detail of usage please see : [[polling RS485 device>>||anchor="H3.3.3Configurereadcommandsforeachsampling"]]. 602 + 603 + 604 +* **AT Command:** 605 + 606 +(% class="box infomessage" %) 607 +((( 608 +**AT+COMMANDx: Configure RS485 read command to sensor.** 609 +))) 610 + 611 +(% class="box infomessage" %) 612 +((( 613 +**AT+DATACUTx: Configure how to handle return from RS485 devices.** 614 +))) 615 + 616 +(% class="box infomessage" %) 617 +((( 618 +**AT+SEARCHx: Configure search command** 619 +))) 620 + 621 + 622 +* **Downlink Payload:** 623 + 624 +**0xAF** downlink command can be used to set AT+COMMANDx or AT+DATACUTx. 625 + 626 +(% style="color:red" %)**Note**(%%): if user use AT+COMMANDx to add a new command, he also need to send AT+DATACUTx downlink. 627 + 628 +Format: AF MM NN LL XX XX XX XX YY 629 + 630 +Where: 631 + 632 +* MM: the ATCOMMAND or AT+DATACUT to be set. Value from 01 ~~ 0F, 633 +* NN: 0: no CRC; 1: add CRC-16/MODBUS ; 2: set the AT+DATACUT value. 634 +* LL: The length of AT+COMMAND or AT+DATACUT command 635 +* XX XX XX XX: AT+COMMAND or AT+DATACUT command 636 +* YY: If YY=0, RS485-BL will execute the downlink command without uplink; if YY=1, RS485-BL will execute an uplink after got this command. 637 + 638 +**Example:** 639 + 640 +(% style="color:#037691" %)**AF 03 01 06 0A 05 00 04 00 01 00**(%%): Same as AT+COMMAND3=0A 05 00 04 00 01,1 641 + 642 +(% style="color:#037691" %)**AF 03 02 06**(% style="color:orange" %)** 10 **(% style="color:red" %)**01 **(% style="color:green" %)**05 06 09 0A**(% style="color:#037691" %)** 00**(%%): Same as AT+DATACUT3=(% style="color:orange" %)**16**(%%),(% style="color:red" %)**1**(%%),(% style="color:green" %)**5+6+9+10** 643 + 644 +(% style="color:#037691" %)**AF 03 02 06 **(% style="color:orange" %)**0B**(% style="color:red" %)** 02 **(% style="color:green" %)**05 07 08 0A **(% style="color:#037691" %)**00**(%%): Same as AT+DATACUT3=(% style="color:orange" %)**11**(%%),(% style="color:red" %)**2**(%%),(% style="color:green" %)**5~~7+8~~10** 645 + 646 + 647 +**0xAB** downlink command can be used for set AT+SEARCHx 648 + 649 +**Example:** **AB aa 01 03 xx xx xx** (03 here means there are total 3 bytes after 03) So 650 + 651 +* AB aa 01 03 xx xx xx same as AT+SEARCHaa=1,xx xx xx 652 +* AB aa 02 03 xx xx xx 02 yy yy(03 means there are 3 bytes after 03, they are xx xx xx;02 means there are 2 bytes after 02, they are yy yy) so the commands 653 + 654 +**AB aa 02 03 xx xx xx 02 yy yy** same as **AT+SEARCHaa=2,xx xx xx+yy yy** 655 + 656 + 657 + 658 +==== **Fast command to handle MODBUS device** ==== 659 + 660 +AT+MBFUN is valid since v1.3 firmware version. The command is for fast configure to read Modbus devices. It is only valid for the devices which follow the [[MODBUS-RTU protocol>>url:https://www.modbustools.com/modbus.html]]. 661 + 662 +This command is valid since v1.3 firmware version 663 + 664 + 665 +**AT+MBFUN has only two value:** 666 + 667 +* **AT+MBFUN=1**: Enable Modbus reading. And get response base on the MODBUS return 668 + 669 +AT+MBFUN=1, device can auto read the Modbus function code: 01, 02, 03 or 04. AT+MBFUN has lower priority vs AT+DATACUT command. If AT+DATACUT command is configured, AT+MBFUN will be ignore. 670 + 671 +* **AT+MBFUN=0**: Disable Modbus fast reading. 672 + 673 +**Example:** 674 + 675 +* AT+MBFUN=1 and AT+DATACUT1/AT+DATACUT2 are not configure (0,0,0). 676 +* AT+COMMAND1= 01 03 00 10 00 08,1 ~-~-> read slave address 01 , function code 03, start address 00 01, quantity of registers 00 08. 677 +* AT+COMMAND2= 01 02 00 40 00 10,1 ~-~-> read slave address 01 , function code 02, start address 00 40, quantity of inputs 00 10. 678 + 679 +[[image:1654133913295-597.png]] 680 + 681 + 682 +[[image:1654133954153-643.png]] 683 + 684 + 685 +* **Downlink Commands:** 686 + 687 +**A9 aa** ~-~-> Same as AT+MBFUN=aa 688 + 689 + 690 + 691 +==== **RS485 command timeout** ==== 692 + 693 +Some Modbus device has slow action to send replies. This command is used to configure the RS485-BL to use longer time to wait for their action. 694 + 695 +Default value: 0, range: 0 ~~ 5 seconds 696 + 697 + 698 +* **AT Command:** 699 + 700 +(% class="box infomessage" %) 701 +((( 702 +**AT+CMDDLaa=hex(bb cc)** 703 +))) 704 + 705 +**Example:** 706 + 707 +**AT+CMDDL1=1000** to send the open time to 1000ms 708 + 709 + 710 +* **Downlink Payload:** 711 + 712 +0x AA aa bb cc 713 + 714 +Same as: AT+CMDDLaa=hex(bb cc) 715 + 716 + **Example:** 717 + 718 + **0xAA 01 03 E8** ~-~-> Same as **AT+CMDDL1=1000 ms** 719 + 720 + 721 + 722 +==== **Uplink payload mode** ==== 723 + 724 +Define to use one uplink or multiple uplinks for the sampling. 725 + 726 +The use of this command please see: [[Compose Uplink payload>>||anchor="H3.3.4Composetheuplinkpayload"]] 727 + 728 +* **AT Command:** 729 + 730 +(% class="box infomessage" %) 731 +((( 732 +**AT+DATAUP=0** 733 +))) 734 + 735 +(% class="box infomessage" %) 736 +((( 737 +**AT+DATAUP=1** 738 +))) 739 + 740 + 741 +* **Downlink Payload:** 742 + 743 +**0xAD 00** **~-~->** Same as AT+DATAUP=0 744 + 745 +**0xAD 01** **~-~->** Same as AT+DATAUP=1 746 + 747 + 748 + 749 +==== **Manually trigger an Uplink** ==== 750 + 751 +Ask device to send an uplink immediately. 752 + 753 +* **Downlink Payload:** 754 + 755 +**0x08 FF**, RS485-BL will immediately send an uplink. 756 + 757 + 758 + 759 +==== **Clear RS485 Command** ==== 760 + 761 +The AT+COMMANDx and AT+DATACUTx settings are stored in special location, user can use below command to clear them. 762 + 763 + 764 +* **AT Command:** 765 + 766 +(% style="color:#037691" %)**AT+CMDEAR=mm,nn** (%%) mm: start position of erase ,nn: stop position of erase Etc. AT+CMDEAR=1,10 means erase AT+COMMAND1/AT+DATACUT1 to AT+COMMAND10/AT+DATACUT10 767 + 768 +Example screen shot after clear all RS485 commands. 769 + 770 + 771 +The uplink screen shot is: 772 + 773 +[[image:1654134704555-320.png]] 774 + 775 + 776 +* **Downlink Payload:** 777 + 778 +**0x09 aa bb** same as AT+CMDEAR=aa,bb 779 + 780 + 781 + 782 +==== **Set Serial Communication Parameters** ==== 783 + 784 +Set the Rs485 serial communication parameters: 785 + 786 +* **AT Command:** 787 + 788 +Set Baud Rate: 789 + 790 +(% class="box infomessage" %) 791 +((( 792 +**AT+BAUDR=9600** ~/~/ Options: (1200,2400,4800,14400,19200,115200) 793 +))) 794 + 795 +Set UART Parity 796 + 797 +(% class="box infomessage" %) 798 +((( 799 +**AT+PARITY=0** ~/~/ Option: 0: no parity, 1: odd parity, 2: even parity 800 +))) 801 + 802 +Set STOPBIT 803 + 804 +(% class="box infomessage" %) 805 +((( 806 +**AT+STOPBIT=0** ~/~/ Option: 0 for 1bit; 1 for 1.5 bit ; 2 for 2 bits 807 +))) 808 + 809 + 810 +* **Downlink Payload:** 811 + 812 +**A7 01 aa bb**: Same AT+BAUDR=hex(aa bb)*100 813 + 814 +**Example:** 815 + 816 +* A7 01 00 60 same as AT+BAUDR=9600 817 +* A7 01 04 80 same as AT+BAUDR=115200 818 + 819 +A7 02 aa: Same as AT+PARITY=aa (aa value: 00 , 01 or 02) 820 + 821 +A7 03 aa: Same as AT+STOPBIT=aa (aa value: 00 , 01 or 02) 822 + 823 + 824 + 825 +==== **Control output power duration** ==== 826 + 827 +User can set the output power duration before each sampling. 828 + 829 +* **AT Command:** 830 + 831 +**Example:** 832 + 833 +**AT+3V3T=1000** ~/~/ 3V3 output power will open 1s before each sampling. 834 + 835 +**AT+5VT=1000** ~/~/ +5V output power will open 1s before each sampling. 836 + 837 + 838 +* **LoRaWAN Downlink Command:** 839 + 840 +**07 01 aa bb** Same as AT+5VT=(aa bb) 841 + 842 +**07 02 aa bb** Same as AT+3V3T=(aa bb)
- 1654159460680-153.png
-
- Author
-
... ... @@ -1,0 +1,1 @@ 1 +XWiki.Xiaoling - Size
-
... ... @@ -1,0 +1,1 @@ 1 +24.9 KB - Content