Decode Payload RAK4600

Hello,
I have RAK4600 LPWAN Module. I followed the guide provided on RAK website and successfully sent the data to TheThingsNetwork. But the data on the TTN shows as payload which is encoded. How to decode the data sent from the RAK4600 node.

When I use the following command to send data

at+send=lora:2:0123456789

I receive the following in the TTN console.

PAYLOAD : 303132333435363738390D0A0D0A

I want the data converted back into the original format. Please help me in understanding how data is sent and how can I encode multiple data in the sent data.

Please help me with this issue.

Thank You

**function bin2HexStr(bytesArr) {
var str = “”;
for(var i=0; i<bytesArr.length; i++) {
var tmp = (bytesArr[i] & 0xff).toString(16);
if(tmp.length == 1) {
tmp = “0” + tmp;
}
str += tmp;
}
return str;
}

function Decoder(bytes, port) {
// Decode an uplink message from a buffer
// (array) of bytes to an object of fields.
var hexStr = bin2HexStr(bytes);
var decoded = {};
decoded.PAYLOAD = hexStr;
// if (port === 1) decoded.led = bytes[0];

return decoded;
}**
You can refer to this sample code.

Hi @darkpanda08,

303132333435363738390D0A0D0A is Hex format. If you convert it from Hex to ASCII directly, you can find that 0x30 is “1”, 0x31 is “2”. 0x32 is “3”, …

Thanks @Nicholas and @Fomi for your reply. I understood now how the data is sent and how can I decode on TTN. :smiley: :smiley:

In the last reply, there was a location where the decoding was added.Thank you!!!

1 Like

Hi,
When I send data via at command, it is sent in form of ASCII which then get encoded into HEX and shows on TTN Console.
Is there any way to send data in HEX format from the node i.e RAK4600 to save airtime ?

This feature is currently not supported by AT Command!Through ! SeriaNet can achieve direct transmission.

Can you tell me what is SeriaNet and how should I use that in my case?

Thanks

e-mail [email protected] get the support.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.