Implementation of GPS for Location Tracking Ahmad Ashraff Bin Ariffin, Noor Hafizah Abdul Aziz and Kama Azura Othman Faculty of Electrical Engineering Universiti Teknologi MARA Malaysia Shah Alam, Malaysia ayapaa01@yahoo.com.my, noor4083@salam.uitm.edu.my Abstract- Stand alone global positioning system receivers are widely used nowadays to accurately locating one s position. By using stand alone GPS receivers the distance between two locations on earth can also be measured. This project is aim to design and implement a low cost Global Positioning System suitable to be used for hiking, climbing and sailing activities. The function of the GPS is to locate the position of user. The effects of line of sights in relation to different experimented locations are also studied. In this project, the hardware used is PIC18F4520 integrated with GPS receiver typed FV-M8. The GPS modules will generate the coordinates of latitude and longitude as well as the bearing angles between two positions. The algorithm to calculate the distance between two positions was developed by using PIC C Compiler. The written algorithm extracted the data from the GPS receiver via the RS232 communication. Microcontroller is used to parse the NMEA data sentences and execute the algorithm. Finally, the output is displayed to a LCD display unit. System testing conducted showed that for a few chosen different locations, geographical view and weather conditions, overall results give an average of 10 % different compared with ideal theoretical calculated results. Keywords: GPS, NMEA, CMOS, MCU, RISC, ASCII, FV-M8, and RS232. I. INTRODUCTION Global Positioning Satellites network is known to have offered users with many applications especially in the area of tracking. Currently, fisherman who lost their way in the sea could locate their position by using GPS receiver installed on their boat. They could acquire a coordinate and call for a rescue crew to save them with reference to the GPS coordinate. GPS is used for navigation and provides continuous and timing information position of things anywhere in the world under any weather condition [1]. GPS consist nominally of 24 operational satellites orbiting the earth at very high altitude [2]. Satellites send signals to the GPS receiver to locate the exact position. These satellites are constantly monitored to make sure that they are working properly. The GPS parts consist of three segments which are user, space and control. This project will focus on the ground segment. This segment is further divided into two parts. First is for control and command of the satellite and the second is for receiving and exploiting some set of data. The GPS receiver is used to capture the current location and data provided by the GPS which it couldn t be understand by human because of its ASCII character. This GPS data needs to be extracted and decoded in order to get the desired information. Besides that, GPS receiver can also provides information such as time, status, altitude, number of satellite in view to get the current latitude and longitude for a particular location. II. THEORETICAL BACKGROUND A. GPS Arrangement (GPS Data Retrieved) The set of data or information from GPS receiver can be called a NMEA, which is stand for National Marine Electronics Association. These data strings based on ASCII are communicated at a rate of 38400 bits per second which is equivalent to the baud rate of 38400 characters per second [3]. The GPS data is normally received and transmitted in a standard NMEA-0183 format. This GPS continuously outputs a lot of NMEA sentences such as GGA, GLL, GSA, GSV, RMC, and VTG. In this case, the only concerned was the ($GPGGA) sentence, which represents the Global Positioning System Fix Data for the GPS receiver. Example of Global Positioning System Fix Data is $GPGGA,153041,6033.8963,N,10143.6383,W,1,05,1.5,101.1, M,-22.4,M,,,*70. And Table I shows the GGA data format acquired with information on the longitude with west or east, latitude with south or north, and UTC time data are display out via GGA data. This data will be extracted into a defined fixedlength package and some other useful information. Extracted data will be transmitted to PIC and stored in 18F4520 EEPROM [3]. TABLE I. NMEA V3.01 $GPGGA MESSAGE [3] Name Example Data Description Sentence Identifier $GPGGA Global Positioning System Fix Data Time 153041 15:30:41 UTC 6033.8963, N 60d 33.8963 N or 60d 33' 54" N 10143.6838, W 101d 43.6838 W or 101d 43' 41" W Fix Quality: - 0 = Invalid - 1 = GPS fix 1 Data is from a GPS fix - 2 = DGPS fix Number of Satellites 05 5 Satellites are in view Horizontal Dilution Relative accuracy of 1.5 of Precision (HDOP) horizontal position Altitude 100.1, M 100.1 meters above mean sea level 978-1-4577-0339-3/11/$26.00 2011 IEEE 77
Height of geoid above WGS84 ellipsoid Time since last DGPS update DGPS reference station id -22.4, M -22.0 meters blank blank Checksum *70 No last update No station ID Used by program to check for transmission errors B. Format of s and s From the numeric latitude or longitude, the two digits which are on the leftmost of the integer are the minutes character, the next two numbers represent the integer in minutes, and at the left is the whole minutes degrees [3]. For example 6049.15 N is 60 degrees and 49.15 minutes. Thus this will results in latitude of 60.819 N. [ = 6049.15 = 60 + ( 49.15/60 ) = 60.819 N] Another example 10141.055 E is 101degrees and 41.055 minutes. And thus the longitude is 101.68425 E. [ = 10141.055 = 101 + ( 41.055/60 ) = 101.68425 E] C. Distance Between Two Points on the Earth If point 1 (lat1, long1) and point 2 (lat2, long2) are two given points, R is radius of the earth and its value are 6372.8, D is the distance between the points on the Earth and φ is the great circle distance between point 1 and point 2 [3]. cosφ = [ cos(lata) x cos(latb) x cos(lonb - lona) ] + [ sin(lata) x sin(latb) ]. So φ = in degrees. = in radians. D = R x ( φ in radians ). = in Kilometres. [3] D. Multipath Error Through the use of the public GPS, involving 24 global positioning satellites one is able to determine their exact location in real time. However the employment of a GPS system in this application will lead to multipath error which effect the accuracy of the range measurement performed, GPS signal can be shadowed by buildings, terrain, raining and also man made obstacles, thus there occurs the effects of reducing the visibility of the satellites. III. METHODOLOGY Fig. 1 shows the project methodology towards completing design and implementation of the GPS location tracker. Initially, communication must be first established between the PIC and GPS receiver. Thus an interface circuitry was developed to achieve this. The circuitry acted as a medium in order to receive the signal from GPS receiver and then display the data onto the LCD. This circuit is controlled by the push button switch, reset switch and selector switch. A 5V DC supply was given to this switch. The signal from GPS receiver is then sent to the PIC for data extraction and display. Secondly, a program was written in C language to drive the GPS Location Tracker hardware. A good understanding on the NMEA data received through the GPS receiver is important to ensure the written program will extract the desired data. The program was written using PIC C Compiler. The hardware used in this project are PIC 18F4520, RS232 to USB converter and GPS receiver FV M8 as illustrated in Fig. 2. The final step in the project development was integrating the software and hardware to function as one. Then to verify the functionality of the system, several testing was conducted in different geographical locations. During the testing, data collected was recorded and analyzed. Data storage Start Literature review Design a tracking software using C program Hardware development Test both software and hardware Data obtain and troubleshoot Yes End Figure 1. Flow chart of methodology. Figure 2. Block diagram of the GPS system. File documentation A. Hardware Description The complexity of the hardware designing is to extract the GPS-NMEA sentence (hardware block diagram as shown in Fig. 3). PIC18F4520 was used because the characteristics of a low-power CMOS 8-bit MCU based on a high performance RISC architecture [4]. With two control pins and eight data pins, the PIC gives the LCD specific information to display. Pins RC6 and RC7 for PIC individually senses the signal from GPS receiver and interface via RS232 as shown in Fig. 3 [5]. No 5V DC PIC18F4520 MAX232 RS232 78
5V power supply GPS receiver PIC18F4520 MAX232 IV. RESULT AND DISCUSSION Several of NMEA data sentences obtained during actual experiment were displayed using Hyper Terminal in personal computer as shown in Fig. 5 and Fig. 6. And these readings were used to be compared with GPS data taken by GPS Location Tracker system LCD display Figure 3. Circuit block diagram of GPS through PIC18F4520. B. Software Description In this project, PIC C Compiler is used as the platform to write the software part of the GPS Location Tracker. The developed program sequence is shown in Fig. 4. Initially, GPS receiver status must first be checked. The program is used to extract desired GPS data such as latitude and longitude of a particular location. The flowchart in Fig. 4 described the flow of PIC18F4520 in programs and to run the devices. The coding that already programmed is to control a main task such as initializing the GPS receiver and its acquisition. 305.4880 N 10131.2058 E Figure 5. Sample of CGA sentences taken at Shah Alam, Section 9. Start Check GPS receiver status GPS controller power up No Power on GPS controller Yes Read GPS data Process GPS data and extract useful information Save information in formatted string Display data at LCD display End Figure 4. Flowchart of subroutine to read GPS data. 0308.3323 N 10143.8669 E Figure 6. Hyper terminal display at UiTM, Shah Alam. Fig. 7 shows GPS data collected and display by the GPS Location Tracker system developed in this project. The result showed the latitude and longitude were successfully extracted from the GGA data sentence and converted to decimal degrees. Theoretical values using Hyper Terminal are 308.323, N for latitude and 10143.8669, E for longitude. As well as experimental values using GPS Location Tracker unit are 304.4201, N for latitude and 10129.8834, E longitude. 79
Figure 7. UiTM s coordinate. A. Outdoor Data Measurement First experiment was conducted at Hutan Lipur with coordinate values at latitude 309.122 N and longitude 10147.0476 E. Second experiment was done at Klang Gate Dam with coordinate values at latitude 313.996 N and longitude 10145.041 E. The two chosen locations are famous outdoor attractions to those who want to experience nature in the Klang Valley. Measurement taken during the actual testing can be divided into two; first was to extract coordinates using GPS Location Tracker unit, second to measure the distance between two points with consideration of the natural existed obstacles such as hill, rain and cloud. Figure 8. Data obtained at latitude of Hutan Lipur,. TABLE II. A SET OF LATITUDE AND LONGITUDE DATA AT HUTAN LIPUR, AMPANG Time Respond time (min) Experiment values (N) (E) DC voltage (V) 0900 3.143 0308.9626 10147.5059 5.01 1000 3.243 0308.9515 10147.5048 5.02 1100 3.343 0308.9504 10147.5042 5.015 1200 3.112 0308.9501 10147.4992 5.09 1300 3.010 0308.9490 10147.4984 5.01 1400 3.223 0308.9485 10147.4009 4.96 1500 5.987 0309.1087 10147.0012 4.55 1600 5.765 0309.1202 10147.10064 4.61 1700 20.99 0308.1050 10147.8085 4.58 1800 NIL NIL NIL 4.57 1900 NIL NIL NIL 4.76 2000 5.677 0308.9510 10147.4050 4.98 2100 6.778 0308.9545 10147.6754 4.99 From the experiment at Hutan Lipur (as shown in Table II), the average latitude and longitude is 308.9046 N and 10147.4458 E. Fig. 8 and Fig. 9 show that data was consistent data received from GPS receiver, however once the weather turned cloudy GPS receiver showed failure in obtaining data from the satellites. Once the sky was cleared form heavy, the GPS Location Tracker unit started to receive strong consistent data from the satellites. From this experiment, the cloud was proven to be an obstacle for the GPS Location Tracker unit to receive signal from satellites. Figure 9. Data obtained at longitude of Hutan Lipur,. To measure a distance between two points a set of reference point was selected as a set point to measure distance. have been chosen as a set point. The algorithm have been developed to measure distance but can only measure in 2 decimal points and unit symbol is in meter as display in LCD Display. As shown in Table III and Table IV, the distance was successfully measured with slight percentage error. It gives an average of 90.96% accuracy for calculating distance when compared to actual distance. The difference between measured and actual distance of the two points may be due to the fact that, distance calculated using GPS satellites may consider approximate distance of a straight lines whereas in reality this may not be true. TABLE III. Place UITM Shah Alam IIUM Gombak A SET OF LATITUDE AND LONGITUDE DATA FOR REFERENCE TO MEASURE DISTANCE Theoretical value ( N ) ( E ) Experiment value ( N ) ( E ) 0304.323 10129.9516 0304.3951 10129.8789 0315.0226 10143.9346 0315.1814 10143.9440 Home 0308.3578 10143.8773 0308.3219 10143.8607 80
Hutan Lipur Klang Gate Dam TABLE IV. 0309.122 10147.0476 0308.9626 10147.5059 0313.996 10145.0413 0314.0263 10144.9743 DISTANCE MEASUREMENT FROM ONE POINT TO OTHER POINT One point to other point - IIUM Gombak - Cheras - Hutan Lipur - Klang Gate Dam Cheras Klang Gate Dam Cheras Hutan Lipur Hutan Lipur Klang Gate dam Home Hutan Lipur Klang Gate Dam Theoretical distance in km Experiment distance in km Accuracy in (%) 32.84 27.9908 85.23 27.239 27.8455 97.97 32.934 34.5983 98.98 33.245 31.9147 95.99 10.366 10.766 96.14 6.45 3.3219 51.503 9.732 10.12 89.31 12.68 12.72 99.68 12.619 13.308 94.539 3.0156 2.935 97.327 Figure 10. Percentage of accuracy To measure a distance between one point to another point, it is needed to set a reference point to measure distance. UiTM Shah Alam has been chosen as a set point. The algorithm have been developed to measure the distance but it just could measured in 2 decimal points with a unit symbol in meter as display in LCD. As shown in Table III and Table IV, this experiment was successfully measure distance but is not totally accurate. It gives an average of 90.96% accurate for experiment in calculating distance. As conclusion, it can be assumed that a distance measurement is a straight line from a set of point to another point because of the satellite view. Fig. 10 and Fig. 11 show a comparative plot of actual and measured distances. It gives an average of 10 % accuracy. Figure 11. Distance in theoretical and experiment. V. CONCLUSION This project was successfully implemented and developed the outdoor tracking location unit using GPS FV-M8. As a result, latitude and longitude of any location and distance between two points on the earth are measured with an average accuracy of 90% from actual value. It is recommended that the algorithm can be further improvised to give a better accuracy. REFERENCES [1] Tom Logsdon, Understanding the NAVSTAR GPS, GIS, 1st Ed, 1995. [2] Michael Kennedy, The Global Positioning System and GIS, an Introduction: Ann Arbor Press, 2003. [3] Gilbert Strang and Kai Boore, Linear Algebra, Geodesy and GPS, Fourth Edition: Wellesley-Cambridge Press, 2006. [4] K. Bernstein, K.M. Carrig, Christopher M. Durham, Patrick R. Hansen, David Hogenmiller, Edward J. Nowak, Norman J.Rohrer, High Speed CMOS Design Styles, 3rd Edition: Springer, August 1998. [5] Institute of Navigation, Product Global Positioning System GPS module FV-M8, Fourth Volumes: bible of GPS, 2007. 81