You are on page 1of 55

PRESTON UNIVERSITY

(KARACHI)

CERTIFICATE
This is to certify that the following students: Name of students Roll No.

1. SYED MASOOD HUSAIN 2.SYED NAWAID ALI 3.DANISH WAQAR

23D2-211003

Of FINAL Year B.TECH Course in ELECTRONICS TECHNOLOGY have successfully completed their project work on GPS NAVIGATION.

(GPS POSITIONING SYSTEM)


In the partial fulfillment of requirement as prescribed by the PRESTON UNIVERSITY, in the year 2011-2012.

Prof. MATLOOB Department of ELECTRONICS PRESTON UNIVERSITY,(MALIR)

INTERNAL EXAMINER

EXTERNAL EXAMINER 1

ACKNOWLEDGEMENT

Our first experience of project has been successfully, thanks to the support staff of many friends & colleagues with gratitude. We wish to acknowledge all of them. However, we wish to make special mention of the following. First of all we are thankful of our project guide Sir Matloob under whose guideline we were able to complete our project. We are wholeheartedly thankful to him for giving us his value able time & attention & co-operation & assistance in solving technical problems. And thanks to all lab maintenance staff for proving us assistance in various hardware & software problems encountered during course of our project. We are also very thankful to respective principal (NAME) sir who gave us an opportunity to present this project.

Participants

INDEX
SERIAL NO.

CHAPTER NAME

PAGE NO.

1.

INTRODUCTION Introduction to Project Introduction to GPS Introduction to Circuit Introduction to Languages Programming steps 2. GPS CIRCUIT DESCRIPTION CIRCUIT DIAGRAM C PROGRAM (ON-BOARD) VISUAL BASIC PROGRAM 3. FEASIBILITY Time Feasibility Software Availability Cost Effective 4. FUTURE DEVELOPMENT Application Of Project Future Development Of Project 5. BIBLIOGRAPHY Data sheets 89C51 LCD MAX232 HEX INVERTOR GPS MODULE

5- 19

20- 45

46- 47

48- 49

50- 90

Chapter 1 INTRODUCTION

INTRODUCTION OF PROJECT
NEED OF PROJECT

As Pakistan rapidly moving toward evolution of mechanism, So as to meet the basic necessity we needs to travel from one place to another & sometimes to an unknown locations otherwise we get lost. GPS Positioning system is the answer to that.

GPS has endless uses in Clock synchronization, Cellular telephony, Disaster relief/emergency services, Geofencing, Vehicle tracking systems, person tracking systems, Geotagging, GPS Aircraft Tracking, Map-making, Navigation, Robotics etc. GPS is a very necessary device in the field of navigation and positioning.

INTRODUCTION TO GPS ( GLOBAL POSTIONING SYSTEM)


Global Positioning System The Global Positioning System (GPS) is a space-based satellite navigation system that provides location and time information in all weather, anywhere on or near the Earth, where there is an unobstructed line of sight to four or more GPS satellites. The GPS program provides critical capabilities to military, civil and commercial users around the world. In addition, GPS is the backbone for modernizing the global air traffic system.

Basic concept of GPS


A GPS receiver calculates its position by precisely timing the signals sent by GPS satellites high above the Earth. Each satellite continually transmits messages that include

the time the message was transmitted satellite position at time of message transmission

The receiver uses the messages it receives to determine the transit time of each message and computes the distance to each satellite. These distances along with the satellites' locations are used with the possible aid of trilateration, depending on which algorithm is used, to compute the position of the receiver. This position is then displayed, perhaps with a moving map display or latitude and longitude; elevation information may be included. Many GPS units show derived information such as direction and speed, calculated from position changes. Three satellites might seem enough to solve for position since space has three dimensions and a position near the Earth's surface can be assumed. However, even a very small clock error multiplied by the very large speed of light. The speed at which satellite signals propagates results in a large positional error. Therefore receivers use four or more satellites to solve for both the receiver's location and time. The very accurately computed time is effectively hidden by most GPS applications, which use only the location. A few specialized GPS applications do however use the time; these include time transfer, traffic signal timing, and synchronization of cell phone base stations.

Although four satellites are required for normal operation, fewer apply in special cases. If one variable is already known, a receiver can determine its position using only three satellites. For example, a ship or aircraft may have known elevation. Some GPS receivers may use additional clues or assumptions (such as reusing the last known altitude, dead reckoning, inertial navigation, or including information from the vehicle computer) to give a less accurate (degraded) position when fewer than four satellites are visible.

Structure
The current GPS consists of three major segments. These are the space segment (SS), a control segment (CS), and a user segment (US). The U.S. Air Force develops, maintains, and operates the space and control segments. GPS satellites broadcast signals from space, and each GPS receiver uses these signals to calculate its three-dimensional location (latitude, longitude, and altitude) and the current time. The space segment is composed of 24 to 32 satellites in medium Earth orbit and also includes the payload adapters to the boosters required to launch them into orbit. The control segment is composed of a master control station, an alternate master control station, and a host of dedicated and shared ground antennas and monitor stations. The user segment is composed of hundreds of thousands of U.S. and allied military users of the secure GPS Precise Positioning Service, and tens of millions of civil, commercial, and scientific users of the Standard Positioning Service

Space segment
The space segment (SS) is composed of the orbiting GPS satellites. The GPS design originally called for 24 SVs, six orbital planes with four satellites each. The orbits are arranged so that at least six satellites are always within line of sight from almost everywhere on Earth's surface. The result of this objective is that the four satellites are not evenly spaced (90 degrees) apart within each orbit. In general terms, the angular difference between satellites in each orbit is 30, 105, 120, and 105 degrees apart which, of course, sum to 360 degrees. Orbiting at an altitude of approximately 20,200 km (12,600 mi); orbital radius of approximately 26,600 km (16,500 mi)

Control segment

The control segment is composed of 1. 2. 3. 4. a master control station (MCS), an alternate master control station, four dedicated ground antennas and six dedicated monitor stations
10

User segment
In general, GPS receivers are composed of an antenna, tuned to the frequencies transmitted by the satellites, receiverprocessors, and a highly stable clock (often a crystal oscillator). They may also include a display for providing location and speed information to the user. A receiver is often described by its number of channels: this signifies how many satellites it can monitor simultaneously, receivers typically have between 12 and 20 channels. Receivers can interface with other devices using methods including a serial connection, USB, or Bluetooth.

Applications
GPS has become a widely deployed and useful tool for commerce, scientific uses, tracking, and surveillance. GPS's accurate time facilitates everyday activities such as banking, mobile phone operations, and even the control of power grids by allowing well synchronized hand-off switching. Civilian applications use one or more of GPS's three basic components: absolute location, relative movement, and time transfer. Some uses are given below: 1) 2) 3) 4) 5) 6) 7) Clock synchronization Cellular telephony Disaster relief/emergency services GPS Aircraft Tracking Navigation Robotics Vehicle tracking systems, person tracking systems etc

11

Satellite frequencies
All satellites broadcast at the same two frequencies, 1.57542 GHz (L1 signal) and 1.2276 GHz (L2 signal). GPS frequency overview is given below:

12

A visual example of the GPS constellation in motion with the Earth rotating:

GPS STATELLITES AROUND THE EARTH

13

Introduction to Languages
We are using two programming languages in this project: 1. Embedded C 2. Visual Basic

C Language: C is an imperative (procedural) systems implementation language. It was designed to be compiled using a relatively straightforward compiler, to provide low-level access to memory, to provide language constructs that map efficiently to machine instructions, and to require minimal run-time support. C was therefore useful for many applications that had formerly been coded in assembly language.

Despite its low-level capabilities, the language was designed to encourage cross-platform programming. A standards-compliant and portably written C program can be compiled for a very wide variety of computer platforms and operating systems with few changes to its source code. The language has become available on a very wide range of platforms, from embedded microcontrollers to supercomputers. C is one of the most widely used programming languages of all time and there are very few computer architectures for which a C compiler does not exist. C has greatly influenced many other popular programming languages, most notably C++, which began as an extension to C.

14

Visual Basic: Visual Basic (VB) is a third-generation event-driven programming language and integrated development environment (IDE) from Microsoft for its COM programming model first released in 1991. Visual Basic is designed to be relatively easy to learn and use. Visual Basic was derived from BASIC and enables the rapid application development (RAD) of graphical user interface (GUI) applications, access to databases using Data Access Objects, Remote Data Objects, or ActiveX Data Objects, and creation of ActiveX controls and objects. Scripting languages such as VBA and VBScript are syntactically similar to Visual Basic, but perform differently.

A programmer can put together an application using the components provided with Visual Basic itself. Programs written in Visual Basic can also use the Windows API, but doing so requires external function declarations. Though the program has received criticism for its perceived faults, from version 3 Visual Basic was a runaway commercial success, and many companies offered third party controls greatly extending its functionality.

The final release was version 6 in 1998. Microsoft's extended support ended in March 2008 and the designated successor was Visual Basic .NET (now known simply as Visual Basic).

15

The Programming Process:

The C language is used to program microcontroller that is 89c51 to display data of GPS on LCD and to transmit data on serial port. Display data includes longitude, latitude, time, altitude( from sea level), number of satellites locked. The acquisition of GPS data is at 1 Hz, while the baud rate is set at 9600.

MICROCONTOLLER PROGRAMMING:

GPS provides a lot of geographical information for a particular object like its latitude, longitude, direction of travel, GMT etc. This information is assembled in a particular string format which is to be decoded by GPS modems. A GPS modem gives the output data in a following string format called as NMEA Format. A common GPS sentence ($GPGGA) has been explained below.

$GPGGA,100156.000,2650.9416,N,07547.8441,E,1,08,1.0,442 .8,M,-42.5,M,,0000*71

1. A string always starts with a $ sign 2. GPGGA : Global Positioning System Fix Data 3. , Comma indicates the separation between two values 4. 100156.000 : GMT time as 10(hr):01(min):56(sec):000(ms)

16

5. 2650.9416,N: Latitude 26(degree) 50(minutes) 9416(sec) North 6. 07547.8441,E: Longitude 075(degree) 47(minutes) 8441(sec) East 7. 1 : Fix Quantity 0= invalid data, 1= valid data, 2=DGPS fix 8. 08 : Number of satellites currently viewed. 9. 1.0: HDOP 10. 442.8,M : Altitude (Height above sea level in meter) 11. -42.5,M : Geoids height

12. __ , DGPS data 13. 0000 : DGPS data 14. *71 : checksum

The main objective here is to find the location of the GPS Receiver in terms of latitude and longitude. The GPS module gives output data in RS232 logic level format. The latitude and longitude data has been displayed on a16x2 LCD interfaced to microcontroller.

Programming steps:

1. Set the baud rate of microcontroller USART to 9600 bps. 2. Enable the SPEN and CREN bits (RCSTA register).

17

3. Receive the Serial data and compare with the string $GPGGA, byte by byte. 4. Wait for comma (,) as string gets matched. 5. Store the data which appears after the above comma into a string which will be the Latitude. 6. After another comma (,), store the data into another string which will be the Longitude. 7. After another comma (,), store the data into another string which will be the Altitude. 8. After another comma (,), store the data into another string which will be the Time. 9. After another comma (,), store the data into another string which will be the Satellite lock. 10. Display Latitude, Longitude, altitude, time and satellite lock data on LCD. 11. Repeat the steps 3 to 9 to update the GPS modules positions on LCD.

WINDOWS PROGRAMING:

While the Visual Basic is used to acquire ( save and compile) GPS data from computers serial port. GPS saved data is formatted in such a way that it can be loaded in GOOGLE EARTH. The GPS data is also displayed on computer screen using GUI ( graphical user interface). Time displayed in 12 hours clock PST format. Google earth is a navigation software use internet connection to display satellite imaginary and maps.

18

The real time data is acquired using this project ( circuit).

Programming steps: 1. Set the baud rate of computer serial port to 9600 bps. 2. Receive the Serial data and compare with the string $GPGGA, byte by byte. 3. Wait for comma (,) as string gets matched. 4. Make GUI for display on computer screen. 5. Time conversation from UTC to PST and in 12 hour clock. 6. Wait for comma (,) as string gets matched. 7. Save the acquired file in notepad as well as Google Earth executable file.

19

Chapter 2 GPS CIRCUIT

20

DESCRIPTION OF GPS CIRCUIT:


The GPS module continuously transmits serial data (RS232 protocol) in the form of sentences according to NMEA standards. The latitude and longitude values of the location are contained in the GPGGA sentence (refer NMEA format). In this program, these values are extracted from the GPGGA sentence and are displayed on LCD.

The serial data is taken from the GPS module through MAX232 into the SBUF register of 8051 controller (refer serial interfacing with 8051). The serial data from the GPS receiver is taken by using the Serial Interrupt of the controller. This data consists of a sequence of NMEA sentences from which GPGGA sentence is identified and processed.

The extraction of location values is done as follows. The first six bytes of the data received are compared with the pre-stored ($GPGGA) string and if matched then only data is further accounted for; otherwise the process is repeated again. From the comma delimited GPGGA sentence, latitude and longitude positions are extracted by finding the respective comma positions and extracting the data. The latitude and longitude positions extracted are displayed on the LCD interfaced with AT89C51.

The circuit connections are as follows:

1) Receiver1 (R1) of MAX232 has been used for the serial communication. The receiver pin of GPS module is connected to R1IN (pin13) of MAX232. R1OUT (pin 12) of MAX232 is connected to RxD (P3.0) of AT89C51. 2) Pins 1-3 of port P1 (P1.0, P1.1 & P1.2 respectively) of AT89C51 are connected to the control pins (RS, R/W& EN) of LCD. 3) The data pins of LCD are connected to Port P2 of the controller.

21

4) The latitude and longitude positions are displayed on the LCD.

SUMMERY:
GPS has become an efficient tool in the field of scientific use, commerce, surveillance and tracking. This project presents a small application based on Global Positioning System. It depicts the use of GPS module/receiver to find latitude and longitude of its location. The data obtained from GPS receiver (GPGGA sentence) is processed by the microcontroller to extract its latitude and longitude values. The GPS Module has been interfaced with AT89C51 and the location values are displayed on a 16x2 LCD interface.

CIRCUIT DIAGRAM OF GPS POSITIONING CIRCUIT

22

MICROCONTROLLER (8051) PROGRAMING:

#include<reg51.h> #define port2 P2 sbit rs = P1^0; sbit rw = P1^1; sbit e = P1^2; char info[70]; char test[6]={"$GPGGA"}; char comma_position[15]; unsigned int check=0,i; unsigned char a; void receive_data(); void lcd_preston(); void lcd_satellite(); void lcd_time(); void lcd_latitude(); void lcd_longitude(); void lcd_altitude();

//DELAY FUNCTION void delay(unsigned int msec) { int i,j ; for(i=0;i<msec;i++) for(j=0;j<1275;j++); }

23

// LCD COMMAND SENDING FUNCTION void lcd_cmd(unsigned char item) { port2 = item; rs= 0; rw=0; e=1; delay(1); e=0; return; }

// LCD DATA SENDING FUNCTION

void lcd_data(unsigned char item) { port2 = item; rs= 1; rw=0; e=1; delay(1); e=0; return; }

24

// LCD STRING SENDING FUNCTION void lcd_string(unsigned char *str) { int i=0; while(str[i]!='\0') { lcd_data(str[i]); i++; delay(10); } return; }

// SERIAL PORT SETTING

void serial() { TMOD=0x20; //MODE=2 TH1=0xfd; // 9600 BAUD Rate SCON=0x50; // SERIAL MODE 1 ,8- BIT DATA ,1 STOP BIT ,1 START BIT , RECEIVING ON TR1=1; } //TIMER START

25

void find_comma() { unsigned int i,count=0; for(i=0;i<70;i++) { if(info[i]==',') { comma_position[count++]=i; } } }

void compare()

{ IE=0x00; //Interrupt disable find_comma(); //Function to detect position of comma in the string lcd_preston(); //function to display PRESTON UNIVERSITY lcd_satellite(); //Function to show No. of Sattellite lcd_time(); //Function to show Time lcd_latitude(); //Function to show Latitude lcd_longitude(); //Function to show Longitude lcd_altitude(); //Function to show Altitude check=0;

26

IE=0x90; }

//Interrupt enable

void receive_data() interrupt 4 { info[check++]=SBUF; //Read SBUF if(check<7) //Condition to check the required data { if(info[check-1]!=test[check-1]) check=0; } RI=0; } void lcd_shape() //Function to create shape of degree { lcd_cmd(64); lcd_data(10); lcd_data(17); lcd_data(17); lcd_data(10); lcd_data(0); lcd_data(0); lcd_data(0); lcd_data(0);

27

} void lcd_time() //Function to display Latitude { unsigned int c1=comma_position[0]; //Position of second comma

lcd_shape(); lcd_cmd(0x01); lcd_cmd(0x84); lcd_string("T I M E"); lcd_cmd(0xC4); lcd_data(info[c1+1]); lcd_data(info[c1+2]); lcd_string(":"); lcd_data(info[c1+3]); lcd_data(info[c1+4]); lcd_string(":"); lcd_data(info[c1+5]); lcd_data(info[c1+6]); delay(250); } void lcd_altitude() { unsigned int c9=comma_position[0];//Position of second comma lcd_shape(); lcd_cmd(0x01); // Clear LCD display lcd_cmd(0x84); //Move cursor to position 6 of line 1 lcd_string("ALTITUDE"); //Showing Latitude lcd_cmd(0xC4); //Beginning of second line //Function to display Altitude // Clear LCD display //Move cursor to position 6 of line 1 //Showing Latitude //Beginning of second line

28

lcd_data(info[c9+1]); lcd_data(info[c9+2]); lcd_data(info[c9+3]); lcd_string("."); // decimal point lcd_data(info[c9+4]); lcd_data(info[c9+5]); lcd_string("M"); delay(250); }

void lcd_preston() {

//Function to display satellite lock

lcd_shape(); lcd_cmd(0x01); // Clear LCD display lcd_cmd(0x80); //Move cursor to position 2 of line 1 lcd_string("PRESTON"); //Showing PRESTON lcd_cmd(0xC6); //Beginning of second line lcd_string("UNIVERSITY"); //Showing UNIVERSITY lcd_shape(); lcd_cmd(0x01); // Clear LCD display lcd_cmd(0x80); //Move cursor to position 2 of line 1 lcd_string("B.TECH"); //Showing B.TECH lcd_cmd(0xC6); //Beginning of second line lcd_string("ELCTRONICS"); //Showing ELECTRONICS delay(250); }

29

void lcd_satellite() //Function to display satellite lock { unsigned int c7=comma_position[0]; //Position of second comma lcd_shape(); lcd_cmd(0x01); // Clear LCD display lcd_cmd(0x82); //Move cursor to position 2 of line 1 lcd_string("SATELLITE LOCK"); //Showing satellite lock lcd_cmd(0xC4); //Beginning of second line lcd_data(info[c7+1]); lcd_data(info[c7+2]); delay(250); }

void lcd_latitude() //Function to display Latitude { unsigned int c2=comma_position[1]; //Position of second comma lcd_shape(); lcd_cmd(0x01); // Clear LCD display lcd_cmd(0x84); //Move cursor to position 6 of line 1 lcd_string("LATITUDE"); //Showing Latitude lcd_cmd(0xC0); //Beginning of second line lcd_data(info[c2+1]); lcd_data(info[c2+2]); lcd_data(0);

30

//Degree symbol lcd_data(info[c2+3]); lcd_data(info[c2+4]); lcd_data(info[c2+5]); lcd_data(info[c2+6]); lcd_data(info[c2+7]); lcd_data(info[c2+8]); lcd_data(info[c2+9]); lcd_data(0x27); //ASCII of minute sign(') lcd_data(info[c2+10]); lcd_data(info[c2+11]); delay(250); }

void lcd_longitude() { unsigned int c4=comma_position[3]; lcd_cmd(0x01); //Clear LCD display lcd_cmd(0x84); //Move cursor to position 4 of line 1 lcd_string("LONGITUDE"); //Showing Longitude lcd_cmd(0xC0); //Begining of second line lcd_data(info[c4+1]); lcd_data(info[c4+2]); lcd_data(info[c4+3]); lcd_data(0); lcd_data(info[c4+4]); lcd_data(info[c4+5]); lcd_data(info[c4+6]); lcd_data(info[c4+7]); lcd_data(info[c4+8]); lcd_data(info[c4+9]);

31

lcd_data(info[c4+10]); lcd_data(0x27); lcd_data(info[c4+11]); lcd_data(info[c4+12]); delay(250); } //ASCII of minute sign(')

void main() { serial(); lcd_cmd(0x38); lcd_cmd(0x0e); IE=0x90; while(1) { if(check==69) compare(); } }

//2 LINE, 5X7 MATRIX //DISPLAY ON, CURSOR BLINKING

32

VISUAL BASIC PROGRAM:


using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.IO; using System.Xml; using System.Globalization;

namespace GPSSoftware { public partial class Form1 : Form { List<String> allMessages = new List<string>(); List<MessageGPGGA>allGAMessages=newList<MessageGPG GA>(); public delegate void STAUpdateText(string text); public delegate void MessageUpdate(MessageGPGGA gpggmsg); public Form1() { InitializeComponent(); }

private void gpsSerialPort_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)


33

{ try { String message = gpsSerialPort.ReadLine(); allMessages.Add(message); string[] strArray = message.Split(new char[] { ',' }); if (strArray[0] == "$GPGGA") { //string UTCPosition = strArray[1] +" FIX Indic:= "+ strArray[6]; MessageGPGGA aMessage = MessageGPGGA.parseMessageGPGGA(message); allGAMessages.Add(aMessage); UpdateGPGGAMessage(aMessage);

//aMessage = aMessage.parseMessageGPGGA //double utcTime = double.Parse(strArray[1]); //int hour =(int) (utcTime / 10000); //int minutes = (int)((utcTime - hour * 10000) / 100);

//int seconds = (int)(utcTime -hour*10000 - minutes *100 ); //hour = hour + 5;

34

//string UTCPosition = hour.ToString() + ":" + minutes.ToString() + ":" + seconds.ToString(); //string noOfSatellite = "Lati: "+ strArray[2] +"Longi: "+ strArray[4];

//UpdateText(UTCPosition); //UpdateText2(noOfSatellite);

} if (strArray[0] == "$GPGSV") { string satellinteInView = strArray[3];//+" SNR:= "+strArray[7]; UpdateText3("Satellite In View:= "+satellinteInView); } if (strArray[0] == "$GPZDA") { if (strArray.Length > 0) { string comDate = "Day:=" + strArray[2] + "Month:= " + strArray[3] + "Year:= " + strArray[4]; UpdateText3(comDate); } }

35

} catch (Exception excep) { // MessageBox.Show(excep.Message); } } private void UpdateGPGGAMessage(MessageGPGGA aMessage) { MessageUpdate msg = new MessageUpdate(UpdateAllTxt); this.BeginInvoke(msg, new object[] { aMessage }); } public void UpdateAllTxt(MessageGPGGA msg) { txtTime.Text = msg.UtcTime; txtLatitude.Text = msg.Latitude.ToString()+msg.NSIndic; txtLongitude.Text = msg.Longitude.ToString()+msg.SwIndic; txtAltitude.Text = msg.Altitude.ToString()+" m"; }

#region Old Text Update Code private void UpdateText3(string p) {

36

STAUpdateText upd = new STAUpdateText(STAUpdate3); this.BeginInvoke(upd, new object[] { p }); } private void UpdateText2(string noOfSatellite) { //STAUpdateText upd = new STAUpdateText(STAUpdate); //this.BeginInvoke(upd, new object[] { noOfSatellite }); } public void STAUpdate(string txt) { // txtSatellite.Text = txt; } public void STAUpdate3(string txt) { txtSatAttrib.Text = txt; } private void UpdateText(string UTCPosition) { STAUpdateText upd = new STAUpdateText(STAUpdate2); this.BeginInvoke(upd, new object[] { UTCPosition }); } public void STAUpdate2(string txt) { txtTime.Text = txt; }

37

#endregion

private void btnStart_Click(object sender, EventArgs e) { if(!gpsSerialPort.IsOpen) gpsSerialPort.Open(); } private void btnStop_Click(object sender, EventArgs e) { closeSerialPort(); } private void closeSerialPort() { if (gpsSerialPort.IsOpen) { gpsSerialPort.Close(); MessageBox.Show("Serial Port is closed"); } } private void Form1_Load(object sender, EventArgs e) { } private void btnSave_Click(object sender, EventArgs e) {

38

// Default to save. // String path = saveFileDialog.FileName; SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = "GPS Log File (*.log) | *.log | *.kmz | *.kml "; DialogResult myDResult = saveFileDialog.ShowDialog(); String path = null; if (myDResult == DialogResult.OK) { string path1 = saveFileDialog.FileName; WritesSimpleLogFile(path1); path1 = Path.GetDirectoryName(path1) + "\\"+Path.GetFileNameWithoutExtension(path1) + ".kml"; WriteGoogleEarthKmlFile(path1); // clear data inside the messages array allMessages.Clear(); }

// write all messages to the C:\GpsData.log

} private void WriteGoogleEarthKmlFile(string path1) {

39

//MessageGPGGA aTest1 = new MessageGPGGA(); //aTest1.Latitude = 9.57690; //aTest1.Longitude = 45.62980; //aTest1.Altitude = 8; //MessageGPGGA aTest2 = new MessageGPGGA(); //aTest2.Latitude = 9.57710; //aTest2.Longitude = 45.63050; //aTest2.Altitude = 200; //MessageGPGGA aTest3 = new MessageGPGGA(); //aTest3.Latitude = 9.57730; //aTest3.Longitude = 45.63119; //aTest3.Altitude = 180; //allGAMessages.Add(aTest1); //allGAMessages.Add(aTest2); //allGAMessages.Add(aTest3);

NumberFormatInfo info = new NumberFormatInfo(); info.NumberDecimalSeparator = "."; info.NumberGroupSeparator = string.Empty;

XmlWriter xmw = new System.Xml.XmlTextWriter(path1, System.Text.Encoding.UTF8); xmw.WriteStartDocument();// start writing xml docs xmw.WriteStartElement("kml", "http://earth.google.com/kml/2.0"); xmw.WriteStartElement("Folder");

40

xmw.WriteElementString("Name", "GPS Software Data"); xmw.WriteStartElement("description"); xmw.WriteCData("All GPS data"); xmw.WriteEndElement();// end ' description // xmw.WriteStartElement("Placemark");

xmw.WriteElementString("name", "Gps Line"); xmw.WriteElementString("visibility", "5"); xmw.WriteStartElement("LineStyle"); xmw.WriteElementString("color","7fFF0000" ); xmw.WriteElementString("width","10"); xmw.WriteEndElement(); // <LineStyle> // <color>7fFF0000</color> // <width>4</width> //</LineStyle> // <visibility>1</visibility> xmw.WriteStartElement("LineString");

xmw.WriteElementString("extrude", "0"); xmw.WriteElementString("tessellate", "1"); xmw.WriteElementString("altitudeMode", "clampToGround"); xmw.WriteStartElement("coordinates"); foreach (MessageGPGGA aMsg in allGAMessages) {

41

double locLat = aMsg.Latitude; double locLong = aMsg.Longitude; double decLat = getDecimalLatitude(locLat);

double decLong = getDecimalLongitude(locLong);

//string latitude = (aMsg.Latitude).ToString(info); string latitude = (decLat).ToString(info); string longitude = (decLong).ToString(info); string altitude = aMsg.Altitude.ToString(info); xmw.WriteValue(longitude+ "," + latitude + "," + altitude+"\r"); } // xmw.WriteString("1,3,2"); xmw.WriteEndElement(); // coordinates

xmw.WriteEndElement(); //Line String xmw.WriteEndElement();// Place mark end xmw.WriteEndElement();// Folder. xmw.WriteEndElement(); // kml xmw.WriteEndDocument(); xmw.Flush(); /* // throw new NotImplementedException(); This ASP.NET function writes KML to a MemoryStream, and returns it as a string.

42

Public Shared Function GetKml(ByVal title As String, _ ByVal pointName As String, ByVal pointDescription As String, _ ByVal longitude As Double, ByVal latitude As Double, _ ByVal altitude As Int32) As String If altitude < 0 Then Throw _ New ArgumentOutOfRangeException("altitude") If String.IsNullOrEmpty(title) Then Throw _ New ArgumentNullException("Title") If String.IsNullOrEmpty(pointName) Then _ Throw New ArgumentNullException("pointName") Using memStream As New IO.MemoryStream() Using xtw As New Xml.XmlTextWriter( _ memStream, System.Text.Encoding.UTF8) xtw.WriteStartDocument() xtw.WriteStartElement("kml", _ "http://earth.google.com/kml/2.0") xtw.WriteStartElement("Document") xtw.WriteElementString("name", title) ' content creation block xtw.WriteStartElement("Placemark") xtw.WriteElementString("name", pointName) xtw.WriteStartElement("description") xtw.WriteCData(pointDescription.ToString) xtw.WriteEndElement() ' description xtw.WriteStartElement("Point") Dim formatinfo As New System.Globalization.NumberFormatInfo formatinfo.NumberDecimalSeparator = "." formatinfo.NumberGroupSeparator = String.Empty xtw.WriteElementString("coordinates", & _ longitude.ToString(formatinfo) & "," & _ latitude.ToString(formatinfo) & "," & _ altitude.ToString(formatinfo)) xtw.WriteEndElement() ' Point xtw.WriteEndElement() ' Placemark ' end of content creation block

43

xtw.WriteEndElement() ' Document xtw.WriteEndDocument() xtw.Flush() ' rewind the stream to convert content to a String memStream.Seek(0, IO.SeekOrigin.Begin) Using reader As New System.IO.StreamReader( _ memStream, System.Text.Encoding.UTF8) GetKml = reader.ReadToEnd End Using End Using End Using End Function */

} private static double getDecimalLatitude(double locLat) { int intLat = (int)locLat; int deg = intLat / 100; // int min = intLat - deg * 100; double min = locLat - deg * 100; //double sec = locLat * 10000 - intLat * 10000;

double decLat = deg + min / 60; return decLat; } private static double getDecimalLongitude(double locLong) { int intLong = (int)locLong;

44

int deg = intLong / 100; double min = locLong - deg * 100; double decLong = deg + min / 60; return decLong;

} private void WritesSimpleLogFile(string path) { FileStream fs = new FileStream(path, FileMode.Create); StreamWriter sr = new StreamWriter(fs); foreach (string message in allMessages) { sr.WriteLine(message); } sr.Close(); fs.Close(); } private void Form1_FormClosed(object sender, FormClosedEventArgs e) { closeSerialPort(); } } }

45

Chapter 3 FEASIBILITY

46

FEASIBILITY
Introduction: A feasibility analysis involves a detailed assessment of the need, value and practicality of a proposed enterprise, such as systems development. The process of designing and implementing record-keeping systems has sufficient accountability and resource implications for an organization. Feasibility analysis will help you make inform and transparent decision at crucial points during the developmental process to determine whether it is operationally, economically and technically realistic to produce with a particular course of action. Cost Effectiveness : The cost effectiveness of this system is very reasonable. The total project costs only Rs.5000. However, the acquistion system and other measuments are of premium class. That is Onboard via LCD and through serial port on computer for data recording and interfacing with Google Earth software with connecting to the world wide web. Point to point acquition help in data sampling line to line aquisition techniques. We can take many advantages in travelling, time syncronizing, map making etc. With less net cost.

Software feasibility: The software is very elastic. As it is programmed in visual basic and C languages that are very easy to compile and to change with respect of object orientation. The visual basic execuatable file can easily be installed on every computer using windows platform, even on windows mobile phone.

47

Chapter 4 FUTURE DEVELOPMENT

48

FUTURE DEVELOPMENT OF PROJECT

AS PER USERS REQUIREMENT OUR WHOLE PROGRAM IS DESIGNED. WE CAN ADD AN ADDITIONAL CONSTRAINT TO OUR PROJECT. WE ARE ALSO TRYING TO MAKE THIS PROJECT FOR GSM BASED POSTIONING SYSTEM, SO THAT CUSTOMER CAN AQUIRE HIS/HER POSITION DIRECTLY ON MOBILE PHONES. THIS WILL REQUIRE ADDING GSM MODULE INTERFACING WITH THE ABOVE DESCRIBED CIRCUITARY. YOU CAN TRACK YOUR VEHICLE ETC THROUGH THIS AND WILL NOT REQUIRED ADDITIONAL CHARGES TO PAY OFF.

49

Chapter 5 BIBLOGRAPHY

50

7. BIBLIOGRAPHY

This section gives you the name of the books required for the development of the project.

NAME OF THE BOOK NAME

AUTHOR

1. Visual Studio complete reference 6.0

Noel Jecke

2. Programming in Visual Basic

JulieCaseBradley

3. Visual Basic 6.0

Wright Brothers

4. Electonic device and circuits

Floyd

5. World wide web service

51

DATA SHEETS

52

MAX232 DATASHEET:

53

54

78M05 DATASHEET:

55

You might also like