How to Interface GPS to 8051 Microcontroller?

A GPS (Global Positioning System) module is a device that has become an efficient tool in the field of surveillance, tracking and scientific use. The GPS module is based on satellite navigation technology that provides the information of time and location in all weather conditions anywhere on the earth. The main purpose of the GPS system is to find out the location of a person or vehicle. A GPS receiver affords an exact location of an object in terms of longitude and latitude and also provides timing services, positioning and reliable navigation to the users at anywhere and anytime on the earth.

GPS Interfacing with 8051 Microcontroller
GPS Interfacing with 8051 Microcontroller

The GPS system mainly uses 24-32 satellites to provide the data to the users. This system has become very important for worldwide navigation and it is useful for tracking, surveillance, way and map marking, and much more.

But before going to know this GPS system, let us gain an idea about how GPS interfacing with the 8051 microcontroller which is a small application based on GPS, can be done. It describes the use of GPS module or receiver to find longitude and latitude of its location.The data achieved from the GPS receiver is processed by the 8051 microcontroller to take out its values in the form of longitude and latitude. The GPS interfacing with 8051 microcontroller and the location values are shown on an LCD display.

GPS Interfacing with 8051 Microcontroller:

The block diagram of GPS interfacing with 8051 microcontroller is shown below. It consists of GPS modules, MAX 232, 8051 microcontroller, and an LCD display.

Block Diagram of GPS Interfacing with 8051 Microcontroller
Block Diagram of GPS Interfacing with 8051 Microcontroller

The MAX232 is an integrated circuit which is used to convert the transistor logic levels (TTL) to RS232 logic levels through serial communication of ATmels microcontrollers with a PC. The controller operates at TTL logic level 0-5V . But, the serial communication USART with PC works on RS232 standards (-2.5V to +2.5V). This makes it difficult to find a direct link to communicate with each other.

The AT89C51 microcontroller is an 8-bit microcontroller that belongs to Atmel 8051 family. It has 4KB of flash PEROM (programmable and erasable read only memory & 128 bytes of RAM. It can be programmed and erased too many times.


A 16×2 LCD display is an electronic display, which is very commonly used in many devices and circuits. These displays are preferred over 7-segment displays.

The GPS module working principle is,it always transmits serial data in the form of sentences. The longitude and latitude values of the location are contained in the sentence. To communicate over USART or UART you just need three basic signals: TXD, RXD and GND – So that you can interface UART with 8051 microcontroller.

The main intention here is to find the exact location of the GPS receiver in terms of longitude and latitude. The GPS module gives the output data in RS232 logic level format. To convert RS232 format into TTL format, a line- converter MAX232 is used. It is connected between GPS module and AT89C51 microcontroller. The GPS interfacing with 8051 connection block diagram is shown in the above diagram. The values of the location has been displayed on an LCD which is interfaced to the microcontroller.

GPS Interfacing with Microcontroller Circuit Diagram:

Circuit Components are AT89C51 microcontroller, GPS module, MAX 232 IC, LCD display, programming board, 12V DC battery or adapter, 12MHz Crystal. Resistors, Capacitors.

The circuit connections of GPS interface with microcontroller are as follows:

GPS Interfacing with Microcontroller Circuit Diagram
GPS Interfacing with Microcontroller Circuit Diagram

The MAX232 is for the serial communication. The receiver pin3 of the GPS module is connected to pin13 R1IN and the output pin of MAX 232 is connected to the RxD pin10 of the microcontroller. Pins 1,2 and 3 of microcontroller AT89C51 are connected to the control pins (RS, R/W and EN) of LCD display. The data pins of the LCD display are connected to port p2 of the controller. The values of longitude and latitude values are displayed on the LCD.

In the above interfacing GPS with microcontroller circuit, the GPS receiver always transmits the data according to NMEA formats using protocol RS232. In this NMEA format, the longitude and latitude values of exact location are available in GPRMC sentence. These values are extracted from NMEA standards and displayed on LCD.

By using the UART protocol, the controller receives the data from the GPS module, and then it extracts the values of longitude and latitude from the received messages finally displays them on the LCD.

Extraction of Latitude and Longitude Values from NMEA Format:

The first received six characters from the GPS module are compared with the GPRMC string.If the string is matched, then you need to wait till you will get two commas; next, the character specifies whether the GPS module is activated or not. If the next character is ‘A’, then the GPS is activated, otherwise it is not activated.Again, you have to wait until you get a comma. The next 9 characters specify the LATITUDE. Once again, wait until you get two commas- the next 10 characters specify the LONGITUDE.

If you want to check the LATITUDE and LONGITUDE values of the exact location without any coding, use TRIMBLE STUDIO software. When you interface a GPS module, then this software directly gives longitude, latitude, speed, time, altitude and time. It provides the exact location in google maps. This information is gathered in a particular string format which is decoded by the GPS modem. The GPS modem gives the output data in a string format called as NMEA and a common GPS sentence is explained below.

$GPGGA,080146.00,2342.9185,N,07452.7442,E,1,06,1.0,440.6M,-41.5, M,, 0000*57

  • A string always starts with a sign ‘$’
  • GPGGA: Global Positioning System Fix Data
  • Comma (,) specifies the separation between two values
  • 080146.00: GMT time as 08 hours: 01 minute: 46 Seconds: 00 m seconds
  • 2342.9185, N: Latitude 23 degrees: 42 minutes: 9185 seconds North
  • 07452.7442, E: Longitude 074 degrees: 52 minutes: 7442 seconds East
  • 1: Fix Quantity 0= invalid data, 1= valid data, 2= DGPS fix
  • 06: Number of satellites currently viewed
  • 1.0: HDOP
  • 440.6, M: Altitude (Height above sea level in meter)
  • -41.5, M: Geoids height
  • ¬_, DGPS data
  • 0000: DGPS Data
  • *57: Checksum

Applications of Interfacing GPS with 8051 Microcontroller

GPS technology is now in everything ranging from wrist watches, cell phones to shipping containers, ATM(Automatic Teller Machines) and bulldozers. GPS increases productivity across a wide swath of the economy, to include construction, farming, mining, package delivery, surveying, banking systems and financial markets etc. Some wireless communication services cannot operate without GPS technology.

Applications of Interfacing GPS with 8051 Microcontroller
Applications of Interfacing GPS with 8051 Microcontroller

This system is used in fleet management, car navigation and marine navigation.

  • It is used for mapping and tracking the devices.
  • It is used in personal positioning and in many embedded system based projects to find out the exact location of the vehicle or person.
  • By using GPS, the accurate time calculation with respect to GMT can also be done.
  • Mining of Longitude and Latitude values from the NMEA format.

Thus, this is all about GPS interfacing with 8051 microcontroller, it is the technology which can be used in many electronic engineering projects to find out the exact location of a vehicle using a method GPS and other navigational systems that operate through satellites and ground based stations. The vehicle information can be viewed on a digital map by using a software. Even data can be stored & downloaded to a computer from the GPS unit at a base station, and later it can be used for analysis.

Comments are closed.