Research, research, research.
Problem: So these handhelds and auto units are pretty cool. They have all these maps and tracking and often give you directions. They’re a little higher priced. My biggest problem is the map updates. You have to pay for them! Google Earth is free and updates are free! Logically, I am OLD and live out in the country where roads don’t change much so what does it matter. It just gets my goat! Actually, at my house, Google Earth is using a 2003 map and doesn’t show three houses that have been built since. No matter.
USB interface to laptop
NMEA 0183 output: National Marine Electronics Association (NMEA) 0183 is a standard serial communications protocol supported by most computer GPS software.
My selection was the USGlobalSat BU-353. See picture. At the time, the best price I could find was actually Amazon.com (~$34).
Here’s the US website.
Other features I liked are the SiRF Star III chipset which is pretty highly rated, WAAS-capable and a 20 channel receiver.
TIP: 20 channels refer to the number of satellites the receiver can receive at the same time. There are only 24 active satellites at any time around the world and the most you can pick up at one time is typically 10-11, so 20 is a bit of overkill.
GPS was developed by the US Department of Defense and is maintained by the US Government.
The basic GPS receiver will give its latitude, longitude and altitude. It also runs on an extremely accurate clock. It requires four satellites to get a fix. Basically, each satellite has its own atomic clock and transmits the exact time and its position to the receiver. The radio signal takes time to get to the receiver (basically, the speed of light). The receiver calculates how long it took to get to it and therefore how far the satellite is from the receiver. With four satellites, it can pinpoint its location. With more than four satellites, accuracy is improved. Specifications for the BU-353 say accuracy is 10 meters.
WAAS: Wide Area Augmentation System is a system of US ground stations that augments GPS receivers to improve accuracy in this case to 5 meters.
Here are some good websites for more GPS information:
GPS Guide for Beginners:
How Stuff Works:
Step 1: Using BU-353 With Windows
You will need the USB driver and the GPS Info utility for your computer operating system.
I believe the correct order is load the USB driver, connect the BU-353 and load the GPS Info software.
Like most USB GPSs, the BU-353 converts USB to a software serial port.
Setup: When you run the GPS Info program, the first thing you need to do is figure out which Com port the BU-353 is using. You can click on the Scan Comm Port icon. One of them should show as GPS receiver. Then click OK and it should put in the correct Com port into the drop down box. Then press Start GPS . The data should scroll, the correct Date, Time, Latitude and Longitude should be displayed. The scrolling data is the data coming from the BU-353 or if in red, the commands sent to the BU-353. The globe and the data at the bottom display the active satellites. Direction and Speed are meaningless unless you are moving. See picture.
One nice feature is the Set Time in the upper left corner that will set your computer clock to the correct time.
WARNING: I wouldn’t send any commands to the BU-353 unless you really know what you are doing.
WARNING: It seems to me like the WAAS/EGNOS checkbox turned WAAS off instead of on. I think if you recycle power it turns WAAS back on automatically.
WARNING: The first versions of the USB driver and GPS Info I used would lock up the Com port so that I couldn’t use other software without restarting. This seems to be fixed in the latest releases.
Some other free software that supports NMEA 0183 devices:
Most software needs to know what Serial com port the GPS is using.
TIP: To find the GPS com port number in Windows XP, click on the Start icon, right-click on My Computer, choose Properties, choose Hardware tab, click on Device Manager, click on Ports (Com & LPT). One of the drop down devices should be Prolific USB-to-Serial Comm Port (COM?) The ? is the Comm port.
To find the GPS com port number in Windows Vista, click on the Start icon, right-click on Computer, choose Properties, click on Device Manager, click on Ports (Com & LPT). One of the drop down devices should be Prolific USB-to-Serial Comm Port (COM?) The ? is the Comm port.
If it isn’t there, then you may need to reboot.
WARNING: The BU-353 is a SiRF chipset, there are several utilities that are designed to work with this chipset, such as SirfGPSTweaker and SiRFTech. I was playing around with these. One of them, put the BU-353 into a state where it stopped working even after a power cycle. I was able to recover it but if you surf the web on BU-353 users, several people were not able to recover.
From what I’ve read, there are two primary modes for SiRF GPSs, one is NMEA 0183 and one is SiRF format. I suspect what happened was the BU-353 was locked into SiRF format. Unless you are more knowledgeable then I am or braver, I would stay away from SiRF utilities.
TIP: NMEA 0183 defaults to 4800 baud. Most software defaults to 4800. I would suggest you leave everything at 4800 baud.
Displays satellite information, latitude, longitude and altitude plus it does some averaging. What I noticed most is how much my altitude varies. I don’t know if this is more because of my BU-353 or my location. This software gives you a visual and mathematical example of how much your GPS data varies from sample to sample. See picture.
Setup: Click on Connect to GPS. Click on Connect using Serial Port . Select the correct Com port number.
WARNING: It seems my version of VisualGPS locks up the Com port so that I couldn’t use other software without restarting my laptop.
Displays satellite information, latitude, longitude, altitude, direction and speed. This is more like an automobile GPS. Plus it includes a US map that plots your position and route. Also suppose to be able to drop in map images and calibrate them. I haven’t tried this yet. I don’t know how this compares with auto GPS maps. The North American map is about 84mBytes. It looks like it has a lot of editing features. See picture.
Setup: Click on GPS, select NMEA 0183, select Com port number.
The toolbar attaches to Adobe Reader and uses USGS topographic maps.
Not recommended. It is totally unusable on my old Pentium III laptop. The individual maps have to be downloaded and opened with Adobe Reader. The maps are topographical, not ideal for man-made roads, streets and cities. The interface is clumsy and not very user friendly. I guess one useful application would be hiking in the mountains but then you’re not likely to be carrying a laptop.
Step 2: Visual Studio Express
Since Microsoft released Windows with a graphical user interface, free programming languages have been harder to find. I guess there is Java and PHP but I grew up with C and Basic. One often overlooked resource is Microsoft Visual Studio Express. They actually have free programming platforms for Web, Windows, Phone and Database.
WARNING: This programming is not easy unless you are an experienced programmer or a genius! Not recommended for beginners or the undedicated.
There are three Windows versions, Visual Basic, Visual C# and Visual C++. They can all do basically the same thing as they are all based on the .NET framework.
HISTORY: Most of the early versions of Windows were written in Visual C++. C++ is also the basis of Arduino programming.
Visual Basic was altered drastically when it was converted to use .NET.
C# seems to be Microsoft’s updated C++.
Now I prefer Visual Basic as it is easier to read and the syntax (programming grammar) is simpler.
PROs: All of these programs are based on Microsoft Visual Studio. All have an Integrated Development Environment (IDE). This means it is easy to develop the graphical user interface, the Window and all the components of the Window, like textboxes, checkboxes, pictures, buttons. . . The IDE also contains a place for all of the supporting code. I forget what MS calls it (IntelliSense?) but when coding it will suggest possible choices. You can compile and run the code or it will give you reasons why it failed to compile. It is free and there’s lots of Internet support.
Cons: The software is bloated. It is pretty much unusable for program development on a Pentium III. (However, I do run VB Express programs on a Pentium III laptop) In my opinion, the Help files are mostly useless. I do better with a general internet search. The problems with Internet searching is first you have to decide if the response is relevant to your question and then you have to decide if they know what they’re talking about. And you have to format the search with the right terms. So I’ve spent a lot of time trying to solve programming problems.
Microsoft used to have some great videos on introductory programming, but I haven’t been able to locate them. There are a lot of other tutorials available though:
Step 3: My GPS Program
What I will cover are some of the problems and solutions in general terms.
Talk to GPS and sample GPS data.
Display latitude, longitude, altitude.
Calculate a running average of the above.
Stage 2: I wanted to see how accurate my GPS was. See next step.
Problem: Talk to GPS. The BU-353 is a USB device. It receives +5V on the USB connection. One of the nice features is that once it has power, it starts sending out NMEA 0183 serial data at 4800 baud automatically every second.
Solution: So VB Express already has a control called Serialport. Set it to 4800 baud, set it to the correct Com number and open it.
Problem: Sample GPS data. If you have a way to look at the serial data from the BU-353, one line would be something like this:
Here is how the NMEA 0183 defines this:
GGA - essential fix data which provide 3D location and accuracy data.
GGA Global Positioning System Fix Data
123519 Fix taken at 12:35:19 UTC(Coordinated Universal Time)
4807.038,N Latitude 48 deg 07.038' N
01131.000,E Longitude 11 deg 31.000' E
1 Fix quality: 0 = invalid
1 = GPS fix (SPS)
2 = DGPS fix (This means WAAS is enabled and working)
08 Number of satellites being tracked
0.9 Horizontal dilution of position(Something to do with accuracy)
545.4,M Altitude, Meters, above mean sea level
46.9,M Height of geoid (mean sea level) above WGS84 ellipsoid
(empty field) time in seconds since last DGPS update
(empty field) DGPS station ID number
*47 the checksum data, always begins with *
Tip: I just learned something about latitude and longitude. Latitude can only go from 0 to 90; longitude can go from 0 to 180. That is why the latitude value above has four digits before the decimal and the longitude has five. In the above example 11 degrees is written 011.
NMEA 0183 protocols are defined all over the Internet. Here’s one:
This protocol is not just for GPS so not all of the Sentences are relevant.
SubproblemA: The BU-353 is sending out several data strings every second. The computer program is receiving the serial data stream but doesn’t know where it ‘starts.’ (This is called asynchronous communications).
SolutionA: What the program has to do is continually look at the stream of data until it sees “$GPGGA”, then it knows the relevant data will follow.
SubproblemB: The $GPGGA data is one line of data. The computer needs to separate the data into the different parts.
SolutionB: In programming language, this is called parsing. The NMEA protocol has pretty strict rules on how the strings are defined. Every element is in a specified position and separated with a comma. So the program has to go through the data and extract what it wants and ignore the rest. For my purposes, I read down to Altitude and skipped the rest of the line.
FYI: The checksum is a means of verifying if the data string is corrupted or intact. In general, if you get corrupted data, it will usually be unreadable anyway. I just ignore checksums.
Problem: Display latitude, longitude, altitude. At this point, all of the data is in characters. It could simply be displayed in textboxes. But for my purposes, there are two problems. One is computers are dumb, they can’t average characters, they have to use numbers. I use a number of type ‘double’ which means it can include a decimal point, like 545.4. The second problem is that latitude and longitude are entered in the format of degrees and minutes in one number. 4807.038 is 48 deg 07.038' . Computers are dumb they can’t understand this.
Don't worry if the following doesn't make sense to you.
Solution: Most programming languages have a way to convert characters to a double. In VB express I used this:
dLat = Convert.ToDouble(lineArr(2))
Converting that latitude number is a little trickier, I did this
degrees = Int(dLat / 100) //This takes the first two digits and converts them to an integer (number without a decimal)
decimaldegrees = (dLat - (100 * degrees)) / 60.0 // This takes original number,
subtracts the degrees portion and
converts it to a decimal
fullLat = degrees + decimaldegrees //This combines the two
E.g. if dLat = 4807.038
degrees = Int(4807.038 / 100)
degrees = Int(48.07038)
degrees = 48
decimaldegrees = (dLat - (100 * degrees)) / 60.0
decimaldegrees = (4807.038 - (100 * 48)) / 60.0
decimaldegrees = (4807.038 - (4800)) / 60.0
decimaldegrees = (7.038) / 60.0
decimaldegrees = 0.1173
fullLat = degrees + decimaldegrees
fullLat = 48 + 0.1173
fullLat = 48.1173
So isn’t programming fun? NO! It’s not! The good news is once you get the program right, the computer will do all the calculations effortlessly. The bad news is if the program (algorithm) is wrong, it will do it wrong effortlessly. Since I’m not nearly perfect, I have to do a lot of troubleshooting.
Map Location: I copied this feature from another programmer (I wish I remembered where I found it). If you have an Internet connection and a good CPU, pressing this button will open up Google Maps and display your GPS location. This isn't very useful to me. If I'm using my Pentium III laptop in my car, it is too slow to display this and I usually don't have internet connection on the road anyway.
Problem: Calculate a running average of the above.
Solution: This is relatively easy, just keeping adding the values together and divide by the number of samples.
I have included two versions of my software.
To use the first, publish.zip, you need an internet connection. (I haven’t tested this) Save the zip file to your computer, run setup.exe. If this works the way it use to, it will download all the support files and install the program. You should be able to use this with any USB GPS that supports NMEA 0183 protocols.
The second version, Michaels GPS.zip contains all of the source code. I would suggest installing Microsoft Visual Basic Express 2010 first, then copying my files into the Project directory. Mine looks something like this:
\\MICHAEL-PC\Users\Michael\Documents\Visual Studio 2010\Projects\
The executable is under the project name, down a few directories . . . \bin\release. Theoretically, you can run the .exe file. The reason I suggested installing Microsoft Visual Basic Express 2010, is that it installs all the .NET stuff needed by the program. If that doesn’t work, you can also start of VB express and open the project and run it.
Setup: Enter the correct Comm port for your USB GPS. Click on Update. The data should start updating. If you get an error, Stop Updates and Update again.
Step 4: GPS a Building
So it is fairly easy to save GPS data for four locations. I called them NW, NE, SW, SE.
Problem: How to calculate distances and bearings (direction) between two latitude-longitude points. The problem is that latitudes and longitudes are not certain uniform distances apart. See picture.
Solution: The calculations are pretty intense. I found a great website for this:
For the math Geeks, jump into the website. For the rest, there are two formulas for calculating distances on a sphere. One is called the Haversine formula and the other is Spherical Law of Cosines. I tried both but most of the ‘experts’ suggest the Haversine is more accurate. Here is the function I borrowed from the website.
Public Function CalDistance(ByVal Lat1 As Double, ByVal Lon1 As Double,
ByVal Lat2 As Double, ByVal Lon2 As Double) As Double
Dim Radius As Double = 20902231.0 'Number of feet in radius of earth, based on 6371kM
Dim dLat As Double = Lat2 - Lat1
Dim dLong As Double = Lon2 - Lon1
Dim a As Double = Math.Sin(dLat / 2.0) * Math.Sin(dLat / 2.0) + _
Math.Cos(Lat1) * Math.Cos(Lat2) * Math.Sin(dLong / 2.0) * Math.Sin(dLong / 2.0)
Dim c As Double = 2.0 * Math.Atan2(Math.Sqrt(a), Math.Sqrt(1.0 - a))
CalDistance = Radius * c
To understand this requires an understanding of Basic programming, algebra and trigonometry.
TIP: Most programming languages require angles to be in radians not degrees.
To calculate bearing, I used this:
Public Function CalBearing(ByVal Lat1 As Double, ByVal Lon1 As Double, ByVal Lat2 As Double, ByVal Lon2 As Double) As Double
Dim BearingRad As Double
BearingRad = Math.Atan2((Math.Sin(Lon2 - Lon1) * Math.Cos(Lat2)), _
Math.Cos(Lat1) * Math.Sin(Lat2) - Math.Sin(Lat1) * _
Math.Cos(Lat2) * Math.Cos(Lon2 - Lon1))
'Radians = degrees * (PI / 180)
' degrees = 180 * radians/pi
CalBearing = 180.0 * BearingRad / Math.PI
'Normalize) 'CalBearing = (CalBearing + 360)%360
CalBearing = (CalBearing + 360.0) Mod 360.0
One of the nice things about that website is that it has a built in calculator. If you write a program like this, you should verify your algorithms by running some values in your program and plugging it into the website to make sure you get the same results.
Warning: I didn’t address situations where latitude goes from N to S or longitude goes from E to W. I’m not sure that the website does either.
My Intstructions: Go to one of the four corners, Start Updates, wait until the GPS gathers several samples (I like to get over a 100), then click on Save
Step 5: GPS Results and Conclusions
Google Earth Tape GPS
Distance Measured Distance
Top 27 30 31
Right 42 42 36
Bottom 30 30 22
Left 45 42 40
Observations: The tape measure is pretty accurate. I measured the house frame, not the roof.
Google Earth shows the roof with its overhang all around. The latitude-longitude readouts depend on where I place the cursor in relationship to the corner of the roof. The pointer is a little white hand so accuracy is undetermined.
The GPS was placed about a foot away from the corners of my house.
Conclusions: I would say the tape measure is the most accurate and Google Earth came in second. GPS was a little disappointing but well within specifications.
Problem: An added complication is that latitude and longitude are based on True north, not magnetic north like compasses. Apparently some of the GPSs with displays can adjust for this. Since my GPS doesn’t have a display, all calculations are based on True North. However the compass readings have to be adjusted to True North. The compensation factor is called magnetic deviation. Magnetic deviation actually varies with location on earth and time of year (I don’t know why).
Solution: Here is a calculator to find your magnetic deviation:
So if your deviation is Easterly like mine then you add the deviation from your compass reading to get True direction. The compass store has detailed information on this:
House Bearing in degrees:
Google Compass GPS
Top 259 260 242
Right 353 353 340
Bottom 266 260 245
Left 350 353 353
Observations: I am OLD, my compass reading skills are horrible. My eyes aren’t that great and my hands are a little shaky. I should’ve used a tripod or something steady and maybe reading glasses, but I’m LAZY so I didn’t.
Google Earth doesn’t show degrees between two points (as far as I know). I used the bearing formulas on the website in an Excel spreadsheet.
Conclusions: The compass and Google Earth were fairly close. I would say GPS is least accurate.
I decided to do one more experiment. My neighbor has a big square shop. See picture. I would repeat the test.
Neighbor Distance in feet:
Google Earth GPS
Top 89.1 77.2
Right 11.4 44.66
Bottom 84. 89.92
Left 5.2 45.36
Conclusion: It is apparent from the picture that the right and left Google Earth distances are totally incorrect, I think the top and bottoms are correct as verified by GPS. I suspect the problem is that Google Earth is using pictures and that the picture was not directly overhead but at an angle. I do not know how they attached latitude and longitude to the picture.
House Bearing in degrees:
Google Compass GPS
Top 267 269 277
Right 306 350 358
Bottom 264 269 275
Left 311 342 341
Conclusion: These are all pretty close, but again I would say the compass and GPS degrees are slightly closer.
Final Conclusions: This is definitely a very unscientific experiment. I was going to assume that Google Earth would out perform my GPS. In one case it did and one it didn’t. Like any experiment, you have to live with the results even though unexpected.
1. My program calculations are apparently working correctly
2. As expected the GPS performed better over greater distances
3. This GPS would not be very good for surveying short distances
4. Google Earth probably cannot be relied upon for accurate latitude-longitude measurments
5. I am lousy at reading a compass
My program applied. While I originally wrote the program to test out the GPS and my programming skills, a real application came up. Apparently the cost of my house insurance was going to increase. Apparently, they said there was no fire hydrant within 1000 feet of my house. Well, I happened to know there was a fire hydrant nearby but wasn’t sure if it was within 1000 feet. So I started up my program, drove over to the fire hydrant and took my first measurement. See picture. Then I took the second point straight up the road from the fire hydrant right at my driveway. The third point was in my house.
The fourth point, I entered some dummy data so that the Calculation button wouldn’t crash. Sure enough. The fire hydrant was about 900 feet from my house. Negotiations are in process. See pictures.