fbpx

Interface GPS With 8051

GPS is space based satellite navigation system.

  • It provide location,date and time.
  • This navigation system made up of a network of a 24 satellite placed into orbit.
  • GPS navigation device provide data in all weather conditions.
  • GPS satellite placed in orbit from a distance of 20,000 km above the earth.
  • A satellite makes complete two revolution ever day.
  • Each GPS receiver get the information from four satellite.
  • GPS receiver is used to calculate the location from the information obtained from four satellite.
  • Calculations based on mathematical principle called trilateration.

Calculating Location:

  • EXAMPLE
    To know the exact location.
    There is four person
    Person 1= unknown location, (GPS Receiver)
    Person 2=Chennai, (Satellite 1)
    Person 3=Bangalore (Satellite 2)
    Person 4= Coimbatore (Satellite 3)

Person1 ask person2 where am I,he says you are 139km from Chennai.

Person1 ask person3 where am I,he says you are 215 km from Bangalore.

Person1 ask person4 where am I,he says you are 391 km from coimbatore.

GPS Received Data In NMEA Format

  • $GPBOD = Bearing, origin to destination.
  • $GPBWC = Bearing and distance to waypoint, great circle.
  • $GPGGA = Global Positioning System Fix Data.
  • $GPGLL = Geographic position, latitude / longitude.
  • $GPGSA = GPS DOP and active satellites.
  • $GPGSV = GPS Satellites in view.
  • $GPHDT = Heading, True.
  • $GPR00 = List of waypoints in currently active route.
  • $GPRMA = Recommended minimum specific Loran-C data.
  • $GPRMB = Recommended minimum navigation info.
  • $GPRMC = Recommended minimum specific GPS/Transit data.
  • $GPRTE = Routes.
  • $GPTRF = Transit Fix Data.
  • $GPSTN = Multiple Data ID.
  • $GPVBW = Dual Ground / Water Speed.
  • $GPVTG = Track made good and ground speed.
  • $GPWPL = Waypoint location.
  • $GPXTE = Cross-track error, Measured.
  • $GPZDA = Date and Time.
GPS RAW Received Data

Hardware Required

  • Gps Module.
  • 8051 MicroController.

Gps PinOut

  • Vin= +5V.
  • Tx= Rx of Microcontroller.
  • Rx= Tx of Microcontroller.
  • Gnd= Ground.

Circuit

Virtual Circuit

Code

#include<REGX51.H>
sfr lcd = 0x80;
int z;
unsigned char
latitude[12],longitude[12];
void delay()
{
int
i,j;
for(i=0;i<1000;i++)
{
for(j=0;j<100;j++);
}
}
void cmd(unsigned char z)
{
P3_0=0;
P3_1=1;
P2=z;
delay();
P3_1=0;
}

void dat1(unsigned char z)
{
P3_0=1;
P3_1=1;
P2=z;
delay();
P3_1=0;
}

void dat(unsigned char *z)
{
unsigned char
i=0;
for(i=0;z[i]!='\0';i++)
{
P3_0=1;
P3_1=1;
P2=z;
delay();
P3_1=0;
}
}
void uart_int()
{
TMOD=0X20;
TH1=0XFD;
TR1=1;
SCON=0X50;
}

unsigned char receive()
{
unsigned char b;
while(!RI);
b=SBUF;
RI=0;
return(b);
}

void gps()
{
unsigned char a=0,latlong[36],i=0,j=0;
cmd(0x80);
cmd(0x01);
a=receive();
if(a=='G')
{
a=receive();
if(a=='P')
{
a=receive();
if(a=='G')
{
a=receive();
if(a=='G')
{
a=receive();
if(a=='A')
{
a=receive();
if(a==',')
{
for(i=0;i<36;i++)
{
latlong[i]=receive();
}
}
}
}
}
}
}
cmd(0x01);
cmd(0x80);
dat("latitude");
cmd(0xc0);
for(i=11,j=0;i<22;j++,i++)
{
latitude[j]=latlong[i];
dat1(latlong[i]);
}
latitude[j]='\0';
delay();
cmd(0x01);
cmd(0x80);
dat("longitude");
cmd(0xc0);
for(i=23,j=0;i<35;i++,j++)
{
longitude[j]=latlong[i];
dat1(latlong[i]);
}
longitude[j]='\0';
delay();
}

void main()
{
uart_int();
cmd(0x01); // clear lcd
cmd(0x38); // select 2 lines
cmd(0x0C); // display ON cursor OFF
cmd(0x80); //pointing line 1 pos1
while(1)
{
gps();
}
}

Leave a Reply

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