Project: Chapter One
Project: Chapter One
Project: Chapter One
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
3|P a g e
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.
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
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. 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
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
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
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
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
12|P a g e
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
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
15|P a g e
16|P a g e
Det tection and Tracking usin GSM and GPS techno T ng d ology
17|P a g e
Figure(8)Theschematicoftheproject
18|P a g e
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.
20|P a g e
Det tection and Tracking usin GSM and GPS techno T ng d ology
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
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
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
Figure(11)CodeSegment 23|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
ObjectCode Clanguage
Compiler
Compiling File.hex
Installatio
InterfacingDevice Pic16f877a
RS232
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
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; } } }
//GETOBJECTLONGTITUDE //STORELONGTITUDEINS2ARRAYASSTRING
//GETOBJECTSPEED //STORESPEEDINSPEEDARRAYASSTRING
//PRINTARRAYSPEED
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
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
CHAPTER FOUR
GPS
TECHNOLOGY
30|P a g e
Detection and Tracking using GSM and GPS technology CHAPTER FOUR
GPS TECHNOLOGY
31|P a g e
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.
* Trilateration is a method of determining the relative positions of objects using the geometry of
triangles.
32|P a g e
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
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.
34|P a g e
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
36|P a g e
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
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
The function of the individual characters or character sets is explained in the Table below.
39|P a g e
CHAPTER FIVE
GSM
TECHNOLOGY
40|P a g e
Detection and Tracking using GSM and GPS technology CHAPTER FIVE
GSM TECHNOLOGY
41|P a g e
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
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
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