Incorrect longitude latitude in KPN dashboard

Hi folks,

I successfully transmitted a lora packet, with Sodaq ONE and Universal Tracker sketch, through the KPN lora infra, because it appeared in the KPN debugger website.
However, when I decode the hexdata payload, with the function below, the long/lat is not correct.
Is this caused by the function or did KPN received incorrect data?
Unfortunately, I don’t have the serial monitor log. But I can remember that during my trip along different KPN basestations I successfully transmitted around 6 packets (only one appeared in the KPN dashboard), and all of them had correct longitude latitude values.
(I know because the latitudes all started with 52xxxx which is around my neighborhood).

var bytes = 'e8ff685867153f6d001f5a0f9302f8ff0100000504';

  var epoch = (bytes[3] << 24) | (bytes[2] << 16) | (bytes[1] << 8) | bytes[0];
  var batvolt = bytes[4];
  var boardtemp = bytes[5];
  var lat = (bytes[9] << 24) | (bytes[8] << 16) | (bytes[7] << 8) | bytes[6];
  var long = (bytes[13] << 24) | (bytes[12] << 16) | (bytes[11] << 8) | bytes[10];
  var alt = (bytes[15] << 8) | bytes[14];
  var speed = (bytes[17] << 8) | bytes[16];
  var course = bytes[18];
  var numsat = bytes[19];
  var fix = bytes[20];
  console.log({
epoch: epoch,
batvolt: batvolt,
boardtemp: boardtemp,
lat: lat,
long: long,
alt: alt,
speed: speed,
course: course,
numsat: numsat,
fix: fix,
  });

which outputs:

[object Object] {
  alt: 6,
  batvolt: "6",
  boardtemp: "8",
  course: "1",
  epoch: 2048,
  fix: "5",
  lat: 117835781,
  long: 197889,
  numsat: "f",
  speed: 0
}

ps. I read also this topic (Interpreting payload data from the SodaqOne-UniversalTracker) but doesn’t answer my question…

-Martijn

The latitude is given in bytes 6-9 (zero indexed) which can be seen in the payload as 3f6d001f, the data is little endian so 0x1F006D3F is 520121663 or +52.0121663.

Similarly, the longitude is given as 5a0f9302 or 0x02930F5A = 43192154 or +4.3192154.

Those coordinates appear to be correct in the payload, however, the conversion seems to be incorrect.

1 Like