Asset Tracker V2 issues

I built a nice GPS tracker using an Electron and the Kicstarter version of the Asset Tracker. Now I’m building a second one using the newer V2 Asset Tracker and I’m running into a couple of weird problems.

The first thing I discovered was that I couldn’t get any data from the accelerometer. A bit of searching led me to discover that this is apparently caused by powering up the GPS after the tracker is initialized. Changing the order in Setup() seems to have fixed this.

However, there are still a couple of problems I can’t figure out how to solve.

For one I am getting bad data from the AssetTracker getAltitude() function. When the GPS first starts up I see quite a few zero values from getAltitude(), even though where I am now it’s at least 120 meters MSL. I know GPS altitude isn’t all that accurate, but the error is too much, and the V1 tracker never does this. Just now I started getting values of -108.5m repeatedly.

I also discovered that I’m not getting any $GPRMC or $GPGGA sentences from the AssetTracker interface. These are normal messages which should be present in any GPS data stream. Why would I see these sentences from the V1 tracker but never from the V2? This is not a show stopper but it is really odd that these aren’t coming thru. GGA in particular would help me debug what the problem is with getAltitude(). GGA also gives us the fix quality, which is very useful.

William

I can answer this question:

I also discovered that I’m not getting any $GPRMC or $GPGGA sentences from the AssetTracker interface.

The u-blox GPS generates $GNRMC messages instead of $GPRMC. They can be parsed in the same way.

I think the same is true for $GPGGA. It's possible that the GPS parser is not handing $GNGGA properly, which would explain why the altitude is incorrect.

I’m not sure why altitude isn’t working with the official AssetTracker library, but I just fixed it in my library, AssetTrackerRK, which is nearly a drop-in replacement. The instructions are here:

Thanks Rick! After I posted that I ran a sample of all the NMEA sentences and saw that the GGA and RMC have a $GN prefix. I wondered if that was why the altitude isn’t working, but it’s odd because sometimes it does work. In any case I will load your new library and try that.

Hmmm… there are several functions I am using in the original AssetTracker library that are missing from yours. It looks like I can get what I need from your TinyGPS - will I get in trouble using both at the same time? I’m not quite ready to rewrite the entire app, if I did that I’d port my own GPS module…

Yes, you can mix calls to both. The backward compatibility API is missing some functions that were more recently added to the official library, but all of them just wrap the TinyGPS calls. You can just make the calls directly. There’s a method in AssetTrackerRK to get the TinyGPS object to make the calls.

I’m sorry, could you provide an example? I tried but I’m not getting any data from TinyGps.

#include “AssetTrackerRK.h” // use RK’s version of the Asset Tracker library
AssetTracker t = AssetTracker();
TinyGPSPlus gps;

All calls to fetch gps data return zeros. Examples:
gpsSats = gps.satellites.value();
gpsAlt = gps.altitude.meters();
gpsAge = gps.location.age()

Thanks

Sorry, don’t create another TinyGPSPlus object. Just call:

t.getTinyGPSPlus()->satellites.value()

for example.