Sunteți pe pagina 1din 44

Detection and Tracking using GSM and GPS technology

CHAPTER ONE

PROJECT OVERVIEW

1|P a g e

Detection and Tracking using GSM and GPS technology CHAPTER ONE

PROJECT OVERVIEW

1.1 Introduction

For centuries, our ancestors have searched the heavens at night for a system that would enable them to locate their position on earth. They built landmarks, detailed maps and learned how to read the stars in the night sky, but today- by the passage of time - things are much changed and very much easier than before, upon entering this modern era of technology the invention of the Global Positioning System (GPS) become more and more serviceable and needed in every day applications. The Global Positioning Satellite (GPS) system is a network of satellites orbiting the earth, which transmits location data back to earth ceaselessly. Using these data and GPS tracking devices, you can pinpoint any object on the earth. For example, GPS vehicle tracking system or GPS fleet tracking system can point out where your stolen vehicle is? Or where your ship sails at present? Main uses of GPS technology are as follows: Location-The first and foremost palpable application of GPS system is the simple determination of a position or location; Navigation-The primary design of GPS tracking system was to provide navigation information for ships and planes; TrackingWith the accurate data provided by the system, monitoring mobile objects or people is not difficult task anymore; Mapping-GPS can help in creating maps and models of everything in the planet. Mapping the earth had never been an easier task; TimingGPS satellites carry highly accurate atomic clocks, and GPS tracking devices here on the ground when synchronized with those in the satellites are themselves atomic accuracy clocks providing accurate time.

2|P a g e

Detection and Tracking using GSM and GPS technology

1.2 Previous Work


GPS tracking systems are used now more than ever before, and are affordable for nearly every budget. Here are just a few of the most popular ways to use GPS tracking systems today. I. Outdoor Sports: What a better way to safely enjoy the beauty of the outdoors than with the security of a GPS tracking system? Allow family members to track your hiking or biking excursion with GPS tracking software, and rest assured knowing that you can be easily located in the event of an emergency. II. Impress Your Customers: In todays world of e-commerce and wireless technology, consumers have come to expect instant access to the information they want and need. GPS tracking systems used to track your customers deliveries can help you provide them with better customer service, and keep them coming back time and time again. III. Track a Teen: Want to know if Junior is really studying at the library? Many parents are now using GPS tracking devices to monitor the driving speeds, and location of their teenagers. IV. Catch a Thief: Protect your business or home by attaching GPS tracking systems to your valuables such as heavy equipment, lawn mowers, and automobiles. V. Track Employees: Want to know if your drivers are effectively managing their time, obeying the rules of the road, or abusing the use of company vehicles? A GPS tracking system and GPS tracking software can quickly give you the answers you need to operate your business as efficiently as possible. VI. Protect a Child: Portable GPS tracking devices are now widely used as an added safety measure for quickly locating children in the event of an

3|P a g e

Detection and Tracking using GSM and GPS technology

emergency. VII. Reduce Insurance Costs: Did you know that many insurance companies now offer significant discounts for those with GPS tracking systems installed on their vehicles? Save money while increasing the safety of drivers! VIII. Protect the Elderly: Help maintain your loved ones independence and safety with the use of a GPS tracking system. IX. Plan Delivery Routes: Save time, payroll costs, and fuel by using a GPS tracking system to cost-effectively plan deliveries, service calls, and speed up response times! X. Give Mom a Break: Know a mom whos continuously worried about her college students safety? Personal GPS tracking devices are increasingly being used by college students everywhere to protect against the recent rise in students as the target of abductors.

1.3 Defining the System


This section contains a brief description of the system functionality.

1.3.1 Main System Operations

Auto-tracking system basically is a system that tracks the vehicle location and speed periodically, the delivered data is sent serially to a processing unit (MC PIC), the processing unit uses this data to do the following operations: I. II. III. To warn the driver if the speed of the vehicle exceeds the speed limits allowed in the street where the vehicle moves. To determine the vehicle exactly location using GPS coordinate. The Received coordinate will compared with stored coordinate in MC PIC and print the vehicle city location at LCD.
4|P a g e

Detection and Tracking using GSM and GPS technology

1.4 System Requirements


1.4.1 Functional Requirements 1.4.2 SystemFunctionalRequirements
I. The system should be able to receive a GPS message every three seconds. 1.1 The GPS receiver receives a Radio Technical Commission for Maritime Services (RTCM) message as an input. 1.2 The GPS receiver generate the special type of National Marine Electrical Association (NMEA) messages which is the Recommended Minimum Specific (RMC) output message, this message contains the time, date, position, course, and speed data. 1.3 Weve chosen the three seconds period; we think its a suitable period to track all vehicle moves and fit. II. The system should be able to warn the driver about his/her speed violation within an acceptable time, so the system should be able to analyze the received messages and filter them to get the useful ones and drop the others . 2.1 after the micro controller received NMEA string data; the processor buffers the message into its own memory. 2.2 The processor then checks if the message is valid or corrupted this is done by checking it with stored string in MC PIC 16f877A. 2.3 Then the processor partitions the message and gets the location coordinate and the speed of the vehicle. 2.4 According to this data (location and speed ) the processor decides what to do with this data (Alarm Message, display it on LCD), if the processor decides to send alarm message the processor has to work on the following steps: - If the Vehicle exceed speed limits and still in the same speed alarm message will send for once time - If the Vehicle speeding a second message will sent. - If the vehicle decreases in speed no alarm message sent will vehicle not parking yet. III. IV. The System should be able to display vehicle location at LCD and displays discover if the vehicle moved out of coverage area. The System have to send clear displayed alarm SMS to the end user.
5|P a g e

Detection and Tracking using GSM and GPS technology

1.4.3 Non-Functional Requirements

I.

Performance The microcontroller should be able to process the 3-seconds regular incoming message from the GPS and be able to analysis these data and display it on LCD

II.

Accuracy Its important for the system to know exactly where it is so it can determine the speed limit and any violations occurrences ,we will do our best in determining the exact location with the error of (-3,3) meters provided by the GPS Receiver.

III.

Reliability The system should be on and available all the time, it must endure the different weather changes

IV.

Usability The system can be installed in the vehicle regardless of its type or manufacturing and we tried to use readable friendly interfaces since the user is not supposed to be a professional.

1.4.4 Major Constraints

1. The system (product) should have a good package design so it can be installed simply in any vehicle. 2. The power consumption has to be taken into consideration. 3. The processor frequency has to be taken into consideration, such that it can process the incoming messages, applying its algorithms, and finish the output stages in an acceptable time. 4. The algorithm that decides if the data is usable or not has to be smart enough so that no redundant or processing unwanted data. 5. The system should have to warn the driver about his speed violation within an acceptable period, hence, he can reduce his speed.

6|P a g e

Detection and Tracking using GSM and GPS technology

1.4.5 System Architecture

Figure(1)SystemArchitecture

GPS: The GPS receiver received a GPS message as an input and deliver it to the main Microprocessor, the main Microprocessor performs an algorithm over this message and the results is delivered to LCD screen. Microprocessor (16f877A): the main microprocessor receives the GPS message and applies the main algorithm on it, based on this algorithm; the microprocessor will do the following tasks: I. Parse the GPS message to extract some values (e.g. longitude, latitude and speed) and use them as the algorithm main parameters. II. Compare the longitude and the latitude with storage data to check on which city the car is traveling and comparing the maximum and minimum allowed speed with the received speed, and then display the status of the car (e.g. Speed, longitude latitude and city location) on LCD screen.

7|P a g e

Detection and Tracking using GSM and GPS technology

III.

Deal with one of the multiple cases that will raise corresponding to the received data from the co-processor: Normal speed: the default state of the system which represent the standard driving condition. Low speed: the speed of the car is lower than the minimum speed on a specific road, and a statement will be shown on the LCD warning the driver of his low speed. High speed: the speed of the car is higher than the maximum speed on a specific road, and a statement will be shown on the LCD warning the driver of his high speed.

MAP:its part of microcontroller contains a storage data for main cities of Jordan and used as assistant part to the Microcontroller to locate the object address. GSM Modem: it is the wireless communication tool used to transmit an alarm messages through global system for mobile network to the transportation manager which he/she also have a GSM modem (Mobile) to received alarm message LEDS: it uses to indicate the system supplied with power and the flash led indicates the microprocessor reads the data from GPS receiver. LCD: To warn the driver about speed violation and display the vehicle location, speed coordinate and also used to alarm the driver an alarm SMS have sent.

8|P a g e

Detection and Tracking using GSM and GPS technology

CHAPTER TWO

SYSTEM
COMPONENTS

9|P a g e

Detection and Tracking using GSM and GPS technology CHAPTER TWO

SYSTEM COMPONENTS

2.1Microcontroller
2.1.1 PIC 16F877A Architecture

PIC refers to Programmable Interface Controller. This powerful (200 nanosecond instruction execution) yet easy-to-program (only 35 single word instructions) CMOS FLASH-based 8-bit microcontroller packs Microchip's powerful PIC architecture into an 40- or 44-pin package and is upwards compatible with the PIC16C5X, PIC12CXXX and PIC16C7X devices. The PIC16F877A features 256 bytes of EEPROM data memory, self programming, an ICD, 2 Comparators, 8 channels of 10bit Analog-to-Digital (A/D) converter, 2 capture/compare/ PWM functions, the synchronous serial port can be configured as either 3-wire Serial Peripheral Interface (SPI) or the 2-wire Inter-Integrated Circuit (IC) bus and a Universal Asynchronous Receiver Transmitter (USART). All of these features make it ideal for more advanced level A/D applications in automotive, industrial, appliances and consumer applications. The core feature includes interrupt capability up to 14 sources, power saving SLEEP mode, and single 5V In-Circuit Serial Programming (ICSP) capability. The sink/source current, which indicates a driving power from I/O port, is high with 25mA. Power consumption is less than 2mA in 5V operating condition.

Figure(2)PIC16F877A

10|P a g e

Detection and Tracking using GSM and GPS technology

2.1.2 Design & Implementation


ClockCircuit

We connect the crystal which is responsible to generate the signal to the OSC1/CLKIN pin. And we need two (22pF) capacitors to be connected to both sides of the crystal, and then connect the other ends of the capacitors to the ground. Crystal options are (4 MHz 20 MHz) and this affect the code, so we need to put set the configuration register in the PIC to High Speed (HS). The capacitors value is related to the crystal used as the following table:
Table1:CrystalCapacitorscompinations

Figure(3)clock

In our system we have chosen 4MHz crystal, that will provide our system with the speed needed and the serial transmission used.

11|P a g e

Det tection and Tracking usin GSM and GPS techno T ng d ology setCircuit Res

The reset circu is implem e uit mented by co onnecting th MCLR* in he the PIC 16F877 to +5V source usin pull-up re 7A ng esistor. CLR* in PIC is active lo so we c C ow, connect the MCLR* pin M n MC to th Vcc. he

Figure(4)resetcircuit e

2.2 LCD (2x D x16)


Liqu Crystal Display (L uid l LCD) cons sists of high contrast and large vie h ewing angle The e. liqu crystal panel cont uid tains a CM MOS cont troller and all nece d essary driv vers whi have low power co ich w onsumption. The cont troller is eq quipped with an interna character generator R h al ROM, char racter gene erator RAM and disp M playing dat RAM. A display functions are ta All y cont trollable by instruction making in y ns nterfacing practical. p LCD modules are availab in a wid range lik 8x1, 8x2 16x1, 16x 20x2, 20x4, D ble de ke 2, x2, 2 40x Here we have used 16x2- that means 2 rows of 16 characters. It is a Hit x4. e d t r . tachi HD44780 com mpatible mo odule, havin 16 pins including 2 pins for b ng backlight. LCD L mod dules withou backlight will have only 14 pin If you are using such LCDs, sim ut t ns. e h mply igno 15th and 16th pins. ore d Our system wi use the LCD as an interface for the driv to outpu the warn r ill n f ver ut nings whe the drive exceeds th maximu allowed speed on a specific loc en er he um cation. The PIC mic crocontroller sends th data to the LCD ports in p r he parallel thro ough the lines l conn nected to po D. ort

12|P a g e

Detection and Tracking using GSM and GPS technology

2.2.1Implementation
PinConnections

The LCD contains 16 pins, the first 14 pins will be used and the last 2 pins are not connected as they are used to be connected to external LEDs for testing. The first pin is connected to the Ground. The second is connected to the +5 voltage source to provide power to the LCD, and the third pin is connected to the Ground. The fourth pin is the register select pin, and it will be attached to pin 20 from the PIC16F877A which is the WR enable pin.
Figure(5)LCDpinconnections

The next pin is the Read/Write signal and it will be connected to pin 21 from the PIC. The sixth pin is the enable pin for the LCD and it will be connected to pin 19 from the PIC 16F877A, which is the RD enable signal. The next 4 pins are from the data bus lines, and they will be connected to the ground. The next 4 pins from the data bus lines are connected to RB4-RB7 respectively from the PIC 16F877A, as they need to receive parallel data from the PIC 16F877A. To send data to the LCD, the Read/Write signal must be low, and so it is connected to the ground, and the enable signal must be enabled high to low, and the RS must be 1 as the data register must be selected.

13|P a g e

Detection and Tracking using GSM and GPS technology

2.3 MAX RS232


RS232 is an asynchronous serial communications protocol, widely used on computers. Asynchronous means it doesnt have any separate synchronizing clock signal, so it has to synchronous itself to the incoming data; doing this by the use of START and STOP pulses. The signal itself slightly unusual for computers, as rather than the normal (0-5) V range, it uses (+12-12)V this is done to improve reliability, and greatly increase the available range it can work over; it isnt necessary to provide this exact voltage swing, and we can actually use PICS (0-5)V voltage swing with a couple of resistors to make a simple RS232 interface which will usually work done, but at our project we dont guaranteed to work with all serial ports. For this reason we use the (MAX RS232) chip, this chip specially designedfor interfacing between 5V logic levels and +12/-12V of RS232, it generates +12/-12V internally using capacitor charge pumps, and includes four converters, two transmitters and two receivers.

2.3.1Implementation
Pin connections The MAX RS232 contains 16 pins, the first and third pins is connected by (1uF capacitor), and the fourth and fifth pins is connected by (1uF capacitor) too. The second pin is connected with Vcc by (1uF capacitor) while the sixth pin is connected to the Ground by (1uF capacitor). The pin number 15 is connected to the circuits Ground and the pin number 16 is connected to the Vcc.

14|P a g e

Det tection and Tracking usin GSM and GPS techno T ng d ology

The pin numbe 11 (T1-in is the inp pin and it will be c e er n) put d connected t to the output pin 25 from the PIC 1 n 16F877A, the pin 14 (T1-out) i t is conn nected to th GSM mo he odem by R RS232 cable and finall the pin 12 e, ly (R1-out) from the MAX R RS232 is connected to the input pin 26 from o m 77A, and t pin 13 (R1-in) is connected to the GP the PS the PIC 16F87 rece eiver.

Figu ure(6)MAXRS232pinconnections o

2.4 GSM mo M odem


Tan (55i) wa the best choice for o project to send SM alarm ngo as our MS to s specific pho number which su one rs, upports man features services ny for o project and these a our are: n uencies rang ges900/1800 0/1900 MH Hz. Work on three frequ Serial int terface RS2 for AT c 232 commands. SIM card reader: Sm SIM ca d mall ards.

15|P a g e

Detection and Tracking using GSM and GPS technology

2.5 GPS Simulator


In our project we used program software installed in PC work as GPS receiver, the program emulates the operation of a GPS receiver (position, speed of relocation, reception quality, and satellite constellation) and gives out GPS data based on the NMEA-0183 protocol v. 2.0, 2.1, 2.3 or 3.0. This virtual GPS receiver can work without visible GPS satellites, thus it's much more efficient when used indoors. Besides, purchasing the program costs less, than purchasing a GPS receiver. The program can be configured for getting certain NMEA protocol messages in a certain sequence with a certain frequency. The output NMEA protocol can be written to a file or transmitted via COM port. Any program or equipment working with the NMEA protocol will recognize transmitted messages, created by the GPS Generator, as data from a real receiver. A certain amount of parity errors (CRC) can be introduced in the generated protocol. The program supports several operation modes, and it can give out output data to a COM port (including a virtual one) or save to a file. The saved file can also be replayed providing an opportunity for creating repeatable work scenarios, which would be difficult to do with an actual GPS receiver.

16|P a g e

Det tection and Tracking usin GSM and GPS techno T ng d ology

Figure(7) Th main prog he gram window w

17|P a g e

Detection and Tracking using GSM and GPS technology

Figure(8)Theschematicoftheproject

18|P a g e

Detection and Tracking using GSM and GPS technology

CHAPTER THREE

SOFTWARE

19|P a g e

Detection and Tracking using GSM and GPS technology CHAPTER THREE

SOFTWARE

3.1 Introduction
Software its the core communication language between the input/output of the microcontroller gates and its also the interface language with microcontroller and other devices.

3.2 PIC Programming


As we mentioned earlier, we have used the PIC microcontroller. PICs can be programmed by: Assembly Language: PIC assembly language is the lowest-level programming language for Microchip PIC Microcontrollers. Its assembly language contains only 35 instructions, easy to learn, easy to use. C language: PIC microcontrollers can be programmed using C language too, because of the present of compilers such as (MikroC, PIC C) that convert the C syntax and codes to its appropriate assembly language. Frankly, we have used the C language to program our system, because our system is large enough to be not written in the assembly language, and because of the facilities that integrated with such compilers.

20|P a g e

Det tection and Tracking usin GSM and GPS techno T ng d ology

3.2 2.1Deve elopme entTool ls


PIC C Compile C er

We have used t Pic C compiler w the which has th following features: he g Deta ailed statistic about the usage of th RAM, EEPROM, et cs e he tc. Built Librarie that helps reduce the code and simplify the process of the t-in es e e initia alization of the comp f ponents used from th PIC su he uch as USA ART (Universal Seria Asynchro al onous Recei iver/Transm mitter). ugger with m many advan nced option ns. Debu Adva anced code assistant. Code explorer. e

Fig gure(9)PICC Ccompiler

21|P a g e

Det tection and Tracking usin GSM and GPS techno T ng d ology Pr roteus (Simulation Too ol)

Prot teus is a sim mulation too used to d ol design and build schem b matics, altho ough it supp ports man compone we have used such as (PIC), so we can si ny ents h s imulate the functionalit of ty our code on the simulator before burn it on the PIC. e n P

Figure(1 10)ProteusS Simulator

Usin Proteus we can si ng s imply simul serial devices such as GPS Re late d h eceiver and PIC with virtual te h erminal, so we can s o send and re eceive to te our prog est gram & de esign func ctionality.

22|P a g e

Detection and Tracking using GSM and GPS technology

3.3 Code Segments


This figure shows the main code segments that represent the basic functionality of our system. These parts are dependent and may use shared variables (global) and common functions. Because of the limitation provided by the PIC such as limited stack, we forced to use structural programming approach sometimes to avoid stack overflow. Each statement written in PIC-C may be parsed to more than ten assembly instructions.

Figure(11)CodeSegment 23|P a g e

Detection and Tracking using GSM and GPS technology

3.3.1 PSEUDO CODES (Program Description Language PDL)


START #INITIALIZEPICTYPE #DEFINEbaudrate #INITIALIZINGRS232CABLE #ENABLEINTERUBTS INITIALIZINGLCD(2x16) INABLEINTERRUBTS DEFINEvariables VOIDMAIN() PRINTWELCOMEMSG #INITIALIZINGGSMmodem DOFOREVER WAITUNTELCHARACTERRECEIVED //////MSGPARSE////// IFreceivedcharacter=$GPRMCTHEN PUCHINTOTHEmessagearray INDEX=0 READRECEIVEDCHARACTER SWITCH(INDEX) CASE(3): STORElongitudecoordinate Break; CASE(5): STORElatitudecoordinate Break; CASE(7): STOREspeed //////speedlimits////// If(speed<12km/hANDspeed>120km/h)THEN PRINTLCD(alarmmessage) CALLALARMSMS //////SMSType////// Longitude=varlongitude Latitude=varlatitude Speed=varspeed Country:Jordan City:varCity 24|P a g e

Detection and Tracking using GSM and GPS technology ELSE PRINTLCD(location,speed,coordinate) ENDIF Break; ENDDO ELSE PRINTloading ENDIF ENDDO END

3.3.2 Programming Language (indirect connection)


The PIC C compiler is designed to be compatible for compiling program code from high level language into low level language machine language, it is also interfacing language between GPS protocol language NMEA and GSM protocol Language AT-Commands to make open communication channels through RS232 Cable between GPS and GSM network this type of connection called indirect connection.

ObjectCode Clanguage

Compiler

Compiling File.hex

Installatio

InterfacingDevice Pic16f877a

GPSReceiver Parallax module

RS232

Programmed Device Pic16f877a

RS232

GSMModem Tango055

Figure(12)IndirectInterface

GPS protocol Language The GPS Receiver Module provides standard, raw NMEA0183 (National Marine Electronics Association) strings or specific user-requested data via the serial command interface, tracking of up to 12 satellites, and WAAS/EGNOS (Wide Area Augmentation System/European Geostationary Navigation Overlay Service) functionality for more accurate positioning results.
25|P a g e

Detection and Tracking using GSM and GPS technology

The Module provides current time, date, latitude, longitude, altitude, speed, and travel direction/heading, among other data, and can be used in a wide variety of hobbyist and commercial applications, including navigation, tracking systems, mapping, fleet management, auto-pilot, and robotics. The NMEA0183 is provided as a series of comma-delimited ASCII strings, each preceded with an identifying header. The data is transmitted as a 4800bps string of 8bit ASCII characters. Thus, any microcontroller with a serial port can extract data from a GPS module. But, modules do not produce "plain text" location information. Instead, they create standardized "sentences," such as:
$GPGGA,170834,4124.8963,N,08151.6838,W,1,05,1.5,280.2,M, 34.0,M,,,*75 $GPGSA,A,3,19,28,14,18,27,22,31,39,,,,,1.7,1.0,1.3*34 $GPGSV,3,2,11,14,25,170,00,16,57,208,39,18,67,296,40,19,40,246,00*7 4 $GPRMC,220516,A,5133.82,N,00042.24,W,173.8,231.8,130694,004.2,W *70

In our project the NMEA string we have recommended to use is RMC string witch support PVT (position, velocity, Time) data which exactly looking for and it is look similar to:
$GPRMC,123519,A,4807.038,N,01131.000,E,022.4,084.4,230394,003.1,W *6A Where: RMC :RecommendedMinimumsentenceC 123519 :Fixtakenat12:35:19UTC A :StatusA=activeorV=Void. 4807.038,N :Latitude48deg07.038'N 01131.000,E :Longitude11deg31.000'E 022.4 :Speedoverthegroundinknots 084.4 :TrackangleindegreesTrue 230394 :Date23rdofMarch1994 003.1,W :MagneticVariation *6A :Thechecksumdata,alwaysbeginswith* 26|P a g e

Detection and Tracking using GSM and GPS technology The Microcontroller programmed to receive RMC string Data and parsing it using the examplecodeprovidedasbellow: #include<18f452.h> //DEFINEDEVICETYPE #usedelay(clock=20000000) //DEFINE20MHzCLOCK #include<lcd.c> //DEFINELCDLIBRARY #include<string.h> #include<stdlib.h> #users232(baud=9600,xmit=PINC6,rcv=PINC7,ERRORS) //RS232INITIALIZING #ZERORAM //CLEARRAM //VariablesandArraysdefinition staticcharRX[80],s1[10],s2[12],s3[12],speed[12],string[80]; staticint8i; staticint8ff=0; //RS232receivedataavailable //$GPRMC,035249.06,A,0000.018,N,00000.000,E,21.00,0.00,040610,0.0,E,A*05 #intrda//(ISR)InterruptServiceRoutineDeclaration voidserialisr() { RX[i++]=getch();//ReceivedatafromRS232 ff=1; } ///////////////////////////Main///////////////////////////////// voidmain() //MainStartprograme { lcdinit(); //InitializingLCD ff=0; //Returnflag0 outputhigh(pina1); //RedLedindicatethesiystemonstate lcdputc("\fAutoTrackingSystem\n"); lcdputc("Graduatedproject2010"); delayms(1500); //$GPRMC,211230.49,A,3058.865,N,03528.388,E,25.09,54.10,040610,0.0,E,A*06 enableinterrupts(GLOBAL); //Enableinterrupts enableinterrupts(INTRDA); //EnableRS232interrupt while(true) { if(ff=1); //Interruptsubroutine { intjj,a; intk=0; intl=0; 27|P a g e

Detection and Tracking using GSM and GPS technology inte; intd=0; //printf("%s",RX); //printf("\r\n"); strcpy(string,RX); a=strlen(string); for(jj=0;jj<=a;jj++) { if(jj>18&&jj<27) { s1[k]=RX[jj]; k++; } if(jj>29&&jj<39) { s2[l]=RX[jj]; l++; } if(jj>41&&jj<47) { speed[d]=RX[jj]; d++; } } printf("%s",s1); printf("|"); printf("%s",s2); printf("|"); printf("%s",speed); printf("|\r\n"); delayms(3000); ff=0; i=0; } } }

//STORERECEVEDDATAONSTRING //CALCULATESTRINGLINGTH //GET$GPRMCSTRIG //GETOBJECTLATITUDE //STORERESULTINS1ARRAYASSTRING

//GETOBJECTLONGTITUDE //STORELONGTITUDEINS2ARRAYASSTRING

//GETOBJECTSPEED //STORESPEEDINSPEEDARRAYASSTRING

//END //PRINTARRAYS1 //PRINTARRAYS2

//PRINTARRAYSPEED

//endif //while //endmain

The result data will be calculated and compared with stored data on PIC memory. The Output will look like :
0000.018|00000.000|21.00 28|P a g e

Detection and Tracking using GSM and GPS technology

GSM protocol Language (Command Line) Commands always start with AT (which means Attention) and finished with <CR> character, the AT commands responses start and ends with <CR><LF>. The Response of GSM modem to the received command: - If command syntax is incorrect, an ERROR string return. - If command syntax is correct but with some incorrect parameters, the +CME ERROR: <Err> or +CMS ERROR:<SmsErr> string are returns with different error codes. - If the command line has been performed successfully, an OK string is returned.

29|P a g e

Detection and Tracking using GSM and GPS technology

CHAPTER FOUR

GPS
TECHNOLOGY

30|P a g e

Detection and Tracking using GSM and GPS technology CHAPTER FOUR

GPS TECHNOLOGY

4.1 GPS Definition


The Global Positioning System (GPS) is a worldwide radio-navigation system formed from a constellation of 24 satellites and their ground stations. GPS uses these as reference points to calculate positions accurate to a matter of meters. In fact, with advanced forms of GPS you can make measurements to better than a centimeter! In a sense it's like giving every square meter on the planet a unique address. GPS receivers have been miniaturized to just a few integrated circuits and so are becoming very economical. And that makes the technology accessible to virtually everyone. These days GPS is finding its way into cars, boats, planes, construction equipment, movie making gear, farm machinery, even laptop computers.

4.1.1 Advanced Forms of GPS


The quest for greater and greater accuracy has spawned an assortment of variations on basic GPS technology. One technique, called "Differential GPS," involves the use of two ground-based receivers. One monitors variations in the GPS signal and communicates those variations to the other receiver. The second receiver can then correct its calculations for better accuracy. Another technique called "Carrier-phase GPS" takes advantage of the GPS signal's carrier signal to improve accuracy. The carrier frequency is much higher than the GPS signal which means it can be used for more precise timing measurements.

31|P a g e

Detection and Tracking using GSM and GPS technology

The aviation industry is developing a type of GPS called "Augmented GPS" which involves the use of a geostationary satellite as a relay station for the transmission of differential corrections and GPS satellite status information. These corrections are necessary if GPS is to be used for instrument landings. The geostationary satellite would provide corrections across an entire continent.

4.2 How GPS works?


Here's how GPS works in five logical steps: 1. The basis of GPS is "Trilateration*" from satellites. 2. To Trilateration" a GPS receiver measures distance using the travel time of radio signals. 3. To measure travel time, GPS needs very accurate timing which it achieves with some tricks. 4. Along with distance, you need to know exactly where the satellites are in space. High orbits and careful monitoring are the secret. 5. Finally you must correct for any delays the signal experiences as it travels through the atmosphere.

* Trilateration is a method of determining the relative positions of objects using the geometry of
triangles.

32|P a g e

Detection and Tracking using GSM and GPS technology

4.2.1 Generating GPS signal


28 satellites inclined at 55 to the equator orbit the Earth every 11 hours and 58 minutes at a height of 20,180 km on 6 different orbital planes.

Figure(13)GPSsatellitesorbittheEarthon6orbitalplanes[1]

Each one of these satellites has up to four atomic clocks on board. Atomic clocks are currently the most precise instruments known, losing a maximum of one second every 30,000 to 1,000,000 years. In order to make them even more accurate, they are regularly adjusted or synchronized from various control points on Earth. Each satellite transmits its exact position and its precise on board clock time to Earth at a frequency of 1575.42MHz.These signals are transmitted at the speed of light (300,000 km/s) and therefore require approx. 67.3ms to reach a position on the Earths surface located directly below the satellite. The signals require a further 3.33 us for each excess kilometer of travel. If you wish to establish your position on land (or at sea or in the air), all you require is an accurate clock. By comparing the arrival time of the satellite signal with the on board clock time the moment the signal was emitted, it is possible to determine the transit time of that signal.

33|P a g e

Detection and Tracking using GSM and GPS technology

Figure(14)Determiningthetransittime[1]

The distance S to the satellite can be determined by using the known transit time :

Distance=traveltimethespeedoflight S= c

Measuring signal transit time and knowing the distance to a satellite is still not enough to calculate ones own position in 3D space. To achieve this, four independent transit time measurements are required. It is for this reason that signal communication with four different satellites is needed to calculate ones exact position.

4.2.2 Determining a position on a plane


Imagine that you are wandering across a vast plateau and would like to know where you are. Two satellites are orbiting far above you transmitting their own on board clock times and positions. By using the signal transit time to both satellites you can draw two circles with the radii S1 and S2 around the satellites. Each radius corresponds to the distance calculated to the satellite. All possible distances to the satellite are located on the circumference of the circle. If the position above the satellites is excluded, the location of the receiver is at the exact point where the two circles intersect beneath the satellites, Two satellites are sufficient to determine a position on the X/Y plane.

34|P a g e

Detection and Tracking using GSM and GPS technology

Figure(15)Thepositionofthereceiverattheintersectionofthetwocircles[2]

In reality, a position has to be determined in three-dimensional space, rather than on a plane. As the difference between a plane and three-dimensional space consists of an extra dimension (height Z), an additional third satellite must be available to determine the true position. If the distance to the three satellites is known, all possible positions are located on the surface of three spheres whose radii correspond to the distance calculated. The position sought is at the point where all three surfaces of the spheres intersect.

Figure(16)Thepositionisdeterminedatthepointwhereallthreespheresintersect[3]

35|P a g e

Detection and Tracking using GSM and GPS technology

4.3 GPS Receiver


GPS receivers require different signals in order to function. These variables are broadcast after position and time have been successfully calculated and determined. To ensure that the different types of appliances are portable there are either international standards for data exchange (NMEA and RTCM), or the manufacturer provides defined (proprietary) formats and protocols.

4.3.1 Basic design of a GPS module


GPS modules have to evaluate weak antenna signals from at least four satellites, in order to determine a correct three-dimensional position. A time signal is also often emitted in addition to longitude, latitude and height. This time signal is synchronized with UTC (Universal Time Coordinated). From the position determined and the exact time, additional physical variables, such as speed and acceleration can also be calculated. The GPS module issues information on the constellation, satellite health, and the number of visible satellites etc.

36|P a g e

Detection and Tracking using GSM and GPS technology

4.3.2 Data interfaces


The NMEA-0183 data interface In order to relay computed GPS variables such as position, velocity, course etc. to a peripheral (e.g. computer, screen, and transceiver), and GPS modules have a serial interface (TTL or RS-232 level). The most important elements of receiver information are broadcast via this interface in a special data format. This format is standardized by the National Marine Electronics Association (NMEA) to ensure that data exchange takes place without any problems. Nowadays, data is relayed according to the NMEA-0183 specification. NMEA has specified data sets for various applications e.g. GNSS (Global Navigation Satellite System), GPS, Loran, Omega, Transit and also for various manufacturers. The following seven data sets are widely used with GPS modules to relay GPS information: 1. GGA (GPS Fix Data, fixed data for the Global Positioning System) 2. GLL (Geographic Position Latitude/Longitude) 3. GSA (GNSS DOP and Active Satellites, degradation of accuracy and the number of active satellites in the Global Satellite Navigation System) 4. GSV (GNSS Satellites in View, satellites in view in the Global Satellite Navigation System) 5. RMC (Recommended Minimum Specific GNSS Data) 6. VTG (Course over Ground and Ground Speed, horizontal course and horizontal velocity) 7. ZDA (Time & Date)

Structure of the NMEA protocol In the case of NMEA, the rate at which data is transmitted is 4800 Baud using printable 8-bit ASCII characters. Transmission begins with a start bit (logical zero), followed by eight data bits and a stop bit (logical one) added at the end. No parity bits are used.

37|P a g e

Detection and Tracking using GSM and GPS technology

Figure(17)NMEAformat(TTLandRS232level)[6]

The different levels must be taken into consideration depending on whether the GPS receiver used has a TTL or RS-232 interface. In the case of a TTL level interface, a logical zero corresponds to approx. 0V and a logical one roughly to the operating voltage of the system (+3.3V ... +5V) In the case of an RS-232 interface a logical zero corresponds to a positive voltage (+3V ... +15V) and a logical one a negative voltage (-3V ... 15V). If a GPS module with a TTL level interface is connected to an appliance with an RS-232 interface, a level conversion must be effected. A few GPS modules allow the baud rate to be increased (up to 38400 bits per second). RMC data set The RMC data set (Recommended Minimum Specific GNSS) contains information on time, latitude, longitude and height, system status, speed, course and date. This data set is relayed by all GPS receivers. An example of an RMC data set:
$GPRMC,130304.0,A,4717.115,N,00833.912,E,000.04,205.5,200601,01.3,W*7C<CR><LF>

38|P a g e

Detection and Tracking using GSM and GPS technology

The function of the individual characters or character sets is explained in the Table below.

Description of the individual RMC data set blocks

39|P a g e

Detection and Tracking using GSM and GPS technology

CHAPTER FIVE

GSM
TECHNOLOGY

40|P a g e

Detection and Tracking using GSM and GPS technology CHAPTER FIVE

GSM TECHNOLOGY

5.1 What is GSM?


Global System for Mobile Communications (GSM) is a digital cellular radio network operating in over 200 countries world-wide. It provides almost complete coverage in Western Europe, and growing coverage in the Americas, Asia and elsewhere. Of special interest is the capability of the GSM network to be used for data computing. Most people think of voice calls when they think of cellular phones. But because GSM is digital, GSM-enabled phone can be connected to a computer and send or receive e-mail, faxes, browse the Internet, and use other digital data features including Short Messaging Service. The unique roaming features of GSM allow cellular subscribers to use their services in any GSM service area in the world in which their provider has a roaming agreement that means the phone used in Jordan could work in Germany, Australia, Finland and even China, depending on the providers roaming agreements. GSM-enabled phones have a "smart card" inside called the Subscriber Identity Module (SIM). The SIM card is personalized to the person alone. It identifies the account to the network and provides authentication. Short Message Service (SMS) is an integrated paging service that lets GSM cellular subscribers send and receive data right on their cellular phone's light emitter diode(LED)display up to a maximum of 160 characters. The structure of an SMS message includes the mobile number the message is originating from, time, date, country code, length and the actual message.

41|P a g e

Detection and Tracking using GSM and GPS technology

5.2 GSM modem


A GSM modem is a wireless modem that works with a GSM wireless network. A wireless modem behaves like a dial-up modem. The main difference between them is that a dial-up modem sends and receives data through a fixed telephone line while a wireless modem sends and receives data through radio waves. A GSM modem can be an external device or a PC Card / PCMCIA Card. Typically, an external GSM modem is connected to a computer through a serial cable or a USB cable. A GSM modem in the form of a PC Card / PCMCIA Card is designed for use with a laptop computer. It should be inserted into one of the PC Card / PCMCIA Card slots of a laptop computer. Like a GSM mobile phone, a GSM modem requires a SIM card from a wireless carrier in order to operate. Computers use AT commands to control modems. Both GSM modems and dial-up modems support a common set of standard AT commands. In addition to the standard AT commands, GSM modems support an extended set of AT commands. These extended AT commands are defined in the GSM standards. With the extended AT commands, you can do things like:

Reading, writing and deleting SMS messages. Sending SMS messages. Monitoring the signal strength. Monitoring the charging status and charge level of the battery. Reading, writing and searching phone book entries.

The number of SMS messages that can be processed by a GSM modem per minute is very low, only about six to ten SMS messages per minute.

42|P a g e

Detection and Tracking using GSM and GPS technology

5.3 SMS messaging


SMS stands for Short Message Service. It is a technology that enables the sending and receiving of messages between mobile phones. SMS first appeared in Europe in 1992. It was included in the GSM (Global System for Mobile Communications) standards right at the beginning. Later it was ported to wireless technologies like CDMA and TDMA. The GSM and SMS standards were originally developed by ETSI. ETSI is the abbreviation for European Telecommunications Standards Institute. Now the 3GPP (Third Generation Partnership Project) is responsible for the development and maintenance of the GSM and SMS standards. As suggested by the name "Short Message Service", the data that can be held by an SMS message is very limited. One SMS message can contain at most 140 bytes (1120 bits) of data, so one SMS message can contain up to:

160 characters if 7-bit character encoding is used. (7-bit character encoding is suitable for encoding Latin characters like English alphabets.) 70 characters if 16-bit Unicode UCS2 character encoding is used. (SMS text messages containing non-Latin characters like Chinese characters should use 16-bit character encoding.)

SMS text messaging supports languages internationally. It works fine with all languages supported by Unicode, including Arabic, Chinese, Japanese and Korean. Besides text, SMS messages can also carry binary data. It is possible to send ringtones, pictures, operator logos, wallpapers, animations, business cards (e.g. VCards) and WAP configurations to a mobile phone with SMS messages. One major advantage of SMS is that it is supported by 100% GSM mobile phones. Almost all subscription plans provided by wireless carriers include inexpensive SMS messaging service. Unlike SMS, mobile technologies such as WAP and mobile Java are not supported on many old mobile phone models.

43|P a g e

Detection and Tracking using GSM and GPS technology

References:
[1] GPS Basics Introduction to the system Application overview Zuercherstrasse68 CH-8800Thalwil Switzerland [2] Global Positioning System, Standard Positioning System Service, Signal Specification, 2nd Edition, 1995, [3] GPS Standard Positioning Service Signal Specification, 2nd Edition, June 2, 1995 [4] Jan A. Audestad. Network aspects of the GSM system. In EUROCON 88, June 1988 [5] DavidCheeseman. The pan-European cellular mobile radio system. In R.C.V. Macario, editor, Personal and Mobile Radio Systems. Peter Peregrinus, London, 1991. [6] http:// www.trimble.com/gps/howgps-timing.shtml [7] C. Watson. Radio equipment for GSM. In D. M. Balston and R.C.V. Macario, editors, Cellular Radio Systems. Artech House, Boston, 1993. [8] http:// www.labcenter.co.uk [9] http://www.proteuslite.com/register/ipmbundle.htm. [10] Programming 8bit microcontroller in C with interactive hardware simulation.Martin.P.Bates

44|P a g e

S-ar putea să vă placă și