Home

PICmicro

Projects

Web Design

Forums

Links

Contact

 

 

GPS Display

 

Global Positioning System (GPS) modules have been available inexpensively for some time and easily interfaced to PIC microcontrollers. The GPS system is a 24 satellite system orbiting the earth and strategically placed enabling you to know where you are. The data transmitted from a GPS satellite consists of two sets of data, an ‘Ephemeris’ data relating to the transmitting satellite and an ‘Almanac’ data relating to the whole GPS system. The GPS receiver uses the ‘Almanac’ to determine which satellite should be visible in the sky. The most accurate ‘Ephemeris’ signals from these satellites are used for calculating position. The GPS modules data output is usually in RS232 serial format, 8 data bits, no parity bits and one stop bit, accessed via a built in connector. The universal standard protocol output (NMEA 0813) for use with external devices is specified by the ‘National Marine Electronics Association’ NMEA 0813 defines the electrical signal requirement, data transmission protocol and specific sentence format for 4800 Baud serial data bus. NMEA 0813 data comprises a series of ASCII sentences. The most common sentences are prefixed by an identity code $GP followed by a three letter infix indicating the information type that the sentence represents  ie $GPRMC, $GPGGA ...... The $GPRMC sentence (RMC=Recommended Minimum Content) consists of 13 fields of data, 12 of which are separated by commas. The sentence is output in ASCII format, with the exception of the checksum in the final field which does not need decoding. The fields within the sentence do not necessarily have fixed lengths. The time and date values are probably always formatted to a fixed length, there is evidence to suggest that values following decimal points in the latitude and longitude at times may have different quantities of decimal places. Consequently, when splitting a GPS sentence into its fields it is essential to use the commas as the separating symbol for all fields except the checksum. 

The $GPRMC ASCII Data Fields :

Field 1 - UTS Time HHMMSS format, 00000.00 ~ 2359.99
Field 2 - Status, ‘V’ = Navigation receiver warning, ‘A’ = Valid position
Field 3 - Latitude in DDMM.MMMM format
Field 4 - Latitude Hemisphere indicator, ‘N’ = North. ‘S’ = South
Field 5 - Longitude in DDDMM.MMMM format
Field 6 - Longitude Hemisphere indicator, ‘E’ = East, ‘W’ = West
Field 7 - Speed over ground, 000.0 ~ 999.9 Knots
Field 8 - Course over ground, 000.0 ~ 359.9 Degrees
Field 9 - UTC date of position fix, DDMMYY format
Field 10 - Magnetic variation, 000.0 ~ 180.0 Degrees
Field 11 - Magnetic variation direction. ‘E’ = East, ‘W’ = West
Field 12 - Mode indictor
Field 13 - Checksum


You may need to send configuration commands to the GPS module if you want to select certain lesser-used data sentences. Some GPS modules also have a separate 1pps pulse output exact timing. 

 

 Interfacing the GPS module to a PIC


Many GPS modules can be powered with as low a supply as 3.6v, handy in situations when minimizing power is a primary requirement. Some have built in antennas others need an external antenna, usually an active (powered) type. You are unlikely to get valid signals indoors, the antenna needs a clear view of the sky. When powering up a GPS module for the first time you need to leave it in direct line of sight of the sky for at least 40 minutes. This allows the GPS module to download the GPS data Almanac from a satellite, until this has happened you will not be able to get a fix.  Although direct coupling of the GPS module serial data lines to the PIC is likely to be effective, greater sophistication and potentially greater reliability of data transfer can be provided if an RS232 interface chip is inserted between the data source and its destination.

Navigation calculations require the Longitude and Latitude values expressed as degrees. If the North/South indicator is S (South) or the East/West indicator is W (West) the displayed value is negated.

Convert values as follows:

Latitude = DD + (MM.MMMM/60)
Longitude = DDD + (MM.MMMM/60)

 

Main Hardware :  Microchip PIC16F876 28 pin microcontroller - RF Solutions 41MLR GPS module - 4x20 LCD

 

Software :  Assembly Code - Programmed with the Microchip PICKit2 programme        

>> Source Code