Display GPS Co-ordinates on LCD using pic microcontroller

GPS Co-ordinates on LCD: Global Positioning System. This project is about displaying GPS co-ordinates on LCD using pic microcontroller. I have already posted a project on GPS based clock using pic microcontroller. GPS is network of satellites used to send and receive accurate details about the position of anybody in the form of longitude and latitude. This process of sending and receiving positional data is done by some means of GPS modules or receiver. In our case Holux M-89 GPS module.GPS coordinates are most contains latitude and longitude. This system divides the earth into latitude lines, which indicate how far north or south of the equator a location is, and longitude lines, which indicate how far east or west of the prime meridian a location is. GPS module interfacing is done with pic microcontroller.GPS coordinates on LCD using pic16f877a

For example the coordinates of New York Time square are 40.7589° N, 73.9851° W. The first number is used to represent latitude and second one is used to represent longitude.In this tutorial you will learn how a GPS module receives coordinates in the form of latitude and longitude from a satellite. First of all a GPS receiver   locate any three or more of satellites, calculate the distanc­e to each, and use this information to generate its own location. This operation is based on a simple mathematical principle called Trilateration.

The satellite which we used in our project is $GPGGA   has a specified purpose which is Global Positioning System Fix Data.

Some information about $GPGGA

Sentence Identifier $GPGGA Global Positioning System Fix Data
Time 170834 17:08:34 Z
Latitude 4124.8963, N 41d 24.8963′ N or 41d 24′ 54″ N
Longitude 08151.6838, W 81d 51.6838′ W or 81d 51′ 41″ W
Number of Satellites 05 5 Satellites are in view
Horizontal Dilution of Precision (HDOP) 1.5 Relative accuracy of horizontal position
Altitude 280.2, M 280.2 meters above mean sea level
Height of geoid above WGS84 ellipsoid -34.0, M -34.0 meters

Required Components:

  • PIC 16F877a: If you are an electronic hobbyist then you are familiar with microcontrollers. This MCU is easy-to-program. It is 8-bit microcontroller architecture into an 40 pins package. The PIC16F887 contains 256 bytes of EEPROM data memory, 2 Comparators, 14 channels of 10-bit Analog-to-Digital converter and much more in single chip.
  • Holux M-89 GPS module: This module is small in size, consume less power and highly efficient and user friendly. It is easy to use in ant project.
  • LCD Module: It is used to display the alpha-numeric characters. In our project it is used to display longitude and latitude.
  • Miscellaneous: Breadboard, Pickit and some jumper wires.

Use of GPS

Now a day’s GPS is use is very common. Normally it is used in follow fields:

  1. Location – such as location of a car or a aircraft.
  2. Navigation – from one location to another.
  3. Tracking – monitoring anything it may be person used by militaries.
  4. Mapping – provides maps of the world.
  5. Timing – give precise timing anywhere in the world.
  6. Security– such as monitoring a car and sending its data to server and feedback to the owner.

How it works to  navigate a car

  1. GPS receivers receive signals from satellites and detect the vehicle’s location.
  2. Direction sensor is used to detect the vehicle’s direction.
  3. Send data to server
  4. Server creates Map database.
  5. Map database is display using the car navigation system’s control circuitry.

Circuit diagram of GPS co-ordinates on LCD

circuit diagram for GPS co-ordinates on LCD is shown below:

GPS based clock using pic microcontroller

Code

// LCD module connections
sbit LCD_RS at RB4_bit;
sbit LCD_EN at RB5_bit;
sbit LCD_D4 at RB0_bit;
sbit LCD_D5 at RB1_bit;
sbit LCD_D6 at RB2_bit;
sbit LCD_D7 at RB3_bit;

sbit LCD_RS_Direction at TRISB4_bit;
sbit LCD_EN_Direction at TRISB5_bit;
sbit LCD_D4_Direction at TRISB0_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D7_Direction at TRISB3_bit;
// End LCD module connections
void GPS_GetDataAndDisplayIt(void)
{
char Temp = 0, Index = 0;
while(!UART1_Data_Ready());
Temp = UART1_Read();
if (Temp == '$')
{
while(!UART1_Data_Ready());
Temp = UART1_Read();
if (Temp == 'G')
{ while(!UART1_Data_Ready());
Temp = UART1_Read();
if (Temp == 'P')
{
while(!UART1_Data_Ready());
Temp = UART1_Read();
if (Temp == 'G')
{
while(!UART1_Data_Ready());
Temp = UART1_Read();
if (Temp == 'G')
{
while(!UART1_Data_Ready());
Temp = UART1_Read();
if (Temp == 'A')
{
while(!UART1_Data_Ready());
Temp = UART1_Read(); // skiping ','
while(!UART1_Data_Ready());
Temp = UART1_Read();
Lcd_Cmd (_LCD_THIRD_ROW);
Lcd_Out_Cp("UTC: "); // displaying UTC on LCD
while (Temp != ',')
{
Lcd_Chr_Cp(Temp); // Displaying Time on LCD
while(!UART1_Data_Ready());
Temp = UART1_Read();
Index ++;
if (Index == 2 || Index == 4)
Lcd_Chr_Cp(':');
}
Index = 0;
Lcd_Cmd (_LCD_FIRST_ROW);
Lcd_Out_Cp("LAT: "); // displaying Latitude data
while(!UART1_Data_Ready());
Temp = UART1_Read();
while (Temp != ',')
{
Lcd_Chr_Cp(Temp); // Displaying latitude on LCD
while(!UART1_Data_Ready());
Temp = UART1_Read();
Index ++;
if (Index == 2)
Lcd_Chr_Cp(223); // Displaying degree sign
}
Index = 0;
while(!UART1_Data_Ready());
Temp = UART1_Read();
Lcd_Chr_Cp(' ');
Lcd_Chr_Cp(Temp); // Displaying Direction on LCD
Lcd_Cmd (_LCD_SECOND_ROW);
Lcd_Out_Cp("LNG: "); // displaying Longitude
while(!UART1_Data_Ready());
Temp =UART1_Read();
while(!UART1_Data_Ready());
Temp = UART1_Read();
while (Temp != ',')
{
Lcd_Chr_Cp(Temp); // Displaying longi on LCD
while(!UART1_Data_Ready());
Temp = UART1_Read();
Index ++;
if (Index == 3)
Lcd_Chr_Cp(223); // Displaying degree sign
}
while(!UART1_Data_Ready());
Temp = UART1_Read();
Lcd_Chr_Cp(' ');
Lcd_Chr_Cp(Temp); // Displaying Direction on LCD

Lcd_Cmd (_LCD_FOURTH_ROW);
while(!UART1_Data_Ready());
Temp = UART1_Read(); // Skiping ','
Lcd_Out_Cp("Fix: "); // displaying Longitude
while(!UART1_Data_Ready());
Temp = UART1_Read();
Lcd_Chr_Cp(Temp); // Displaying fix value on LCD
while(!UART1_Data_Ready());
Temp = UART1_Read(); // Skiping ','
Lcd_Out_Cp(" No.SAT: "); // displaying Longitude
while(!UART1_Data_Ready());
Temp = UART1_Read();
while(Temp != ',')
{
Lcd_Chr_Cp(Temp); // Displaying No. of SATS
while(!UART1_Data_Ready());
Temp = UART1_Read();
}
Lcd_Chr_Cp(' ');
}

}

}

}

}
}

}
void main() 
{
Lcd_Init(); // Initialize LCD
UART1_Init(4800); // Initialize UART module at 9600 bps
TRISB=0X00;
ANSELH=0X00;
Delay_ms(100); // Wait for UART module to stabilize
Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off
Lcd_Cmd (_LCD_FIRST_ROW);
Lcd_Out_Cp("GPS MODUE");
Lcd_Cmd (_LCD_SECOND_ROW);
Lcd_Out_Cp("DATA LOGGER");
Lcd_Cmd (_LCD_THIRD_ROW);
Lcd_Out_Cp("SD CARD");
Lcd_Cmd (_LCD_FOURTH_ROW);
Lcd_Out_Cp("BY BILAL");
Delay_ms(2000);
Lcd_Cmd(_LCD_CLEAR); // Clear display
while(1) {
GPS_GetDataAndDisplayIt();
}

}

working video demonstration

4 thoughts on “Display GPS Co-ordinates on LCD using pic microcontroller”

  1. Sir, I am frequent reader of yours articles , In Pakistan this is the best place to learn arduino . Please continue , god bless U.
    I am Marine electronics engineer , working at ship up to mast (Radar) to Bottom of Ship (Depth indicators) since last 50 years, I am witness to change in electronics from Valve to IC & now Arduino…..

    Reply

Leave a Comment