Arduino MKR WAN 1300

I can’t figure out how to send sensor data in the right format.

My sensor data is collected to a string containing for example: “1a3249e12459”, 12 bytes total.

It should appear in TTN as “1a3249e12459”. How should I do it?

I have tried with modem.write() and with modem.print(), but the results are not want I want:

981300200c0000000c000000 // modem.write(msg);
316133323439653132343539 // modem.print(msg);

Thanks,
Tipo

the print one is in hexa, a simple HEX to ASCII decoder will do the trick
i use that one for example: https://www.rapidtables.com/convert/number/hex-to-ascii.html

Not really, because, because wasteful encodings of data as printable characters should never be transmitted in the first place.

OP’s mistake is when they say

That should not be treated as a string but a buffer.

As a buffer (0x1a, 0x32, 0x49, 0xe1, 0x24, 0x59) it is 6 bytes, and perhaps a reasonable payload (though with care it how it was originally packed it could probably be smaller).

But the quoted string is actually 12 bytes, and utterly unacceptable for transmission, since it only contains at most 6 bytes of actual meaning.

1 Like