Not understanding payload from mDot Box in node-RED

Home Forums mDot/xDot Not understanding payload from mDot Box in node-RED

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #16121
    Capecchi Olivier
    Participant

    Hello guys,
    I’m new to mDot and I want to use the data produced by the mDot Box. I set up a node-RED interface to retreive the messages, I selected “data type” : bytes from the LoRa Node as specified, and I receive this payload :
    “payload”: [ 14, 0, 0, 15, 8, 6, 43, 118, 5, 1, 40, 11, 2, 30 ],
    and I don’t have the slightest idea of what is it, even after thoroughly reading this forum and the website. How can i interpret this payload ? What format is it ? How can I reach the value mesaured ?
    Big thanks in advance and Merry Christmas to all,

    #16123
    Mike Fiore
    Blocked

    The documentation you’re looking for is linked from the developer page for the dotbox:
    http://www.multitech.net/developer/products/multiconnect-mdot-box-and-evb/

    If using LoRa Demo, Survey Single, or Survey Sweep mode: http://www.multitech.net/developer/software/dot-box-and-evb-software/data-packet-format/

    If using Survey GPS mode:
    http://www.multitech.net/developer/software/dot-box-and-evb-software/survey-gps/

    #16479
    Jeffrey Osborne
    Participant

    Hi all,

    I’m also having issues understanding the format of the data. My node-red is configured with a LoRa input node attached to a debug node. When the lora node is configured in UTF-8, the debug looks like:

    { "chan": 7, "cls": 0, "codr": "4/5", "datr": "SF7BW125", "freq": "913.3", "lsnr": "10.2", "mhdr": "4001000000001a00", "modu": "LORA", "opts": "", "port": 1, "rfch": 1, "rssi": -47, "seqn": 26, "size": 20, "timestamp": "2017-01-26T16:07:10.388956Z", "tmst": 1756279708, "payload": "\u000e��\u000f\b\u0006\u0002z\u0005\u0000�\u000b\u0001�", "eui": "00-80-00-00-00-00-c7-XX", "_msgid": "22fbc053.dd044" }

    Conversely, when the lora node is in Bytes format, it looks like:

    { "chan": 2, "cls": 0, "codr": "4/5", "datr": "SF7BW125", "freq": "912.3", "lsnr": "10.2", "mhdr": "4001000000006d00", "modu": "LORA", "opts": "", "port": 1, "rfch": 0, "rssi": -35, "seqn": 109, "size": 20, "timestamp": "2017-01-26T16:24:51.745114Z", "tmst": 2817660067, "payload": [ 14, 255, 255, 15, 8, 6, 2, 111, 5, 0, 77, 11, 1, 208 ], "eui": "00-80-00-00-00-00-c7-XX", "_msgid": "eaef34ae.1510c8" }

    I am using the mDot Box in the LoRa demo mode. I read the description in http://www.multitech.net/developer/software/dot-box-and-evb-software/data-packet-format/ but didn’t really understand the formatting still.

    #16480

    Hi Jeffrey,

    As you already discovered, you need to use byte format not UTF-8. UTF-8 will not represent values above 0x7f in one byte. The following link details UTF-8.
    https://tools.ietf.org/html/rfc3629

    As for your payload, the debug output is displaying it as decimal but our documentation is in hex. Your payload is:
    14, 255, 255, 15, 8, 6, 2, 111, 5, 0, 77, 11, 1, 208
    From the link http://www.multitech.net/developer/software/dot-box-and-evb-software/data-packet-format…
    0x0E or 14 decimal is ‘Acceleration 3-Axis Measured’. So it contains 3 bytes of data. In your case, 255, 255, 15. The next set of data starts with 8 which is pressure and has 3 bytes. So 6, 2, 111. Next is 5 which is lux and is given in 2 bytes as 0, 77. Last is 11 or 0x0B for temperature with 1, 208.

    Again looking at the data-packet-format page, you see that the temp value is 0.0625 Degrees C (Signed MSB). First take 1, 208 and convert to a full 16 bit value. The first byte is trivially 0000 0001. The second byte is decimal 208 or 1101 0000 or 0xd0.
    Combining the two bytes yields a hexadecimal value 0x1d0 or 464 decimal… 464 x 0.0625 = 29°C.

    Kind regards,
    Leon

    #16481
    Jeffrey Osborne
    Participant

    Awesome leon, thanks for the info. I just want to add something as well for others. If you place a debug node on msg.payload, I receive something like 0E07080A080602DE0500460B01D0 (this is a different payload than the one above). This can be interpreted easily as well as:

    0E = Acceleration, next 3 bytes
    07 = 7 x 0.0625 = 0.4375 g (x)
    08 = 8 x 0.0625 = 0.5 g (y)
    0A = 10 x 0.0625 = 0.625 g (z)

    08 = Pressure, next 3 bytes
    0602DE = 393950 x 0.25 = 98,786.5 Pa (I believe the documentation is incorrect and it should be <value x 0.25Pa> instead of kPa)

    05 = Lux, next 2 bytes
    0046 = 70 lumens

    0B = Temperature, next 2 bytes
    01D0 = 464 x 0.0625 = 29C

    #31998
    Nick X
    Participant

    This post really helped me. Belated 2017 thanks… sharing back my resultant TTNv3 payload decoder for box/evb lora-demo: hope it is of use to someone…

    function decodeUplink(input) {
    var data = {};

    var acc_x = input.bytes[1];
    var acc_y = input.bytes[2];
    var acc_z = input.bytes[3];
    var press = (input.bytes[5]<<16) | (input.bytes[6]<<8) | input.bytes[7];
    var lux = (input.bytes[9]<<8) | input.bytes[10];
    var temp = (input.bytes[12]<<8) | input.bytes[13];
    data.acc_x = acc_x * .0625;
    data.acc_y = acc_y * .0625;
    data.acc_z = acc_z * .0625;
    data.press = +((press * 0.25 / 1000).toFixed(2));
    data.lux = lux;
    data.temp = +((temp * 0.0625).toFixed(1));

    return {
    data: data
    };
    }

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.