TTN payload with SodaqOne Tracker

Hi !

I want to use a SodaqOne as a GPS tracker. In that purpose, I used the code given here : https://github.com/SodaqMoja/SodaqOne-UniversalTracker-v2

The data are sent correctly. My question is quite simple : how do you interpret the payload received in TTN ? In other words, how can you know the coordinates when you have a payload like : 01 88 07 B2 C1 00 9A 6A 00 1F A4 02 02 D2 60 03 67 00 BE ?

Thank you

The payload you have pasted is too short. It should be at least 21 bytes (42 hex characters) long. Maybe you did not configure the the Sodaq with the correct keys?

I used the keys given by my application in the ttn console . The devAddr, appSKey and NwKey. Aren’t they the right ones ?

If the payload you show was taken from TTN Console, then the keys are okay.

If the payload you show was taken from the Application Data or Device Data in TTN Console, then at least the NwkSKey is okay, and the Message Integrity Code was fine as well, for otherwise TTN would not be able to find your application to start with. The AppSKey might still be wrong, but a wrong key would not change the length of the application payload that TTN Console displays.

Still then, the 19 bytes payload you show do not match the specifications you linked to.

With our Junior IOT Challenge we have used a similar format, and the decoder function to read back the values is listed in line 60 and further in our code. You will need to adjust to your values.

@arjanvanb yes that’s what I don’t understand cause I use exactly the same code as in the link I gave.
@marcovanschagen and do you remember how long your payload was ? Because it seems weird I don’t have at least 21 bytes

For your informations, I have solved the problem . Actually, in the code I defined the Cayenne format which has a shorter payload. The 2 solutions were :
1)Define the Cayenne LPP payload format in the ttn console
OR
2)Don’t transmit the payload with Cayenne. Doing so, I have a 21 bytes payload

Hello,

I used the following code and my results dont make any sense, anybody nice enough that can help me “decifer” these weird results.

battery makes sense, course is not bad, everything else is wrong :slight_smile:

{
“battery”: 3.38,
“course”: 222,
“epoch”: 36513600,
“latitude”: -1644101614,
“longitude”: 1171918928,
“satellites”: 125,
“speed”: 52792,
“temperature”: 0,
“time_to_fix”: 123
}

here is my code, which is pretty standard:
function Decoder(bytes) {
// Decoder
// Here can decode the payload into json.
// bytes is of type Buffer.

// todo: return an object
var epoch = (bytes[3] << 24) | (bytes[2] << 16) | (bytes[1] << 8) | bytes[0];
var batt = (3000+10*bytes[4])/1000;
var temp = bytes[5];
var lat = (bytes[9] << 24) | (bytes[8] << 16) | (bytes[7] << 8) | bytes[6];
var lon = (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 sats = bytes[19];
var ttf = bytes[20];
return {
course: course,
satellites: sats,
time_to_fix: ttf,
latitude: lat,
longitude: lon,
epoch: epoch,
battery: batt,
speed: speed,
temperature: temp
};
}