TTN Mapper and no data appearing for TTGO T-Beam

Hello,

I’m using the TNN mapper and I can’t see the data on TTN mapper. I’m getting the json payload below in the application so I know the data is being received by the app and parsed but not being received or processed by the TTN Mapper. From looking at the TTN Mapper website, it says I should have:

A JSON object containing the keys “latitude”, “longitude” and “altitude”. In addition the JSON object must contain one of the following keys “hdop”, “accuracy” or “sats”.

It looks like I’m not getting the hdop values, any ideas why?

The code and device im using is below on the github page here

{
  "time": "2018-07-01T14:54:07.537160375Z",
  "frequency": 867.1,
  "modulation": "LORA",
  "data_rate": "SF7BW125",
  "coding_rate": "4/5",
  "gateways": [
    {
      "gtw_id": "pirate-ttn",
      "gtw_trusted": true,
      "timestamp": 3520354011,
      "time": "2018-07-01T14:54:08Z",
      "channel": 3,
      "rssi": -118,
      "snr": 0.25,
      "latitude": 53.373276,
      "longitude": -1.4650956,
      "altitude": 50,
      "location_source": "registry"
    }
  ]
}

I believe the latitude / longitude you are seeing are those of the gateway, not the ttn mapper node.

To see the data from the node you must go in the application console data windows, as in https://console.thethingsnetwork.org/applications/YOUR_APP_NAME/data

Thanks for replying so quick. That’s where I got the json string from, the node is very near the base station.

ta

There doesn’t seem to be a “Fields” field in your JSON output, this is where the decoded node payload would be.

Here’s what mine looks like in the TTN console :
TTN_Mapper_Node_Data

Do you have something similar ?

I have just the meta data. The fields section looks like its not decoded.

Thanks

Did you setup a decoder script in the ttn console for your application ?
It is in the “Payload formats” tab of the application console. It is that script which is responsible for decoding the payload from binary to json.

Here’s mine (a cut-and-paste from some example code which I can’t remember the source) :

    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;
    }
1 Like

The code you gave decodes the results.

Thanks

1 Like