User Manual
www.dragino.com
RS485 to LoRaWAN Converter User Manual 12 / 29
suf: Add suffix
If valid payload from command 1 is : EF
If valid payload from command 2 is AB
Then, final payload is:
Command
Final Payload for sampling
AT+DATAUP=1,2
EF AB
AT+DATAUP=1:12,2:56
12 EF 56 AB
AT+DATAUP=1:12:34,2:56:78
12 EF 34 56 AB 78
AT+DATAUP=1::34,2::78
EF 34 AB 78
AT+PAYLOAD
Set PAYLOAD version (size: 1 byte)
Command1 and Command2 will auto run before each uplink.
In this example, we use command1 to get the RS485 IO’s DI status, use command2 to get the
RS485 IO’s DO status.
The RS485 I/O we use here use Modbus RTU to communicate.
The command to get DI status is: 01 02 00 40 00 08 78 18. Where 01 02 00 40 00 08 is the
Modbus command to read the register 00 40 where stored the DI status. The 78 18 is the
CRC-16/MODBUS which calculate manually.
And RS485 I/O will return: 01 02 01 20 a0 00, where 20 here is the value for DI status.
The command to get DO status is: 01 01 00 20 00 08 3C 06. Where 01 01 00 20 00 08 is the
Modbus command to read the register 00 20 where stored the DI status. The 3C 06 is the
CRC-16/MODBUS which calculate manually.
And RS485 I/O will return: 01 01 01 00 51 00, where 00 is the value for DO status.
We want to get the DI status & DO status from RS485 IO and upload to LoRaWAN server, we
might have different RS485-LN to connect to different RS485 devices and upload different
payloads, so it will be good to use different Payload Version to tell the LoRaWAN server what
devices we have connected.
Below are the commands we need to set in RS485-LN:
AT+PAYVER=2 // Set Payload version to 2 (0x02)
AT+COMMAND1=01 02 00 40 00 08,1 // Send 01 02 00 40 00 08 to RS485 network, add
CRC-16/MODBUS at the end.
AT+DATACUT1=6,4,4 // get 6 bytes from the return, and choose the 4
th
byte as the valid
payload for command 1
AT+COMMAND2=01 01 00 20 00 08,1 // Send 01 01 00 20 00 08 to RS485 network, add
CRC-16/MODBUS at the end.
AT+DATACUT2=6,4,4 // get 6 bytes from the return, and choose the 4
th
byte as the valid payload
for command 2
AT+DATAUP=1,2 // Link valid payload1 and valid payload2.