# TTN payload with SodaqOne Tracker

**URL:** <https://www.thethingsnetwork.org/forum/t/ttn-payload-with-sodaqone-tracker/7219>\
**Category:** Application Development\
**Created:** [May 11, 2017, 3:50pm UTC](https://www.thethingsnetwork.org/forum/t/ttn-payload-with-sodaqone-tracker/7219 "2017-05-11T15:50:19Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sebastien\_Demarbre](https://www.thethingsnetwork.org/forum/letter_avatar_proxy/v4/letter/s/0ea827/32.png) [@Sebastien\_Demarbre](https://www.thethingsnetwork.org/forum/u/Sebastien_Demarbre)\
**Post date:** [May 11, 2017, 3:50pm UTC](https://www.thethingsnetwork.org/forum/t/ttn-payload-with-sodaqone-tracker/7219/1 "2017-05-11T15:50:20Z")

</div>

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](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

---

<div class="post-metadata">

**Author:** ![jpmeijers](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/jpmeijers/32/44875_2.png) [@jpmeijers](https://www.thethingsnetwork.org/forum/u/jpmeijers)\
**Post date:** [May 11, 2017, 4:18pm UTC](https://www.thethingsnetwork.org/forum/t/ttn-payload-with-sodaqone-tracker/7219/2 "2017-05-11T16:18:42Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Sebastien\_Demarbre](https://www.thethingsnetwork.org/forum/letter_avatar_proxy/v4/letter/s/0ea827/32.png) [@Sebastien\_Demarbre](https://www.thethingsnetwork.org/forum/u/Sebastien_Demarbre)\
**Post date:** [May 11, 2017, 5:27pm UTC](https://www.thethingsnetwork.org/forum/t/ttn-payload-with-sodaqone-tracker/7219/3 "2017-05-11T17:27:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![arjanvanb](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/arjanvanb/32/46626_2.png) [@arjanvanb](https://www.thethingsnetwork.org/forum/u/arjanvanb)\
**Post date:** [May 11, 2017, 5:40pm UTC](https://www.thethingsnetwork.org/forum/t/ttn-payload-with-sodaqone-tracker/7219/4 "2017-05-11T17:40:22Z")

</div>

~~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.

---

<div class="post-metadata">

**Author:** ![marcovanschagen](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/marcovanschagen/32/39136_2.png) [@marcovanschagen](https://www.thethingsnetwork.org/forum/u/marcovanschagen)\
**Post date:** [May 11, 2017, 6:02pm UTC](https://www.thethingsnetwork.org/forum/t/ttn-payload-with-sodaqone-tracker/7219/5 "2017-05-11T18:02:25Z")

</div>

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.

> <https://github.com/Kaasfabriek/GPS-Lora-Balloon-rfm95-TinyGPS/blob/master/Balloon-rfm95/Balloon-rfm95.ino#L58-L92>

---

<div class="post-metadata">

**Author:** ![Sebastien\_Demarbre](https://www.thethingsnetwork.org/forum/letter_avatar_proxy/v4/letter/s/0ea827/32.png) [@Sebastien\_Demarbre](https://www.thethingsnetwork.org/forum/u/Sebastien_Demarbre)\
**Post date:** [May 11, 2017, 6:21pm UTC](https://www.thethingsnetwork.org/forum/t/ttn-payload-with-sodaqone-tracker/7219/6 "2017-05-11T18:21:09Z")

</div>

@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

---

<div class="post-metadata">

**Author:** ![Sebastien\_Demarbre](https://www.thethingsnetwork.org/forum/letter_avatar_proxy/v4/letter/s/0ea827/32.png) [@Sebastien\_Demarbre](https://www.thethingsnetwork.org/forum/u/Sebastien_Demarbre)\
**Post date:** [May 12, 2017, 11:38pm UTC](https://www.thethingsnetwork.org/forum/t/ttn-payload-with-sodaqone-tracker/7219/7 "2017-05-12T23:38:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pgauvin](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/pgauvin/32/25844_2.png) [@pgauvin](https://www.thethingsnetwork.org/forum/u/pgauvin)\
**Post date:** [June 23, 2018, 10:26pm UTC](https://www.thethingsnetwork.org/forum/t/ttn-payload-with-sodaqone-tracker/7219/8 "2018-06-23T22:26:07Z")

</div>

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 🙂

{  
“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  
};  
}
