fbpx

Interface GPS With ARM7

Description

GPS is a space-based satellite navigation system. It provides location, date and time. This navigation system made up of a network with 24 satellites placed into orbit.

  • GPS navigation device provides 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 revolutions every day.
  • Each GPS receiver gets the information from four satellites.
  • GPS receiver is used to calculate the location from the information obtained from four satellites.
  • Calculations based on the 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.

Hardware Required

  • GPS Module.
  • LPC21XX MicroController.

GPS Pinout

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

Circuit

Code

 #include <LPC21xx.H>
 int r;
 unsigned char uart_receive()
 {
 while(!(U0LSR & (0X01)));
 r=U0RBR;
 return r;
 }
 
 void delay(unsigned int count)
 {
 int i,j;
 for(i=0;i<count;i++)
 for(j=0;j<i;j++);
 }
 
 void uart()
 {
 VPBDIV=0X02;
 PINSEL0=0X00000005;
 U0LCR=0X83;
 U0DLL=0XC3;
 U0DLM=0X00;
 U0LCR=0X03;
 }
 
 void cmd(unsigned char X)
 {
 IO1PIN=0X00020000;
 IO0PIN=X;
 delay(2000);
 IO1PIN=0X00000000;
 }
 
 void dat1(unsigned char *y)
 {
 unsigned char k;
 for(k=0;y[k]!='\0';k++)
 {
 IO1PIN=0X00030000;
 IO0PIN=y[k];
 delay(2000);
 IO1PIN=0X00010000;
 }
 }
 
 void dat(unsigned char Y)
 {
 IO1PIN=0X00030000;
 IO0PIN=Y;
 delay(2000);
 IO1PIN=0X00010000;
 }
 
 int main()
 {
 unsigned char i=0,j=0,gpsdata[36],longitude[11],latitude[11], a=0;
 cmd(0x38);
 cmd(0x0c);
 cmd(0x01);
 dat1("GPS");
 a=uart_receive();
 if(a=='G')
 {
 a=uart_receive();
 if(a=='P')
 {
 a=uart_receive();
 if(a=='G')
 {
 a=uart_receive();
 if(a=='G')
 {
 a=uart_receive();
 if(a=='A')
 {
 a=uart_receive();
 if(a==',')
 {
 for(i=0;i<36;i++)
 {
 gpsdata[i]=uart_receive();
 }
 }
 }
 }
 }
 }
 }
 cmd(0x01);
 cmd(0x80);
 dat1("latitude");
 cmd(0xc0);
 for(i=11,j=0;i<=22;j++,i++)
 {
 latitude[j]=gpsdata[i];
 dat(latitude[j]);
 }
 delay(10000);
 cmd(0x01);
 cmd(0x80);
 dat1("longitude");
 cmd(0xc0);
 for(i=23,j=0;i<=35;j++,i++)
 {
 longitude[j]=gpsdata[i];
 dat(longitude[j]);
 }
 delay(10000);
 } 

Leave a Reply

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