Author Topic: Get GPS data into 12 bytes  (Read 845 times)

Nick_W

  • Full Member
  • ***
  • Posts: 215
    • View Profile
Get GPS data into 12 bytes
« on: January 17, 2017, 12:25:46 am »
Does anyone know the accuracy of the GPS module? It's giving 6 decimal places, but it's hard to believe anything more than 4 decimal places are accurate.

Anyone have any code for shoehorning the gps lat and long into 24 or 32 bits, so they will fit in a SigFox payload?

If the floats are IEEE 754 format it should be easy enough to add them plus a timestamp into 12 bytes. Can you just add them to a ListOfBytes? I have tried the add and extract methods for ListofBytes without much luck. I think it's the extract methods that don't work.

Can anyone confirm these assumptions?

Thanks,
« Last Edit: January 17, 2017, 12:35:33 am by Nick_W »

Share on Facebook Share on Twitter


mc-John

  • Global Moderator
  • Full Member
  • *****
  • Posts: 212
    • View Profile
Re: Get GPS data into 12 bytes
« Reply #1 on: January 17, 2017, 09:29:50 am »
The extract functions work. You have to choose the correct endianness though. We have a lot of customers that store their GPS location in the Sigfox payload and extract it to show the location on google maps.

Sigfox16

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Get GPS data into 12 bytes
« Reply #2 on: March 17, 2017, 11:17:35 am »
Hi. Bumping this for some additional insight. ;)

I would like to extract an integer value for Lat, Lon generated by the MCDEMO205 GPS.

Could you show an example of how to use the extract function and them have it applied to a Sigfox payload (sfData) ?

I am assuming ExtractFloat converts from Little Endian and IEEE Float.  I'm a Newbie OOP-er.

Thanks,
SF16

mc-Abe

  • Full Member
  • ***
  • Posts: 167
    • View Profile
    • mc-Things
Re: Get GPS data into 12 bytes
« Reply #3 on: March 17, 2017, 02:01:39 pm »
You can just use the AddFloat method to add data to a byte payload. You can specify big or little endian in the AddFloat function. The extract methods are meant for pulling data out of a buffer.
Winner Winner x 1 View List

kbrooking

  • Full Member
  • ***
  • Posts: 104
    • View Profile
Re: Get GPS data into 12 bytes
« Reply #4 on: May 16, 2017, 07:19:20 pm »
Hello Nick,

Where you able to solve the shoehorning the gps lat and long into 24 or 32 bits, so they will fit in a SigFox payload?

If so, could you please share some example code?

kbrooking

  • Full Member
  • ***
  • Posts: 104
    • View Profile
Re: Get GPS data into 12 bytes
« Reply #5 on: May 19, 2017, 02:29:34 pm »
What is the correct endianness for Sigfox message?

Nick_W

  • Full Member
  • ***
  • Posts: 215
    • View Profile
Re: Get GPS data into 12 bytes
« Reply #6 on: May 20, 2017, 01:41:59 pm »
Yes, I did get his to work, I have it somewhere in my module 205 code somewhere....

My main problem was that the extract functions didn't work as advertised, so was packing stuff, unpacking to check and getting bogus results. Extract is now fixed (but pack actually did work OK).

I think I went over this with someone else here on the forums, they were having trouble extracting the float from a sigfox packet. It's actually quite simple, it was the extract giving bogus values that had me confused...