Last time in Part 1, Jeff provided useful insights into GPS receiver data processing and trilateration. He presented a circuit that accepts streaming GPS data to display selected information. In this article, he covers the logging of GPS data and how technology has improved overall accuracy.
Unless you live in New Jersey or Oregon, you probably pump your own gas at a gas station. Gas stations use to be known as service stations. At a service station, you would have an attendant who would pump your gas and check your oil, tire pressure, and wash your windows all without an additional charge on top of the price of petroleum. These service stations would also give premiums, a drinking glass or other goody, just for the privilege of serving you. They also had paper state maps available to help find your way to your destination. The purpose of state maps was to show how the interstates, highways, routes, and streets interconnected each city and town. While they usually had points of interest and other landmarks, there was little else to give a sense of the terrain.
The paper map is pretty much extinct thanks to the navigation apps we have on our smart phones and in-vehicle navigational systems. While the information is the same, the delivery system has changed. Route guidance has kept the peace between driver and passenger in many a vehicle, except for the unexpected glitch. These occur when the mapping industry has not caught up with real-world changes. For the most part, you won’t find longitude and latitude on any of these navigational aids. I learned about longitude and latitude from a globe. How many of you possess a globe? For many of our younger readers, the question might be, “What’s a globe?”
Although we still can see the globe used as an icon on the nightly news broadcast, many now get their news streamed. I have to admit that, to this day, when I hear of some calamity in a city/country in the news, I look for globe shot to help pinpoint where on Earth the event is taking place. My knowledge of geography is sorely lacking. I used to be able to name all 50 states and capitals. I’d likely have a hard time with just the states today.
MAPS, FOR NAVIGATION
Explorers, either on land or at sea, began drawing maps by referencing local landmarks. The scale of land maps covered miles, whereas ocean navigation required much larger scales. But how could sailing maps portray distance relative to the Earth. Once we realized the Earth was round and it rotated once a day, we could determine distance by knowing the difference in time of day between the local landmark and the present position. The Earth’s circumference was divided into 360° (a full circle). Like cutting an orange into 360 wedges. If you were starting from the local landmark and moving west, these would be numbered 0 to 180 W (west of 0°). If you were moving East, these would be numbered 0 to 180 E (east of 0°). Based on the circumference of the Earth of 24,901 miles, a degree (at the equator) will be 24901/360 = 69.1694 miles. That’s fine for the equator, but as you moved north or south the wedge width changed. In fact, at the poles the wedge width is zero (see Figure 1)!
The distance of a degree was a function of how far away north or south you were from the equator. If you consider the equator 0° and a pole 90° (N or S) of the equator, then the distance (at the equator) of one degree is 69.1694 miles. If you plot degrees between the equator and the poles, you have equidistant parallel rings above and below the equator. These parallels are named latitudes with an N or S designation. The circumference of the Earth, perpendicular to the equator is 24,859 miles, slightly less than that at the equator. Distance between one degree latitude is 24859/360 = 69.0527 miles. For normal conversation, we can use 69 miles for the width of 1° both longitude and latitude, with the note that longitudinal distance must include the cosine of the latitude.
With map makers basing their maps upon some local landmark, it takes some calculating to go from one map to another referenced from a different land mark. It wasn’t until 1884 that Chester A. Arthur requested a conference be held to determine a prime meridian for international use. This resulted in selection of the Greenwich Meridian (longitude passing through Greenwich England) as an international standard for 0° longitude. All future maps would now have a universal reference for all locations on Earth.
Topography is the study of the shape and features of the surface of the Earth and other observable astronomical objects. We’ve come to equate this field to local detail, including not only relief but also natural and artificial features. Relief may include the graphic representation of the landform on a map by a variety of techniques, including contour lines, hypsometric tints, and relief shading. An early topologic map from France (circa 1745) uses relief shading to show elevation (see Figure 2).
Maps are classified as small, medium, and large. Small scale refers to world maps or maps of large regions such as continents or large nations. They show large areas of land on a small space. They are called small scale because the representative fraction is relatively small. For instance, if a 1-m map depicts objects that cover 100,000,000 m, that’s a scale of 1:100,000,000.
Large-scale maps show smaller areas in more detail, such as county or town. Such maps are called large scale because the representative fraction is relatively large. A large-scale 1-m map of a town will display an area of 10,000 m at a scale of 1:10,000.
The US Geological Survey (USGS) began publishing maps in 2009. The scale used for most US Topographic mapping is 1:24,000. USGS maps at this scale cover an area measuring 7.5 minutes of latitude and 7.5 minutes of longitude and are commonly called 7.5-minute quadrangle maps. Map coverage for most of the United States has been completed at this scale.
Figure 3 shows the quadrangle of Ellington, CT with Crystal Lake on the right border of the map. This quadrangle covers 41°52.5000’ to 42°00.0000’ latitude and 72°22.5000’ to 72°30.0000’ longitude. The enlarged inset covers approximately 2000 square feet. As shown earlier, 1° is approximately 69 miles (i.e., 69 × 5,280’) for a total of 364,320’ per degree. Since the quadrangle covers 7.5 minutes (tick marks on map are 2.5 minutes), that’s 364,320 × 7.5/60, or 45,540’ in latitude and 45,540’ × cos(42°) or 33,843’ in longitude at the map top and 45,540 ft × cos(41°52.5000) or 33,909’ in longitude at the map bottom. Note that the map’s key holds a lot of important information as well as a graphic of where this quadrangle fits into the bigger schema, in this case the state of Connecticut.
LOGGING GPS DATA
The circuit presented last month accepts a standard string of serial data that most GPS units will spit out. GPS output can include a number of different strings, each containing specific info, such as, almanac data, fix information, latitude/longitude data, satellite data, vector track and speed over the ground, waypoint location information, Zulu (UTC) time and date, compass output, and custom data. Each string begins with the preface $GPxxx, which identifies the data that follows, ending with checksum and/or CR/LF. Only ASCII data is transmitted (lest CR/LF), so the string is human readable.
The goal here was to pick off longitude, latitude, and altitude data and display it on an LCD. The application monitors GPS output for the $GPGGA string, which contains these three elements, decodes the pertinent values and creates display data. This formatted display data is sent out a second serial port and can be displayed or analyzed by an external device. Since the circuit includes four push buttons, I append button pushes to the end of the data. This can be used to indicate data points of interest.
I use the serial terminal program RealTerm for monitoring serial data on my PC/laptop. One feature I use quite often is the logging function. This will save all serial input to a log file. Using the circuit and laptop, I wanted to see if my movements could be used to map areas. Our property is situated between West Shore Road, to the west, and Crystal Lake, to the east. A U-shaped dirt road splits the property (north/south) into two separate lots providing access to multiple homes in the neighborhood. Our residence is on the western lot, while the empty lot on the east offers access to the lake and the most colorful morning sunrises over the water.
JOSM is a Java open source editor for Open Street Map (OSM). Using JOSM, you can import and export data including nodes (points), ways (connected points), relationships (connections), areas (closed way), tags (node descriptions). A number of external sources can be accessed to provide relevant entities, like road maps and satellite data. To use my log files with JOSM, I would need to reformat the data for the JOSM import function. In reality, I could reprogram my GPS circuit to output a standard JOSM file, but I didn’t want to be re-coding this application every time I went off on a new tangent. My compromise was to use a translation application written in Liberty Basic, to provide a simple import/export function. Once I had this one translation, it could be easily modified for any future conversions I might want.
Figure 4 is some typical output from my original circuitry. Listing 1 shows how this log file is translated into a .OSM file. When this file is imported into JOSM and overlayed onto a Bing Satellite map we get Photo 1.
Listing 1 The log file is translated into an .OSM file <?xml version=’1.0’ encoding=’UTF-8’?> <osm version=’0.6’ upload=’true’ generator=’JOSM’> <node id=’1’ timestamp=’2016-09-22T21:08:28Z’ uid=’4585998’ user=’jlbachiochi’ visible=’true’ version=’1’ changeset=’42206188’ lat=’41.936721’ lon=’-72.37980’ alt=’190.0’ /> <node id=’2’ timestamp=’2016-09-22T21:08:29Z’ uid=’4585998’ user=’jlbachiochi’ visible=’true’ version=’1’ changeset=’42206188’ lat=’41.937026’ lon=’-72.37980’ alt=’190.8’ /> <node id=’3’ timestamp=’2016-09-22T21:08:30Z’ uid=’4585998’ user=’jlbachiochi’ visible=’true’ version=’1’ changeset=’42206188’ lat=’41.936972’ lon=’-72.379555’ alt=’185.4’ /> <node id=’4’ timestamp=’2016-09-22T21:08:31Z’ uid=’4585998’ user=’jlbachiochi’ visible=’true’ version=’1’ changeset=’42206188’ lat=’41.936693’ lon=’-72.379443’ alt=’185.1’ /> <way id=’4’ timestamp=’2016-09-23T18:15:40Z’ uid=’4585998’ user=’jlbachiochi’ visible=’true’ version=’1’ changeset=’42206188’> <nd ref=’1’ /> <nd ref=’2’ /> <nd ref=’3’ /> <nd ref=’4’ /> <tag k=’boundary’ v=’administrative’ /> </way> </osm>
Note the four nodes that create a way (or path between nodes) southwest, northwest, northeast, and southeast. These could be converted into an area by adding a fifth node with the same coordinates as the first (completing the boundary). These four nodes were not from logged data, but JOSM. Let’s take a look at the data I logged while walking to these corners on the property. Photo 2 shows the clockwise path I took around the physical boundaries. A yellow marker is placed for every sample (one per second).
Two things you may notice is that the start and end are not on the same spot, the end is correct. Second, leg one (not starting on the right location) seems to travel past the north boundary (wall) both too far north and east. Hmm, let’s try this again walking on a different path. Photo 3 shows a diagonal path northeast toward a set of stairs. It then goes north and south along the shore, back up another few steps on diagonally northwest toward the east end of the wall, and finally back to the start. This time we started and ended correctly, but my trip along the shore doesn’t seem to follow in the same footsteps and I seemed to have crossed the wall again. Hmm, I don’t remember being inebriated. Well, in fact, the GPS might be.
Up until May 2000, GPS employed a feature called selective availability (SA) that degraded civilian accuracy on a global basis. This was meant to prevent our enemies from using GPS to target a specific point with any accuracy. With SA now permanently turned off, we can expect that GPS will be accurate to approximately 10’ with 95% probability. This is the horizontal accuracy. Altitude accuracy is somewhat worse. Let’s do a stationary test and see what pops out.
I placed the GPS down on the ground walked away and logged data for more than 5 minutes. The log file shows 386 samples (1 per second). Table 1 shows the test results. From this you might suspect that there are some real problems with the equipment. Errors can accumulate from any of these six areas (see Table 2).
Ephemeris errors result when the GPS message includes incorrect satellite location. Because satellite errors reflect a position prediction, they tend to grow with time from the last control station upload. However, the predictions are long smooth arcs, so all errors in the ephemeris tend to be slowly changing with time. While normally continuously monitored and corrected, if uploads were interrupted for 24 hours, this might be equal to 2 m of error.
Fundamental to GPS is the one-way ranging that ultimately depends on satellite clock predictability. Even though GPS uses atomic clocks, if uncorrected over a 24-hour period, they may contribute to approximately 3.5 m of error.
Because of free electrons in the ionosphere, GPS signals do not travel at the vacuum speed of light as they move through this region. The ionosphere is usually reasonably well-behaved and stable in the temperate zones. Near the equator or magnetic poles, it can fluctuate less predictably. A correction for single frequency receivers can be implemented with an effective error of about 2 to 5 m.
Another deviation from the vacuum speed of light is caused by the troposphere. Variations in temperature, pressure, and humidity all contribute to variations in the speed of radio waves. Again, corrections can be effectively accurate to about 1 m.
Multipath is the error caused by reflected signals entering the front end of the receiver and masking the real correlation peak. These effects tend to be more pronounced in a fixed receiver near large reflecting surfaces. With proper siting and antenna selection, the net impact should be less than 1 m.
Initially, most GPS commercial receivers were sequential. One or two tracking channels shared the burden of locking on to four or more satellites. Modem chip technology contains multiple tracking channels to produces a precision of better than 0.3 m. With ranges to the satellites of over 20,000,000 m, a precision of 1 to 10 × 1010 or better is required. Modem microprocessors now provide such precision along with improved calculation speeds. The net result is that the receiver should contribute less than 0.5 m error in bias and less than 0.2 m in noise.
From all this, we can see that the mission of the Air Force Space Command MCS at Schriever Air Force Base (as discussed last month) is critical to minimizing errors due to satellite’s Ephemeris data and clock synchronization. GPS accuracy is the degree of agreement between the estimated or measured position, time, and/or velocity at a GPS receiving antenna and its true time, position, and/or velocity. Location accuracy can be viewed in three ways: predicable, repeatable, and relative.
Predictable accuracy relates to maps or charts. It is the system’s position solution with respect to the charted solution and must be based upon the same geodetic datum (assumed shape of the Earth). Repeatable accuracy is the ability to return to a position whose coordinates have been measured at a previous time with the same navigation system. Relative accuracy is that between multiple measured locations using the same navigation system at the same time.
Did you know that most vehicle navigation systems use a special algorithm to place your car’s icon only on the roadbed, as opposed to where it calculates its position? With an accuracy of 10 m, your position might be off by more than a whole lane, which might put you in the gutter or worse yet, in the opposing lane! We won’t be seeing driverless cars depending only on GPS any time soon.
Today, agricultural farming (as well as other fields, no pun intended) is taking advantage of differential GPS to conquer inaccuracies. Differential GPS (DGPS) overcomes the effects atmospheric signal distortions to improve accuracy down to inches. The idea is based on the fact that multiple receivers will experience the same atmospheric effects.
DGPS requires that a GPS receiver be set up on a precisely known location as a base or reference station. The base station receiver calculates its position based on satellite signals and compares this location to the known location. This difference is a correction that may be applied to another GPS receiver, known as the roving receiver. This correction can be applied in real time over a separate RF link to the roving receiver or recorded and applied in post processing. (Date and time stamps allow correlation between the two recordings.)
While this sounds simple enough, the two must be synchronized in such a way that both will be using the same satellite data. Ordinarily, computations are made internally with the system deciding which satellites to use to determine a fix. Unless both systems use the same satellite data the results will not correlate. Therefore, the reference station must calculate a correction for each satellite and relay this data as part of its inter-station communications.
Presently GPS receivers use code-phase to match the “pseudo-random code” from each satellite for identification. While this can provide accuracy to meters, doing some additional comparison based on carrier phase could improve this by a factor of 100 or so. Like most other technology, advancements to our global positioning system will continue to improve.
I started this project to figure out if today’s GPS was good enough to do some mapping of my property. While the paper survey I have maps the boundaries based on compass headings and distances, it does not contain GPS coordinates (see Figure 5). If I go back to my deed, all references are made to other boundaries, none of which contain any real coordinates either. In fact, some boundary markers are trees. Certainly, these can’t be counted on as permanent. If I were to leap-frog back through adjacent surveys, eventually I would find some coordinates upon which all these maps are referenced.
Satellite mapping has changed all this, at least on the surface, as I can find my property and zero in on its exact latitude and longitude coordinates. Roadbeds are good reference points. They consist of way points (latitude and longitude). The way point in the dirt road splitting our property is on line with the east/west boundary. Since the road is 20’ wide, the distance from this way point to the corner of the boundary is 10’. I’ve already shown that the GPS errors I’ve seen are approximately ±5’. So, while I can accurately locate one corner of the lot referenced to the road’s way point, my GPS fixes can only get me to within ±5’ of the other corners, without using differential GPS.
With this kind of error, I can’t hope to get to where I wanted to go with this project. That is, not only a 2-D map the area, but a 3-D map including topographical information using the altitude data from the GPS. As it turns out, the altitude data is much less accurate than the horizontal (latitude and longitude) data. The quadrangle topo map states that Crystal Lake is at an altitude of 636’. My GPS logs have a maximum altitude of 692’ and minimum of 606’. (So my property might be under water!) Actually, the maximum height of the property is only about 30’ above the lake’s water level. This means there are two areas I’ll need to investigate further, both differential GPS and alternate ways of obtaining altitude. Looks like I’ll need to revisit this in the future when I’ve collected more information. Feel free to drop me a line with any experience you’ve had using GPS.
I’ve also been playing with some graphing for presenting latitude, longitude, altitude data, by filling in the points between fixes (way points) and presenting a 3-D view of the topography. However, we won’t get into that until I can log data with more accuracy. So much to learn, so little time.
Ultimate GPS Module
Adafruit | www.adafruit.com
VK16E GMOUSE GPS Module W/Ceramic Antenna (SiRF III)
DIYmall | www.amazon.com/DIYmall-GMOUSE-Module-Ceramic-Antenna/dp/B015R62YHI
PMB-648 Polstar GPS Module W/Ceramic Antenna (SiRF III)
Parallax | www.parallax.com
VPN1513 GPS Smart Module (SiRF III)
SimplyTronics | www.shopsimplytronics.com
GP-735 GPS Receiver (7th generation u-blox)
SparkFun | www.sparkfun.com/products/13670
PUBLISHED IN CIRCUIT CELLAR MAGAZINE • FEBRUARY 2017 #319 – Get a PDF of the issueSponsor this Article
Jeff Bachiochi (pronounced BAH-key-AH-key) has been writing for Circuit Cellar since 1988. His background includes product design and manufacturing. You can reach him at: email@example.com or at: www.imaginethatnow.com.