GPS Module interfacing with PIC18F4550 microcontroller

This post shows how to interface PIC18F4550 microcontroller with GPS module in order to receive data from satellites where the GPS module used in this project is u-blox NEO-6M (other modules also should work). With the NEO-6M GPS module we can measure position (latitude and longitude), altitude, time (UTC), date, speed and some other data. —  GPS: Global Positioning System  —

In this project I’ll send information of latitude, longitude, altitude, time (UTC), date, speed and course serially (using serial port) to the laptop (PC). Data are sent to the laptop after receiving it from the GPS module. The laptop displays all data with serial monitor software such as Windows hyper terminal, Arduino serial monitor, CCS C IDE (C-Aware IDE) serial monitor …

The NEO-6M GPS module which I’m using is similar to the one shown below:

NEO-6M GPS module

Generally the NEO-6M GPS module has 4 pins: VCC (3.3V or 5V), RX, TX and GND. It uses serial communication (UART protocol) to communicate with the microcontroller where RX/TX pins are for receiving/transmitting data from/to the microcontroller.

GPS Library for CCS C compiler:
To simplify this project I wrote a small library for GPS modules, this library decodes (parses) GPS NMEA sentences (the GPS module serially sends NMEA sentences to the MCU, these sentences contain all data we need, but they need to be decoded). This library extracts all data from 2 sentences: RMC ($GPRMC) and GGA ($GPGGA).  —  NMEA: National Marine Electronics Association  —

The GPS library decodes the RMC sentence which gives latitude, longitude, time, date, speed and course. It also decodes the GGA sentence in order to get altitude and number of satellites used by the module.
$GPRMC: Recommended minimum specific GPS/Transit data
$GPGGA: Global Positioning System Fix Data

GPS Library for CCS C compiler can be downloaded from the link below, its full name is “GPS_Lib.c“:
GPS Library download

after the download, add the library file (GPS_Lib.c) to project folder or CCS C compiler drivers folder.

Hardware Required:

  • PIC18F4550 microcontroller
  • NEO-6M GPS module
  • USB to serial converter (such as FT232RL)
  • 5V source
  • Breadboard
  • Jumper wires

NEO-6M GPS module interfacing with PIC18F4550 MCU circuit:
The following image shows the circuit diagram of the project.

NEO-6M GPS with PIC18F4550 microcontroller and FT232RL USB to serial

(All grounded terminal are connected together)

The NEO-6M GPS module board has 4 pins connected as follows:
GND (Ground) pin connected to circuit GND
TX pin goes to PIC18F4550 RX (RC7) pin (pin #26)
RX pin is not connected (there is no need to send data from the microcontroller to the GPS module)
VCC pin goes to circuit +5V pin.

To be able to send data from the microcontroller to the laptop we need a USB-to-Serial converter module. In this project I used the FT232RL module (the main component is FT232RL chip from FTDI), other modules can be used including the Arduino boards.
The GND pin of the USB-to-Serial converter is connected to circuit ground and RX pin is connected to PIC18F4550 TX (RC6) pin (pin #25).

In this project the PIC18F4550 microcontroller runs with its internal oscillator @ 8 MHz, MCLR pin is configured as an input pin.

NEO-6M GPS module interfacing with PIC18F4550 MCU C code:
The C code below is for CCS C compiler, it was tested with version 5.051.

With the code below we can get the following data from the NEO-6M GPS module:
latitude, longitude, altitude, time (UTC), date , speed, course and number of satellites in use. The image below shows a similar result (I used Arduino IDE serial monitor):

NEO-6M GPS module output decoded NMEA

CCS C Code:

Finally, we can simulate this project with Proteus software, the simulation result should be as shown in the following video where PIC16F877A microcontroller is used:


Discover more from Simple Circuit

Subscribe to get the latest posts sent to your email.

6 thoughts on “GPS Module interfacing with PIC18F4550 microcontroller”

    1. Yes you can print GPS data on LCD instead of serial monitor which requires the FT232RL module, but you need to make some modifications to the C code.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top