Arduino Projects    |   Raspberry Pi  |     Electronic Circuits   |   Electronics Reference Design Library  |   AVR    |    PIC    |    8051    |    Electronic Projects

How to interface GPS with PIC18F4550 Microcontroller


Developed By: 
Amit Joshi
Global Positioning System is based on satellite navigation technology. A GPS Receiver provides the accurate location of an object in terms of latitude and longitude. Accurate time calculation with respect to GMT can also be done by using GPS. For more information on different data obtained through GPS, refer GPS Receivers. Here a PIC microcontroller has been interfaced with a GPS module to extract its position information (location).



GPS provides a lot of geographical information for a particular object like its latitude, longitude, direction of travel, GMT etc. This information are assembled in a particular string format which are to be decoded by GPS modems. A GPS modem gives the output data in a following string format called as NMEA Format. A common GPS sentence ($GPGGA) has been explained below.




1.               A string always starts with a ‘$’ sign
2.               GPGGA : Global Positioning System Fix Data
3.                ‘,’ Comma indicates the separation between two values
4.               100156.000 : GMT time as 10(hr):01(min):56(sec):000(ms)
5.               2650.9416,N: Latitude 26(degree) 50(minutes) 9416(sec) North
6.               07547.8441,E: Longitude 075(degree) 47(minutes) 8441(sec) East
7.               1 : Fix Quantity 0= invalid data, 1= valid data, 2=DGPS fix
8.               08 :  Number of satellites currently viewed.
9.               1.0: HDOP
10.           442.8,M : Altitude (Height above sea level in meter)
11.            -42.5,M :         Geoids height
12.           __ , DGPS data
13.           0000 : DGPS data
14.           *71 : checksum
The main objective here is to find the location of the GPS Receiver in terms of latitude and longitude. The GPS module gives output data in RS232 logic level format. To convert the RS232 logic level into TTL, a line converter MAX232 has been connected between GPS module and PIC18F4550. (Also refer PIC USART) The circuit connection of GPS module with microcontroller is shown in the circuit diagram tab. The latitude and longitude data has been displayed on a 16x2 LCD interfaced to PIC.


Programming steps:


1. Set the baud rate of PIC’s USART to 4800 bps.
2. Enable the SPEN and CREN bits (RCSTA register).
3. Receive the Serial data and compare with the string ‘$GPGGA,’ byte by byte.
4. Wait for comma (,) as string gets matched.
5. Store the data which appears after the above comma into a string which will be the Latitude.
6. After another comma (,), store the data into another string which will be the Longitude.
7. Display both Latitude and Longitude data on LCD.
8. Repeat the steps 3 to 7 to update the GPS module’s positions on LCD.


Circuit Diagram



This Code is only visible to Registered users. Please Login/Register



MAX232 | IC MAX232
The MAX232 IC is used to convert the TTL/CMOS logic levels to RS232 logic levels during serial communication of microcontrollers with PC. The controller operates at TTL logic level (0-5V) whereas the serial communication in PC works...
16 x 2 LCD | 16x2 Character LCD Module


LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of applications. A 16x2 LCD display is very basic module and is very commonly used in various devices and circuits. These modules are preferred over seven segments...

PIC18F4550 Microcontroller Image

PIC18F4550 is an 8-bit microcontroller of PIC18 family. PIC18F family is based on 16-bit instruction set architecture. PIC18F4550 consists of 32 KB flash memory, 2 KB SRAM...

Browse 4m+ Electronic Products

Pick the right product for your next design project with "Mouser Store". Mouser Electronics brings broadest range of semiconductors and electronic components from over 500 industry leading suppliers. 
Mouser specializes in the rapid introduction of new products and technologies for design engineers and buyers that includes semiconductors, interconnects, passives, and electro-mechanical components. Providing the best possible service with the flexibility of not requiring a minimum order and same-day shipping, Mouser has it all.
When you need the right part right now, think of Mouser
Thank you
Team EG


You are here