Preston gps project report Project định vị GPS sử dụng vi điều khiển
Trang 1PRESTON UNIVERSITY
(KARACHI)
CERTIFICATE
This is to certify that the following students:
1 SYED MASOOD HUSAIN 23D2-211003
2.SYED NAWAID ALI
3.DANISH WAQAR
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)
Trang 2ACKNOWLEDGEMENT
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
Trang 3INDEX
SERIAL
NO.
CHAPTER NAME
Trang 5Chapter 1
INTRODUCTION
Trang 6GPS 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
Trang 7INTRODUCTION 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
Trang 8Basic 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 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
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
Trang 9Although 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
Trang 10Space 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
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 a master control station (MCS),
2 an alternate master control station,
3 four dedicated ground antennas and
4 six dedicated monitor stations
Trang 11User segment
In general, GPS receivers are composed of an antenna, tuned to the frequencies transmitted by the satellites, receiver-processors, 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:
Trang 12Satellite 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:
Trang 13A visual example of the GPS constellation in motion with the Earth rotating:
GPS STATELLITES AROUND THE EARTH
Trang 14straightforward 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
Trang 15Visual 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)
Trang 16The 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)
Trang 175 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
Programming steps:
1 Set the baud rate of microcontroller USART to 9600 bps
2 Enable the SPEN and CREN bits (RCSTA register)
Trang 183 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 module’s positions
Trang 19The 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
Trang 20
Chapter 2 GPS CIRCUIT
Trang 21DESCRIPTION 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
Trang 224) 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
Trang 24// LCD COMMAND SENDING FUNCTION
void lcd_cmd(unsigned char item)
// LCD DATA SENDING FUNCTION
void lcd_data(unsigned char item)
Trang 25// LCD STRING SENDING FUNCTION
void lcd_string(unsigned char *str)
Trang 26IE=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;
Trang 27IE=0x90; //Interrupt enable
info[check++]=SBUF; //Read SBUF
if(check<7) //Condition to check the required data