It would be hard to rank the greatest technology hits of the past 50 years but I bet that the internet and microprocessors would be close to the top on most lists. Something that makes my personal top-10 would be GPS, but then I’m biased because I helped develop and integrate military GPS receivers for more than 20 years. Back in the early days there were only a couple of satellites operational so sometimes we would have to hit the lab at odd hours to catch their signals. Fortunately we also had a sophisticated satellite simulator to help with development and testing. I’d tell you more but you know how the old saying goes.
Like everything else in electronics, commercial GPS receivers have increased in performance and decreased in cost. I have a lot of GPS units, including Bluetooth connected versions but recently I bought one of the units commonly used for quad-copters and paid less than $10 for it. It’s the Ublox NEO-6M and in this project I’ll show you how to derive and display the basic information using a PIC.
As mentioned above, you can easily connect the NEO-6M to the PIC because it uses a TTL-level serial port and outputs standard NMEA-0183 sentences. That also means that pretty much any GPS unit that has a TTL serial port and uses the NMEA standard can be used. I originally wrote the software to work with one of my Globalsat GPS units and then tweaked it to also work with the Ublox unit. The only real difference is that the NMEA standard specifies a serial baud rate of 4800, which the Globalsat uses, but the Ublox unit defaults to 9600 baud. You can run a utility program to change the Ublox baud rate but I just left it as factory default and added a jumper input to the PIC to select between 4800 and 9600 baud. There is also a utility program called GPSInfo (put out by Globalsat) that is very handy for viewing GPS information. Copies of both utility programs are included below. You can hook up the GPS unit to a standard USB to TTL cable for checking it out or setting it up using a PC.
The hardware connections are shown in the diagram above. The connection to the GPS is simply from the GPS transmit output to the PIC serial port receive input. The jumper shown on PIC pin 4 is for selecting the baud rate. If pin 4 is connected to ground then the baud rate will be 4800. If left open (with the pull up resistor) the baud rate will be 9600. The LCD connection is the standard 4-bit setup that has been used in a number of previous projects but the LCD itself is different. Usually we have used the standard 1602 LCD (16 characters by 2 lines) but this project required more display real estate. The display I used is the 4 line version (1604). I also have a 20 character by 4 line LCD and the software is written so that you can uncomment one line and it will work with that LCD instead. The only real difference between the 1604 and the 2004 is that lines 3 and 4 have different starting addresses. All of the data has been formatted in the software to fit in 16 characters on each line so the 2004 will just have a few extra blank spaces.
As mentioned earlier, the GPS units output standard NMEA-0183 sentences. Basically, they are ASCII strings that contain a variety of information. The software here decodes just the GGA sentence which contains time, latitude, longitude, altitude, and HDOP. HDOP is Horizontal Dilution of Precision which provides a basic indicator of how good the position information is. The smaller the DOP number the better the accuracy. There are some other DOP values in other sentences but that would require extra decoding for not a lot of extra value in hobby applications.
Fields of information in NMEA sentences are separated by commas so, after the GGA sentence header is detected, the software counts commas and calls the appropriate routine for each desired field of information. The GGA sentence also includes a measurement validity flag and the software waits until the first valid message before it displays data. With the NEO-6M GPS the GGA message will continue to output time data even if the position data goes invalid again. The rest of the display will be blank. Other GPS units may handle invalid messages differently. That’s it for this post. Check out my other electronics projects.