Unable to get data in right format for AcSIP S76SXB

Please see the data… I m using AcSIP S76SXB -Nothing in Field .So it is not usable for TTN Mapper and Cayenne Dashboard.

image

Payload is there. Did you add a decoder it in the Applications/Payload Formats section?

I tried this one to fetch the Long, lat for TTN mapper, but no success:

function Decoder(bytes, port) {
        // Decode an uplink message from a buffer
        // (array) of bytes to an object of fields.
        var decoded = {};

        decoded.latitude = ((bytes[0]<<16)>>>0) + ((bytes[1]<<8)>>>0) + bytes[2];
        decoded.latitude = (decoded.latitude / 16777215.0 * 180) - 90;
      
        decoded.longitude = ((bytes[3]<<16)>>>0) + ((bytes[4]<<8)>>>0) + bytes[5];
        decoded.longitude = (decoded.longitude / 16777215.0 * 360) - 180;
      
        var altValue = ((bytes[6]<<8)>>>0) + bytes[7];
        var sign = bytes[6] & (1 << 7);
        if(sign)
        {
            decoded.altitude = 0xFFFF0000 | altValue;
        }
        else
        {
            decoded.altitude = altValue;
        }
      
        decoded.hdop = bytes[8] / 10.0;

        return decoded;
    }

On which port is the uplink received? (You should not use port 0.)

Where did you find that decoder? What payload do you use to test it while editing in TTN Console? Does testing it get you the expected output?

The 8 bytes payload AC0600FF018D0260 from your screenshot is too short for your decoder. Using 7 rather than 8 in decoded.hdop = bytes[7] / 10.0; might fix that, With a length of 8 there is no bytes[8], and all 8 bytes from bytes[0] through bytes[7] were already used for other fields. Not knowing how the data is encoded, fixing it would just be a wild guess.

Why are you using the >>>0 here? I think it has no effect.

Note that even when the fields show in the output, you will not be able to use TTN Console’s Payload Formats to create some Cayenne-compatible payload. To use Cayenne, the device must use the LPP format. If the device does not use Cayenne LPP, then you cannot use TTN Console’s Payload Formats to convert the payload into that format:

As per AcSIP S76S doc…the data structure is as follows:
image

Sorry, I don’t see any reference to coordinates there, and it surely does not match your decoder function. Like the 1st byte (being byte[0] in the JavaScript decoder function) has a fixed value, and the 4th byte (being byte[3]) is marked as “reserved for future use”, while your decoder is using both.

So, I recommend you take a look at my other questions.

The format you show could possibly be decoded using:

function Decoder(bytes, port) {
  var header = bytes[0];
  if (header !== 0xAC) {
    return {
      error: 'Unsupported payload header'
    };
  }
  var len = bytes[1];
  if (len !== 6) {
    return {
      error: 'Unsupported payload length'
    };
  }
  var gpio0 = bytes[2] & 0x0F;
  var gpio1 = bytes[2] >> 4;
  var rfu = bytes[3];
  // Documented as 12 bits; assuming MSB and not supporting negative values
  var adc0 = bytes[4]<<8 | bytes[5];
  var adc1 = bytes[6]<<8 | bytes[7];
  return {
    gpio0: gpio0,
    gpio1: gpio1,
    adc0: adc0,
    adc1: adc1
  }
}

(Please, don’t post screenshots for terminal output.)

1 Like

For payload AC0600FF018D0260 it shows following outcome

{
“adc0”: 397,
“adc1”: 608,
“gpio0”: 0,
“gpio1”: 0
}

To answer my own question: you used a decoder that you found in a topic about a different device, the TTGO T-Beam.

True, and very much as expected. And, you’ll get the very same result when using that payload to test the decoder function:

image

If you still have a question then please be more specific. Note that you can also TTN Mapper with a device that does not have a GPS module, if you use its mobile app to determine the coordinates.

2 Likes

Thanks for support. Since I can see the RSSI, SNR and Location in Payload, I want to extract the same also and want to integrate the data with Cayenne Dashboard !!

If the payload structure is the one you mentioned above, there is no location. The location you see is the gateway location.
EDIT: and since the gateway will be fixed in some place, there is no need to track it :wink:

1 Like

This is node data capturing RSSI, SNR and location:
image

Right now Node is next to Gateway so it will show almost same coordinates.

Like explained above, given that structure, there is no location data in your node’s payload. Does it even have a GPS module? And the metadata of the gateway(s) is not giving you your node’s location either.

Posting the same image again is not helping. Instead: what is your exact question? What are you trying to show with the above screenshot?

1 Like

No: this is gateway data capturing RSSI, SNR of the received packet and its own location. Node does not know about RSSI and SNR (and in your case, about location too).

1 Like

And even more: if your node’s transmission is received by multiple gateways, you’ll get coordinates of multiple gateways as well. And those could be many kilometers apart.

(You might think you can then calculate the node’s position, but: no. See Location by triangulation for that.)

If you want to access the gateway(s) metadata in a payload format Decoder function: that is not possible. You’ll only get those details using some integration, or by using the MQTT data API.