GPS and Cellular

boron
Tags: #<Tag:0x00007fe22be6dcb8>

#1

I have a project that needs a GPS/CELLULAR setup. So I have started looking at both the Asset Tracker with an Electron (or Boron with adapter) or use the Boron and external GPS like the Adafruit Ultimate GPS. My project will probably require an external antenna so I’m trying to figure which setup would be the best solution based on having to use this antenna.

The reviews for the Asset Tracker seem to indicate it has problems acquiring a fix even with an external anntena. So that’s an issue with me. The Adafruit Ultimate GPS seems OK except I would like to use the 3.3V from the Boron to power it and I have read that may cause buggy performance.

Based on this info and your experiences which way would be best to go. Any direction would be helpful.

You guys are great, oops I mean guys and gals…


#2

Here is a good GPS receiver that you can use over i2c or Serial.

I used this with the Electron with zero issues.

Adafruit has one like this now also but it was out of stock last time I checked.


#3

Hi @RWB, I just received one of the Adafruit ones you referenced ( PA1010D ), but I’m not smart enough to add it to my Particle code without a pre-existing library :blush:. Did you find one that worked for the Sparkfun XA1110 that I could tinker with?

Adafruit has a guide published here: https://learn.adafruit.com/adafruit-mini-gps-pa1010d-module/circuitpython-python-i2c-usage

But again, I don’t do this stuff enough to connect the dots. Any help from the community appreciated!
Thanks


#4

Hey!

Yes I had to create some code that worked over i2c via some trial and error.

Here is the i2c code for just the GPS module:

https://drive.google.com/drive/folders/1z2IunMXSIqCE2mDKPKyyep4iuGv6_1d3?usp=sharing

And here is the code I had working for the Electron where I replaced the GSP receiver over i2c vs the original serial communication setup used in the Particle Asset Tracker library:

https://drive.google.com/drive/folders/1b3gBx0A8Qfhdzw0lllPIXI4aqrLvKE9i?usp=sharing


#5

Thanks so much! I got it talking and 90% there - the raw values are coming into the “myI2CGPS” object just fine:

$GNGGA,224801.000,435.9216,N,1162.2050,W,2,11,0.89,814.2,M,-18.6,M,,*4E
$GPGSA,A,3,28,30,09,23,27,07,05,08,,,,,1.21,0.89,0.83*04
$GLGSA,A,3,66,67,77,,,,,,,,,,1.21,0.89,0.83*17
$GNRMC,224801.000,A,435.9216,N,1162.2050,W,0.34,225.60,110120,,,D*61
$GNVTG,225.60,T,,M,0.34,N,0.63,K,D*27

But when I introduce the TinyGPS++ library for decoding, something breaks down and it either has no return object, or its all zeroes. If I remove the Whiles and Ifs and force the displayInfo interrupt to publish regardless, it sends this to the Particle console:

0.000000, 0.000000:0.00:0:0.00:256.00:2684354560:0.00:

(The populated values come from the FuelGauge elements)

So I just need to spend a little time digging into what’s breaking the TinyGPS decoder.

But very pleased with the progress so far, and that little PA1010D seems to lock in substantially faster than the UltimateGPS Featherwing I was using previously.


#6

Looks like PA1010D reports position as GNGGA instead of GPGGA, which is what the TinyGPS++ library was looking for. So once I updated these two lines:

#define _GPRMCterm   "GPRMC"
#define _GPGGAterm   "GPGGA"

to


#define _GPRMCterm   "GNRMC"
#define _GPGGAterm   "GNGGA"

BAM working like a champ. Thanks again, cheers


#7

Happy you got it working!

I felt so proud of myself when I got this working without asking for any help :slight_smile:

I’m not sure why you needed to make that change because the code work as it is for me. Maybe the newer GPS chips have different output settings like you noticed. Good to know regardless.

I also updated some of the code that told when to send Particle Publish events when the location changed. I made it so it would only send updates when a significant position change had happened, which is was always sending position updates before the code change which would waste your cellular data.


#8

That’s funny because the next thing on my mental to-do list was to only publish upon:

(position change > ?20ft?) - my device gets deployed to a random ag field for 3 to 6 months, and then moves to a different one or into storage “unannounced”. So I need to ignore jitter, but definitely be able to find it when it moves!
OR
(time since last update > X hrs) - was just thinking that it nice to have a ‘heartbeat’ of sorts that confirms the GPS is still working even if no movement

Lots of good examples in the TinyGPS++ library!


#9

Here is that code that I changed for the GPS update upon movement: