We constantly log our GPS location. And these logs allow us to track where we have been. We log to two different databases within Molly and another lower fidelity database in the cloud. These logs make it easy to generate tracks and look back in time to see where we have been. Logging belongs to the Monitoring section of the Technical Series, while tracking belongs to Mapping section. So this page is about how we log the GPS tracks.
When we did our big trip around the world, we had a little 5 inch Garmin nüvi 52LM. This was a great device, and we used it to record all of our tracks. However, we would put it away each night, meaning we had to re-connect it every morning. And we had to manually download the tracks from the memory card. For Molly, we wanted the system to be fully automatic, quietly and constantly logging in the background. More details on how we use to do it on this post.
Molly has an external antenna mounted on the rear bumper. It is located to have a good view of the sky and the orbiting Global Positioning System (GPS) satellites.
Molly’s house is made of fiberglass, which is virtually invisible to high frequency radio waves. So the GPS antenna can see right through the house material
This is a high quality sensor and is able to see satellites even when we drive under forest canopies and high sided ravines. Much better than the GPS receivers in the iPhones which typically lose signals under difficult conditions.
The Cradlepoint modem attaches to the antenna via low loss coaxial cables to complete the sensor. The electronics in the modem decodes the signals from the antenna and calculates the position.
The Cradlepoint modem is quite flexible on how it can transmit the GPS location information to other computers. In our case we have configured the Cradlepoint point to send the GPS coordinates to the computer mounted in Molly. In fact, we send the signal twice for recipt by two different applications on the computer.
The GPS information is sent in a sentence based protocol. There a few protocols availabke in the Cradlepoint modem, and we use the good old NEMA 0183 sentence protocol. Which dates back to at least January 1992 (almost 40 years old). It is a good choice, being so old, NEMA 0183 is compatible with many GPS logging systems. Cradlepoint makes a few vendor specific extensions, like the addition of a station identifier.
We have configured our modem to send the following GPS sentences.
- $GPGGA provides fix data like latitude, longitude, altitude, time of fix, fix quality, number of satellites used to establish the fix, precision of fix and height of geoid above WGS84 ellipsoid
- $GPRMC includes some of the values from $GPGGA, but adds date of fix, speed over ground in knots), course made good (relative to true) and magnetic variation.
- $GPVTG includes the above with speed over ground also reported in Kilometers per hour being added.
We send all three sentences and extract parts from $GPGGA to determine location and parts form $GPVTG to determine motion. Sentences are sent every 10 seconds, even if Molly has not moved.
Below is an example of all three sentences, with the station identifier of Molly42 prefixed to each sentence.
Molly42,$GPGGA,214824.00,3607.223654,N,12128.322347,W,1,9,0.8,629.6,M,-29.0,M,,*54\r\n Molly42,$GPVTG,180.9,T,180.7,M,20.0,N,30.0,K,A*25\r\n Molly42,$GPRMC,214824.00,A,3607.223654,N,12128.32347,W,29.10,180.2,051019,14.6,E*33\r\n
Sentence Decoding in node-red
The sentences are decoded using a node-red function with the output then placed into influxdb. The checksum of each sentence is validated, and then the following values are extracted and stored in the database every 10 seconds.
$GPGGA - latitude [degrees] - longitude [degrees] - altitude [in meters] - quality of fix [index] - number of satellites used in fix [number] - horizontal dilution of precision [index] - time of fix [hhmmss UTC] $GPVTG - course made good (true) [degrees] - speed over ground [Kilometers/hour]
Sentence Decoding in Traccar
The GPS sentences are also decoded by Traccar which is an open source GPS tracking platform. Traccar does not support Cradlepoint, so we added to the platform with some new code. Unfortunately Taccar is not very good at combining information from different GPS sentences and has no framework to shared information across messages. Regardless, we got it working.
The following values are stored in the Traccar database.
$GPRMC - latitude [degrees] - longitude [degrees] - speed [knots] - course [degrees] - Validity of fix - time of fix [hhmmss UTC] - date of fix [ddmmyy] $GPGGA - altitude [in meters] - number of satellites used in fix [number] - time of fix [hhmmss UTC]
At present the code does not check the checksum. The code has been written to do this, just have not added it yet.
That’s it for the logging. The log entries are retained indefinitely. Of course the log entries can be display onto a map, but that is discussed in the various posts about mapping.
Cradlepoint GPS Specifications
The Cradlepoint modem has an excellent GPS receiver/decoder chip, as demonstrated by the following specifications.
— Maximum of 55 channels with simultaneous tracking
Supported Satellite Systems
— Horizontal: < 2 m (50%); < 5 m (90%)
— Altitude: < 4 m (50%); < 8 m (90%)
— Velocity: < 0.2 m/s
— 1 Hz refresh rate
— Hot start: 1 second, Warm start: 29 seconds, Cold start: 32 seconds
Connecting it Together
The Cradlepoint modem is physically connected to the computer and the Raspberry Pi via ethernet cables. And there is good information in the Cradlepoint modem documentation on how to configure the modem to send the GPS coordinates to other computers.
The main computer runs Traccar while the Raspberry Pi runs node-red.
Satellite GPS Logging
Of course we can also track our location via the Spot Trace satellite tracker we have. These waypoints are stored in the cloud in our AWS account. So even is everything in Molly falls apart, then we still have logs stored in the cloud.
Maybe in the future when Amazon launches their time-stream service, we will send data from Molly to the cloud. But more on that later.