Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 58

A Project Report On Vehicle Tracking System Using GPS and GSM Submitted for the partial fulfillment for

the degree of Bachelor of Engineering In Information Technology

Submitted By Harsh Vardhan Pundhir (IT,09/5228) Kapil Bhadada (IT,09/8679)

Guide: Sh(Dr.) Alok Singh Gehlot Assistant Professor

Department of Computer Science and Engineering MBM Engineering College, Faculty of Engineering, Jai Narain Vyas University, Jodhpur (Rajasthan) 2012-13

Page 1 of 59
Vehicle Tracking System

CERTIFICATE

This is to certify that report entitled Vehicle Tracking System using GPS and GSM modem submitted to Department of Computer Science and Engineering, MBM Engineering College, JNV University in partial fulfillment of the requirements for the award of the degree of BE. in Information Technology is the bonafide record of the work done by group members Harsh Vardhan Pundhir(IT), Kapil Bhadada(IT) under my supervision and guidance.

Sh. Alok Singh Gehlot (Assistant Professor)

Page 2 of 59
Vehicle Tracking System

DECLARATION
Where by declare that this project titled Vehicle tracking System using GPS and GSM modem is a record of original work done by me under the supervision and guidance of Sh. Alok Singh Gehlot. We further certify that this

Degree/Diploma/Associate ship/Fellowship or similar work has not formed the basis for the award of the Degree work to any candidate of any university and no part of this report is reproduced as it is from any other source without seeking permission.

Harsh Vardhan Pundhir(IT,09/5228) Kapil Bhadada(IT,09/8679)

Page 3 of 59
Vehicle Tracking System

ACKNOWLEDGEMENT
Acknowledgement is not mere formality as its the usual notion. It is the only way through which we can connote our deep and profound gratitude to the persons who directly or indirectly contributed to the work. First and foremost, I wish to acknowledge the encouragement received from Dr.K.R.Chowdhary (HOD, Computer Science & Engineering Department, MBM Engineering College, Jodhpur) for initiating my interest in project for practical knowledge. I earnestly acknowledge my profound sense of gratitude to Sh. Alok Singh Gehlot (Assistant Professor).Under whose supervision I have been able to complete the project. His mastery and work helped me in covering out this work smoothly. I am also grateful to staff of department who have helped me to improve practical knowledge, kind support and information. Finally, I wish to add that I am incepted to God & my Parents, family for everything good that has happened to me.

Harsh Vardhan Pundhir(IT,09/5228) Kapil Bhadada(IT,09/8679)

Page 4 of 59
Vehicle Tracking System

Introduction Of Vehicle Tracking System

Chapter-1 Introduction of Vehicle Tracking System


1.1 ABSTRACT Vehicle Tracking System is a method used to track the location of the any vehicle around the globe. This Project is proposed to design an embedded system which is used for tracking and positioning of any vehicle and implemented using Global Positioning System (GPS) and Global system for mobile communication (GSM). Vehicle Tracking System has become a necessity for business owners around the globe trying to manage a fleet. This is used to locate the cars, motor bikes or any vehicles. The focus of a GPS based vehicle Tracking System is to make use of the knowledge of vehicles location and apply its network attributes such as the stops, timing, available alternative emergency routes and other such constraints in order to optimize opportunities for productivity and cost reduction. It comprises of integration between GPS receiver, microcontroller and GSM module. This vehicle tracking system is integration of two systems which is coordinated by GPS receiver controller and controlled by users using command interfaces through GSM module as a transmitter and receiver of data. This project can be divided into two main parts which are hardware and software development. The hardware development include the GPS and the microcontroller wiring connection, and its integration with the GSM modem. The software development includes develop the microcontrollers source code, GSM message command and NMEA protocol command.

1.2 OBJECTIVE The main aim of the project is to design and develop an advanced vehicle tracking system in the real time environment. When the request by user is sent to the number at the modem, the system automatically sends a return reply to that mobile indicating the position of the vehicle. The user can send a STATUS message from his cellphone and as soon as the GSM module gets the message, it will check for the users authentication and if found to be valid, it will immediately send the details of the locations like the latitude and the longitude using GPS module. So the user can get to know the exact location of the vehicle.

Developing Automatic Vehicle Location system using GPS for positioning information and GSM/GPRS or information transmission with following features.
Page 5 of 59
Vehicle Tracking System

Introduction Of Vehicle Tracking System

Acquisition of vehicles location information (latitude longitude) after specified time interval. Transmission of vehicles location and other information (including ignition status, door(open/close status) to the monitoring station/Tracking server after specified interval of time. Developing a web based software to display all transmitted information to end user along with displaying location of vehicle on a map. The objective of the project is to build an additional feature to the present security system that will warn the owner of the vehicle by sending SMS when there has been an intrusion into the vehicle. To provide a solution to avoid car stolen in the lower cost than advance security car system. (GPS)

1.3 Working of VTS In this project ATmega128 microcontroller is used for interfacing to various hardware peripherals. The current design is an embedded application which will continuously monitor the position of vehicle and report the status of the Vehicle on demand . For doing so an ATmega128 microcontroller is interfaced serially to a GSM Modem and GPS Receiver. Intially, the GPS module will continuously receive the data i.e. the latitude and longitude indicating the position of the vehicle from the satellite and stores the latitude and longitudinal positions in microcontrollers buffer. The GPS modem gives many parameters as the output, but only the NMEA data coming out is read and given to microcontroller through serial interface. After processing of the data provided by GPS receiver, microcontroller transmits this information to remote location using GSM modem. Microcontroller controls the operation of GSM modem through serial interface using AT commands. When the request by user is sent to the number at the modem, it gets activated by receiving our message. At the same instant the GPS gets deactivated with the help of controller. . As soon as the GSM gets activated it takes the last received latitude and longitude positions from the buffer and sends a message to the particular number which is executed in the program. After the message has been sent to the user the GSM gets deactivated and similarly the GPS gets activated. This is a cyclic process .An EEPROM is used to store the mobile number. The hardware interfaces to microcontroller are GSM modem and GPS Receiver. The design uses RS-232 protocol for serial communication between the modems and the microcontroller. A serial driver IC is used for converting TTL voltage levels to RS-232 voltage levels. .

Page 6 of 59
Vehicle Tracking System

Introduction Of Vehicle Tracking System

1.4 BLOCK DIAGRAM

Page 7 of 59
Vehicle Tracking System

Introduction Of Vehicle Tracking System

Fig: Connection Diagram

Page 8 of 59
Vehicle Tracking System

Introduction Of Vehicle Tracking System

1.5 Flow Chart of Vehicle Tracking System

Page 9 of 59
Vehicle Tracking System

Introduction Of Vehicle Tracking System

1.6 CIRCUIT DIAGRAM

Page 10 of 59
Vehicle Tracking System

Introduction Of Vehicle Tracking System

1.7 CIRCUIT OPERATION

The project is vehicle positioning and navigation system we can locate the vehicle around the globe with ATmega128 micro controller, GPS receiver, GSM modem, MAX 232 and EEPROM. The code is written in the internal memory of Microcontroller i.e. ROM. With help of instruction set it processes the instructions and it acts as interface between GSM and GPS with help of serial communication. GPS always transmits the data and GSM transmits and receive the data. GPS pin TX is connected to microcontroller RX pin via MAX232 connector. GSM pins TX and RX are connected to microcontroller serial ports alternatively, that is TX to RX and RX to TX. Microcontroller communicates with the help of serial communication. First it takes the data from the GPS receiver and then sends the information to the owner in the form of SMS with help of GSM modem. GPS receiver works on 9600 baud rate is used to receive the data from space Segment (from Satellites), the GPS values of different satellites are sent to microcontroller ATmega128, where these are processed and forwarded to GSM. At the time of processing GPS receives only $GPRMC values only. From these values microcontroller takes only latitude and longitude values excluding time, altitude, name of the satellite, authentication etc. E.g. LAT: 1728:2470 LOG: 7843.3089 GSM modem with a baud rate 57600. GSM is a Global system for mobile communication in this project it acts as a SMS Receiver and SMS sender. EEPROM is an Electrically Erasable read only memory which stores is used to store the mobile number. The power is supplied to components like GSM, GPS and Micro control circuitry using a 12V/3.2A battery .GSM requires 12v,GPS and microcontroller requires 5v .with the help of regulators we regulate the power between three components. Crystal oscillator is used in the circuit to initiate the microcontroller with the frequency of 10Mhz. . 1.7 HARDWARE REQUIREMENTS

GPS module 634R GSM modem SIMCOM300 ATmega128 Microcontroller MAX232 RS232

Page 11 of 59
Vehicle Tracking System

Introduction Of Vehicle Tracking System

1.8 SOFTWARE REQUIREMENT

AVR studio Embedded C br@ys++ terminal

Page 12 of 59
Vehicle Tracking System

Introduction Of Vehicle Tracking System

Page 13 of 59
Vehicle Tracking System

Micro-Controller

Chapter-2 MICROCONTROLLER 2.1 EMBEDDED SYSTEMS:


An embedded system is a system which is going to do a predefined specified task and is even defined as combination of both software and hardware. A general-purpose definition of embedded systems is that they are devices used to control monitor or assist the operation of equipment, machinery or plant. "Embedded" reflects the fact that they are an integral part of the system. At the other extreme a general purpose computer may be used to control the operation of a large complex processing plant, and its presence will be obvious. All embedded systems are including computers or microprocessors. Some of these computers are however very simple systems as compared with a personal computer. The very simplest embedded systems are capable of performing only a single function or set of functions to meet a single predetermined purpose. In more complex systems an application program that enables the embedded system to be used for a particular purpose in a specific application determines the functioning of the embedded system. The ability to have programs means that the same embedded system can be used for a variety of different purposes . In some cases a microprocessor may be designed in such a way that application software for a particular purpose can be added to the basic software in a second process, after which it is not possible to make further changes. The applications software on such processors is sometimes referred to as firmware. The simplest devices consist of a single microprocessor (often called a "chip), which may itself be packaged with other chips in a hybrid system or Application Specific Integrated Circuit (ASIC). Its input comes from a detector or sensor and its output goes to a switch or activator which (for example) may start or stop the operation of a machine or, by operating a valve, may control the flow of fuel to an engine. As the embedded system is the combination of both software and hardware

Page 14 of 58
Vehicle Tracking System

Micro-Controller

Processors are classified into four types like:


Micro Processor (p) Micro controller (c) Digital Signal Processor (DSP) Application Specific Integrated Circuits (ASIC)

Micro Controller (c): A microcontroller is a small computer on a single integrated circuit containing a processor core, memory, and programmable input/output peripherals. Program memory in the form of OTP ROM is also often included on chip, as well as a typically small amount of RAM. Microcontrollers are designed for embedded applications, in contrast to the microprocessors used in personal computers or other general purpose applications. A microcontroller is a general purpose device, but that is meant to read data, perform limited calculations on that data and control its environment based on those calculations. The prime use of a microcontroller is to control the operation of a machine using a fixed program that is stored in ROM and that does not change over the lifetime of the system.

PROM A programmable read-only memory (PROM) or field programmable read-only memory (FPROM) or one-time programmable non-volatile memory (OTP NVM) is a form of digital memory where the setting of each bit is locked by a fuse or antifuse. Such PROMs are used to store programs permanently. The key difference from a strict ROM is that the programming is applied after the device is constructed.

Page 15 of 58
Vehicle Tracking System

Micro-Controller

These types of memories are frequently seen in video game consoles, mobile phones, radio-frequency identification (RFID) tags, implantable medical devices, high-definition multimedia interfaces (HDMI) and in many other consumer and automotive electronics products.

2.2 PIN Configuration

2.3 Features
The ATmega128 provides the following features: 128Kbytes of In-System Programmable Flash with Read-While-Write capabilities, 4Kbytes EEPROM, 4Kbytes SRAM, 53 general purpose I/O lines, 32 general purpose working registers, Real Time Counter (RTC), 2 USARTs, a byte oriented Two-wire Serial Interface, an 8- channel, 10bit ADC with optional differential input stage with programmable gain, programmable Watchdog Timer with Internal Oscillator, an SPI serial port, IEEE std. 1149.1 compliant
Page 16 of 58
Vehicle Tracking System

Micro-Controller

JTAG test interface, also used for accessing the On-chip Debug system and programming and six software selectable power saving modes.

High-performance, Low-power AtmelAVR8-bit Microcontroller Advanced RISC Architecture 32 x 8 General Purpose Working Registers + Peripheral Control Registers High Endurance Non-volatile Memory segments 128Kbytes of In-System Self-programmable Flash program memory 4Kbytes EEPROM 4Kbytes Internal SRAM

Optional Boot Code Section with Independent Lock Bits In-System Programming by On-chip Boot Program True Read-While-Write Operation Up to 64Kbytes Optional External Memory Space Programming of Flash, EEPROM, Fuses and Lock Bits through the JTAG Interface

Real Time Counter with Separate Oscillator

Operating Voltages 4.5 - 5.5V ATmega128

2.4 CENTRAL PROCESSING UNIT


CPU has a role of connective element between other blocks in the microcontroller. It coordinates the work of other blocks and executes the user program.

Page 17 of 58
Vehicle Tracking System

Micro-Controller

2.5 PIN DESCRIPTION:


1. VCC:- Digital supply voltage. 2. GND:- Ground. 3. Port A (PA7..PA0),Port B (PB7..PB0), Port C (PC7..PC0), Port D (PD7..PD0), Port E (PE7..PE0), Port F (PF7..PF0), Port G (PG4..PG0 ):- All Port has an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port pins that are externally pulled low will source current if the pull-up resistors are activated. The Port pins are tri-stated when a reset condition becomes active, even if the clock is not running. 4. RESET:- Reset input. A low level on this pin for longer than the minimum pulse length will generate a reset, even if the clock is not running. Shorter pulses are not guaranteed to generate a reset.
Page 18 of 58
Vehicle Tracking System

Micro-Controller

5. XTAL1:- Input to the inverting Oscillator amplifier and input to the internal clock operating circuit. 6. XTAL2:- Output from the inverting Oscillator amplifier. 7. AVCC:-AVCC is the supply voltage pin for Port F and the A/D Converter. It should be externally connected to VCC, even if the ADC is not used. If the ADC is used, it should be connected to VCC through a low-pass filter. 8. AREF:-AREF is the analog reference pin for the A/D Converter. 9. PEN:- PEN is a programming enable pin for the SPI Serial Programming mode, and is internally pulled high . By holding this pin low during a Power-on Reset, the device will enter the SPI Serial Programming mode. PEN has no function during normal operation.

2.6 Architectural Overview


2.6.1 Program memory (FLASH) is used for storing a written program. Flash memory is an example of quite a recent type of storage technology known as solid state devices. This type of portable storage has become very popular because of its low price and high storage capacity compared to its rivals, e.g. floppy disk. Solid state devices are regarded as being robust and reliable because they have no moving parts with the data stored in semiconductor chips. This technology already exists in the form of flash memory used to store the Basic Input/Output System (BIOS) of a motherboard. Unlike ROM, flash memory can be read form and written to and unlike RAM does not require power to retain its data. Although these devices typically cannot hold as much data as hard disks, CD-ROMs and DVDs, the storage capacity is continually increasing. Since memory made in FLASH technology can be programmed and cleared more than once, it makes this microcontroller suitable for device development. 2.6.2 EEPROM:- This is the most flexible type of ROM that uses special softwares to erase the content of the device. The difference between EPROM and EEPROM is that; EEPROM uses electric current to erase the content while EPROM uses ultraviolet rays, data memory that needs to be saved when there is no supply. It is usually used for storing important data that must not be lost if power supply suddenly stops. For instance, one such data is an assigned temperature in temperature regulators. If during a loss of power supply this data was lost, we would have to make the adjustment once again upon return of supply. Thus our device loses on self-reliance.

Page 19 of 58
Vehicle Tracking System

Micro-Controller

2.6.3 RAM:- Data memory used by program during its execution. In ram are stored all inter results or temporary data during run-time.

2.6.4 INTERRUPT SYSTEM:An interrupt is an external or internal event that suspends the operation of microcontroller to inform it that a device needs its service. In interrupt method, whenever any device needs its service, the device notifies the micro controller by sending it an interrupt signal. Upon receiving an interrupt signal, the micro controller interrupts whatever it is doing and serves the device. The program associated with interrupt is called as interrupt service subroutine (ISR).Main advantage with interrupts is that the micro controller can serve many devices.

2.6.5 ALU Arithmetic Logic Unit:The high-performance AVR ALU operates in direct connection with all the 32 general purpose working registers. Within a single clock cycle, arithmetic operations between general purpose registers or between a register and an immediate are executed. The ALU operations are divided into three main categories arithmetic, logical, and bitfunctions.

2.6.6 Status Register:The Status Register contains information about the result of the most recently executed arithmetic instruction. This information can be used for altering program flow in order to perform conditional operations. Note that the Status Register is updated after all ALU operations, as specified in the Instruction Set Reference. This will in many cases remove the need for using the dedicated compare instructions, resulting in faster and more compact code. The status register is not automatically stored when entering an interrupt routine and restored when returning from an interrupt.

Page 20 of 58
Vehicle Tracking System

Micro-Controller

2.6.7 General Purpose Register File:The Register file is optimized for the AVR Enhanced RISC instruction set. In order to achieve the required performance and flexibility, the following input/output schemes are supported by the Register file: One 8-bit output operand and one 8-bit result input Two 8-bit output operands and one 8-bit result input Two 8-bit output operands and one 16-bit result input One 16-bit output operand and one 16-bit result input 2.6.8 Stack Pointer:The Stack is mainly used for storing temporary data, for storing local variables and for storing return addresses after interrupts and subroutine calls. The Stack Pointer Register always points to the top of the Stack. Note that the Stack is implemented as growing from higher memory locations to lower memory locations. This implies that a Stack PUSH command decreases the Stack Pointer. The Stack Pointer points to the data SRAM stack area where the Subroutine and Interrupt Stacks are located. This Stack space in the data SRAM must be defined by the program before any subroutine calls are executed or interrupts are enabled.

2.6.9 Clock generator oscillator:Oscillator circuit is used for providing a microcontroller with a clock. Clock is needed so that microcontroller could execute a program or program instructions.

2.6.10 Reset:Reset is used for putting the microcontroller into a 'known' condition. That practically means that microcontroller can behave rather inaccurately under certain undesirable conditions. In order to continue its proper functioning it has to be reset, meaning all registers would be placed in a starting position. Reset is not only used when microcontroller doesn't behave the way we want it to, but can also be used when trying out a device as an interrupt in program execution, or to get a microcontroller ready when loading a program.

Page 21 of 58
Vehicle Tracking System

Micro-Controller

2.6.12 Ports:Term "port" refers to a group of pins on a microcontroller which can be accessed simultaneously, or on which we can set the desired combination of zeros and ones, or read from them an existing status. Physically, port is a register inside a microcontroller which is connected by wires to the pins of a microcontroller. Ports represent physical connection of Central Processing Unit with an outside world. Microcontroller uses them in order to monitor or control other components or devices. 2.6.13 Reset and Interrupt Handling:Interrupts are a mechanism of a microcontroller which enables it to respond to some events at the moment they occur, regardless of what microcontroller is doing at the time. This is a very important part, because it provides connection between a microcontroller and environment which surrounds it. Generally, each interrupt changes the program flow, interrupts it and after executing an interrupt subprogram (interrupt routine) it continues from that same point on. The AVR provides several different interrupt sources. These interrupts and the separate reset vector each have a separate program vector in the program memory space. All interrupts are assigned individual enable bits which must be written logic one together with the Global Interrupt Enable bit in the Status Register in order to enable the interrupt. The lowest addresses in the program memory space are by default defined as the Reset and Interrupt vectors. The lower the address the higher is the priority level. RESET has the highest priority, When an interrupt occurs, the Global Interrupt Enable I-bit is cleared and all interrupts are disabled.

2.6.14 Pull-up:The pull-ups on the AD7:0 ports may be activated if the corresponding Port register is written to one. To reduce power consumption in sleep mode, it is recommended to disable the pull-ups by writing the Port register to zero before entering sleep.

Page 22 of 58
Vehicle Tracking System

Micro-Controller

2.6.15 AVR ATmega128 Memories:This section describes the different memories in the Atmel AVR ATmega128. The AVR architecture has two main memory spaces, the Data Memory and the Program Memory space. In addition, the ATmega128 features an EEPROM Memory for data storage. All three memory spaces are linear and regular.

In-System Reprogrammable Flash Program Memory:The ATmega128 contains 128Kbytes On-chip In-System Reprogrammable Flash memory for program storage. Since all AVR instructions are 16 or 32 bits wide, the Flash is organized as 64K x 16. For software security, the Flash Program memory space is divided into two sections, Boot Program section and Application Program section.

Fig: Flash Memory Diagram

SRAM Data Memory:The Atmel AVR ATmega128 supports two different configurations for the SRAM data memory

Page 23 of 58
Vehicle Tracking System

Micro-Controller

EEPROM Data Memory:The Atmel AVRATmega128 contains 4Kbytes of data EEPROM memory. It is organized as a separate data space, in which single bytes can be read and written

External Memory Interface:With all the features the External Memory Interface provides, it is well suited to operate as an interface to memory devices such as External SRAM and Flash, and peripherals such as LCD display, A/D, and D/A.

Program memory:Program memory has been carried out in FLASH technology which makes it possible to program a microcontroller many times before it's installed into a device, and even after its installment if eventual changes in program or process parameters should occur.

Data memory:Data memory consists of EEPROM and RAM memories. EEPROM memory consists of 256 eight bit locations whose contents is not lost during loosing of power supply. EEPROM is not directly addressable, but is accessed indirectly through EEADR and EEDATA registers. As EEPROM memory usually serves for storing important parameters (for example, of a given temperature in temperature regulators) , there is a strict procedure for writing in EEPROM which must be followed in order to avoid accidental writing. Locations of RAM memory are also called GPR registers which is an abbreviation for General Purpose Registers. GPR registers can be accessed regardless of which bank is selected at the moment

2.7 USART
Page 24 of 58
Vehicle Tracking System

Micro-Controller

The Universal Synchronous and Asynchronous serial Receiver and Transmitter (USART) is a highly flexible serial communication device. The main features are: Full Duplex Operation (Independent Serial Receive and Transmit Registers) Asynchronous or Synchronous Operation Master or Slave Clocked Synchronous Operation High Resolution Baud Rate Generator Supports Serial Frames with 5, 6, 7, 8, or 9 Data Bits and 1 or 2 Stop Bits Odd or Even Parity Generation and Parity Check Supported by Hardware Data OverRun Detection Framing Error Detection Noise Filtering Includes False Start Bit Detection and Digital Low Pass Filter Three Separate Interrupts on TX Complete, TX Data Register Empty, and RX Complete Multi-processor Communication Mode Double Speed Asynchronous Communication Mode

2.7.1 Dual USART:The ATmega128 has two USARTs, USART0 and USART1. The functionality for both USARTs is described below. USART0 and USART1 have different I/O registers.in ATmega128 compatibility mode, USART1 is not available, neither is the UBRR0H or UCRS0C Registers. This means that in ATmega103 compatibility mode, the ATmega128 supports asynchronous operation of USART0 only. The three main parts of the USART: Clock Generator, Transmitter, and Receiver. Control registers are shared by all units. The clock generation logic consists of synchronization logic for external clock input used by synchronous slave operation, and the baud rate generator. The XCK (Transfer Clock) pin is only used by Synchronous Transfer mode. The Transmitter consists of a single write buffer, a serial Shift Register, parity generator and control logic for handling different serial frame formats. The write buffer allows a continuous transfer of data without any delay between frames. The Receiver is the most complex part of the USART module due to its clock and data recovery units. The recovery units are used for asynchronous data reception. In addition to the recovery units, the receiver includes a parity checker, control logic, a Shift Register and a two level receive buffer (UDR). The receiver supports the same frame formats as the Transmitter, and can detect frame error, data overrun and parity errors.

Page 25 of 58
Vehicle Tracking System

Micro-Controller

Figure: Transmission Diagram

Figure: Reception Diagram

2.8 MAX232:
Max 232 is a communications device used mainly for serial commands to and from a flash ROM. The MAX232 is an integrated circuit that converts signals from an RSPage 26 of 58
Vehicle Tracking System

Micro-Controller

232serial port to signals suitable for use in TTL compatible digital logic circuits. TheMAX232 is a dual driver/receiver and typically converts the RX, TX, CTS and RTS signals. The drivers provide RS-232 voltage level outputs (approx. 7.5 V) from a single +5 V supply via on-chip charge pumps and external capacitors. This makes it useful for implementing RS-232 in devices that otherwise do not need any voltages outside the 0V to +5 V range, as power supply design does not need to be made more complicated just for driving the RS-232 in this case. The receivers reduce RS-232 inputs (which may be as high as 25 V), to standard 5 VTTL levels. These receivers have a typical threshold of 1.3 V, and a typical hysteresis of 0.5 V. The later MAX232A is backwards compatible with the original MAX232 but may operate at higher baud rates and can use smaller external capacitors 0.1 F in place of the 1.0 F capacitors used with the original device. The newer MAX3232 is also backwards compatible, but operates at a broader voltage range, from 3 to 5.5V.

2.9 RS-232 (ANSI/EIA-232 Standard) is the serial connection found on IBM


compatible PCs. It is used for many purposes, such as connecting a mouse, printer, or
Page 27 of 58
Vehicle Tracking System

Micro-Controller

modem, as well as industrial instrumentation. Because of improvements in line drivers and cables, applications often increase the performance of RS-232 beyond the distance and speed listed in the standard. RS-232 is limited to point-to-point connections between PC serial ports and devices. RS-232 hardware can be used for serial communication up to distances of 50 feet.

Page 28 of 58
Vehicle Tracking System

GSM

Chapter-3 GLOBAL SYSTEM FOR MOBILE COMMUNICATIONS 3.1 Introduction of GSM


GSM, which stands for Global System for Mobile communications, reigns (important) as the worlds most widely used cell phone technology. Cell phones use a cell phone service carriers GSM network by searching for cell phone towers in the nearby area. Global system for mobile communication (GSM) is a globally accepted standard for digital cellular communication. The Europeans realized this early on, and in 1982 the Conference of European Posts and Telegraphs (CEPT) formed a study group called the Groupe Special Mobile (GSM) to study and develop a pan-European public land mobile system. The proposed system had to meet certain criteria: Good subjective speech quality Low terminal and service cost Low terminal and service cost Ability to support handheld terminals Support for range of new services and facilities Spectral efficiency ISDN compatibility

3.1.1 Need of GSM


The GSM study group aimed to provide the followings through the GSM:

Improved spectrum efficiency. International roaming. Low-cost mobile sets and base stations (BS) High-quality speech Compatibility with Integrated Services Digital Network (ISDN) and other telephone company services.

Page 29 of 58
Vehicle Tracking System

GSM

3.1.2 Services provided by GSM


Bearer services: Typically data transmission instead of voice. Fax and SMS are examples. Teleservices: Voice oriented traffic. Supplementary services: Call forwarding, caller ID, call waiting and the like.

3.2 GSM Architecture


A GSM network consists of several functional entities whose functions and interfaces are defined. The GSM network can be divided into following broad parts. The Mobile Station (MS) The Base Station Subsystem (BSS) The Network Switching Subsystem (NSS) The Operation Support Subsystem (OSS)

Page 30 of 58
Vehicle Tracking System

GSM

3.3 SIM300 -

Designed for global market, SIM300 is a Tri-band GSM/GPRS engine that works on frequencies EGSM 900 MHz, DCS 1800 MHz and PCS1900 MHz. SIM300 provides GPRS multi-slot class 10 capability and support the GPRS coding schemes CS-1, CS2, CS-3 and CS-4. With a tiny configuration of 40mm x 33mm x 2.85 mm. SIM300 can fit almost all the space requirement in your application, such as Smart phone, PDA phone and other mobile device. The physical interface to the mobile application is made through a 60 pins board-toboard connector, which provides all hardware interfaces between the module and customers boards except the RF antenna interface. 1) The keypad and SPI LCD interface will give you the flexibility to develop customized applications. 2) Two serial ports can help you easily develop your applications. 3) Two audio channels include two microphones inputs and two speaker outputs. This can be easily configured by AT command.
Page 31 of 58
Vehicle Tracking System

GSM

SIM300 provide RF antenna interface with two alternatives: antenna connector and antenna pad. The antenna connector is MURATA MM9329-2700. And customers antenna can be soldered to the antenna pad. The SIM300 is designed with power saving technique, the current consumption to as low as 2.5mA in SLEEP mode. The SIM300 is integrated with the TCP/IP protocol, Extended TCP/IP AT commands are developed for customers to use the TCP/IP protocol easily, which is very useful for those data transfer applications.

Table: SIM300 Key Features Feature


Power supply Power saving Frequency bands SIM300 Tri-band: EGSM 900, DCS 1800, PCS 1900. The band can be set by AT COMMAND, and default band is EGSM 900 and DCS 1800. Compliant to GSM Phase 2/2+ GSM class SMS Small MS MT, MO, CB, Text and PDU mode SMS storage: SIM card Support transmission of SMS alternatively over CSD or GPRS. User can choose preferred mode.

Implementation
Single supply voltage 3.4V 4.5V Typical power consumption in SLEEP mode to 2.5mA

Page 32 of 58
Vehicle Tracking System

GSM

3.4 Application
SIMComs wireless modules have been applied in: 1) Automotives 2) Telematics 3) Security 4) Tracking and tracing 5) Auto meter reading 6) Industrial automation 7) Payment 8) Healthcare 9) Others

Now SIM300 is connect with Microcontroller Atmega128 through serial port and send Latitude and Longitude position with the help of AT Commands.

3.5 AT CommandsAT commands are used to control GSM MODEM. AT is the abbreviation for Attention. These commands come from Hayes commands that were used by the Hayes smart modems. The Hayes commands started with AT to indicate the attention from the MODEM. The dial up and wireless MODEMs (devices that involve machine to machine communication) need AT commands to interact with a computer. These include the Hayes command set as a subset, along with other extended AT commands. AT commands with a GSM/GPRS MODEM or mobile phone can be used to access following information and services: a. Information and configuration pertaining to mobile device or MODEM and SIM card. b. SMS services. c. MMS services. d. Fax services. e. Data and Voice link over mobile network.

Explanation of commonly used AT commands:


1) AT -This command is used to check communication between the module and the Computer. For example, AT OK

Page 33 of 58
Vehicle Tracking System

GSM

The command returns a result code OK if the computer (serial port) and module are connected properly. If any of module or SIM is not working, it would return a result code ERROR.

2) +CMGF - This command is used to set the SMS mode. Either text or PDU mode can be selected by assigning 1 or 0 in the command. SYNTAX: AT+CMGF=<mode> 0: for PDU mode 1: for text mode The text mode of SMS is easier to operate but it allows limited features of SMS. The PDU (protocol data unit) allows more access to SMS services but the operator requires bit level knowledge of TPDUs. The headers and body of SMS are accessed in hex format in PDU mode so it allows availing more features. For example, AT+CMGF=1 OK 3) +CMGW - This command is used to store message in the SIM. SYNTAX: AT+CMGW= Phone number> Message to be stored Ctrl+z. As one types AT+CMGW and phone number, > sign appears on next line where one can type the message. Multiple line messages can be typed in this case. This is why the message is terminated by providing a Ctrl+z combination. As Ctrl+z is pressed, the following information response is displayed on the screen.

+CMGW: Number on which message has been stored.

4) +CMGS - This command is used to send a SMS message to a phone number. SYNTAX: AT+CMGS= serial number of message to be send. As the command AT+CMGS and serial number of message are entered, SMS is sent to the particular SIM. For example, AT+CMGS=1 OK

5) ATD - This command is used to dial or call a number.

Page 34 of 58
Vehicle Tracking System

GSM

SYNTAX: ATD<Phone number>(Enter) For example, ATD123456789

6) ATA - This command is used to answer a call. An incoming call is indicated by a message RING which is repeated for every ring of the call. When the call ends NO CARRIER is displayed on the screen. SYNTAX: ATA(Enter) As ATA followed by enter key is pressed, incoming call is answered. For example, RING RING ATA

7) ATH - This command is used to disconnect remote user link with the GSM module. SYNTAX: ATH (Enter)

Page 35 of 58
Vehicle Tracking System

GPS

Chapter-4 GLOBAL POSITION SYSTEM 4.1 Introduction


The Global Positioning System (GPS) is a space-based satellite navigation system that provides location and time information in all weather conditions, anywhere on or near the Earth where there is an unobstructed line of sight to four or more GPS satellites. Each GPS satellite transmits radio signals that enable the GPS receivers to calculate where its (or your vehicles) location on the Earth and convert the calculations into geodetic latitude, longitude and velocity. A receiver needs signals from at least three GPS satellites to pinpoint your vehicles position. GPS Receivers commonly used in most Vehicle tracking systems can only receive data from GPS Satellites. They cannot communicate back with GPS or any other satellite. A system based on GPS can only calculate its location but cannot send it to central control room. In order to do this they normally use GSM-GPRS Cellular networks connectivity using additional GSM modem/module. In this project we use GPS-634R is a highly integrated smart GPS module with a ceramic GPS patch antenna. The antenna is connected to the module via an LNA. The module is with 51 channel acquisition engine and 14 channel track engine, which be capable of receiving signals from up to 65 GPS satellites and transferring them into the precise position and timing information that can be read over either UART port or RS232 serial port. Small size and high-end GPS functionality are at low power consumption, Both of the LVTTL level and RS232 signal interface are provided on the interface connector, supply voltage of 3.6V~6.0V is supported. The smart GPS antenna module is available as an off-the-shelf component, 100% tested. The smart GPS antenna module can be offered for OEM applications with the versatile adaptation in form and connection. Additionally, the antenna can be tuned to the final systems circumstances. There are three types GPS of start - hot, warm and cold. The hot start is when the GPS device remembers its last calculated position and the satellites in view, the almanac used (information about all the satellites in the constellation), the UTC Time and makes an attempt to lock onto the same satellites and calculate a new position based upon the previous information. This is the quickest GPS lock but it only works if you are generally in the same location as you were when the GPS was last turned off.

Page 36 of 58 Vehicle Tracking System

GPS

The warm start is when the GPS device remembers its last calculated position, almanac used, and UTC Time, but not which satellites were in view. It then performs a reset and attempts to obtain the satellite signals and calculates a new position. The receiver has a general idea of which satellites to look for because it knows its last position and the almanac data helps identify which satellites are visible in the sky. This takes longer than a hot start but not as long as a cold start. And finally the cold start is when the GPS device dumps all the information, attempts to locate satellites and then calculates a GPS lock. This takes the longest because there is no known information. The GPS receiver has to attempt to lock onto a satellite signal from any available satellites, basically like polling, which takes a lot longer than knowing which satellites to look for. This GPS lock takes the longest.

Page 37 of 58 Vehicle Tracking System

GPS

4.2 Flow-Chart of GPS

4.3 FEATURES
65 channels to acquire and track satellites simultaneously Tracking sensitivity reaches -161 dBm 0.5 PPM TCXO for quick cold start Integral LNA with low power control Cold start _ 29 sec under clear Sky Hot start _ 1 sec under clear Sky Accuracy 5m CEP Operable at 3.6V-6V
Page 38 of 58 Vehicle Tracking System

GPS

Both of RS232 and UART interface at CMOS level Small form factor of 32 mm W x 32 mm Lx 8 mm H Mountable without solder process 6 pins wafer connector

4.4 PIN CONFIGURATION

Page 39 of 58 Vehicle Tracking System

GPS

4.5 Communication Specification

Page 40 of 58 Vehicle Tracking System

GPS

4.6 NMEA Protocol


The serial interface protocol is based on the National Marine Electronics Associations NMEA 0183 ASCII interface specification. The NMEA 0183 standard uses a simple ASCII, serial communication protocol that defines how data are transmitted in a "sentence" from one "talker" to multiple "listeners" at a time. Application Protocol Layer rules:

Each message's starting character is a dollar sign. The next five characters identify the talker (two characters) and the type of message (three characters). All data fields that follow are comma-delimited. Where data is unavailable, the corresponding field remains blank The first character that immediately follows the last data field character is an asterisk, but it is only included if a checksum is supplied. The asterisk is immediately followed by a checksum represented as a twodigit hexadecimal number. The checksum is the bitwise exclusive OR of ASCII codes of all characters between the $and *. According to the official specification, the checksum is optional for most data sentences, but is compulsory for RMA, RMB, and RMC (among others). <CR><LF> ends the message.

Page 41 of 58 Vehicle Tracking System

GPS

4.6.1 GGA-GLOBAL POSITIONING SYSTEM FIX DATA Time, position and fix related data for a GPS receiver. Structure: $GPGGA,hhmmss.sss,ddmm.mmmm,a,dddmm.mmmm,a,x,xx,x.x,x.x,M,x.x,M,x.x,xxxx* hh<CR><LF> 1 2 3 4 5 6 7 8 9 10 11 12 13

Page 42 of 58 Vehicle Tracking System

GPS

4.6.2 GLL - LATITUDE AND LONGITUDE, WITH TIME OF POSITION FIX AND STATUS Latitude and longitude of current position, time, and status. Structure: $GPGLL,ddmm.mmmm,a,dddmm.mmmm,a,hhmmss.sss,A,a*hh<CR><LF> 12345678 Example:
Page 43 of 58 Vehicle Tracking System

GPS

$GPGLL,4250.5589,S,14718.5084,E,092204.999,A,A*2D<CR><LF>

4.6.3 GSA - GPS DOP AND ACTIVE SATELLITES GPS receiver operating mode, satellites used in the navigation solution reported by the GGA or GNS sentence and DOP values. Structure: $GPGSA,A,x,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,xx,x.x,x.x,x.x*hh<CR><LF> 123333333333334567
Page 44 of 58 Vehicle Tracking System

GPS

Example: $GPGSA,A,3,01,20,19,13,,,,,,,,,40.4,24.4,32.2*0A<CR><LF>

4.7 Application
Automotive and Marine Navigation Automotive Navigator Tracking Emergency Locator Geographic Surveying Personal Positioning

Page 45 of 58 Vehicle Tracking System

Snapshots

Chapter-5

Snapshots

5.1 AVR STUDIO 5.1.1 STARTING WITH AVR STUDIO

Page 46 of 58 Vehicle Tracking System

Snapshots

5.1.2 SAVING PROJECT

Page 47 of 58 Vehicle Tracking System

Snapshots

5.1.3 DEVICE SELECTION

Page 48 of 58 Vehicle Tracking System

Snapshots

5.1.4 SHOW SELECTED DEVICE

Page 49 of 58 Vehicle Tracking System

Snapshots

5.1.5 TOOLS

Page 50 of 58 Vehicle Tracking System

Snapshots

5.1.6 OPTIONS

Page 51 of 58 Vehicle Tracking System

Snapshots

5.1.7 BUILDING THE CODE

5.1.8 SHOWING COMPILED FILE

Page 52 of 58 Vehicle Tracking System

Snapshots

5.1.9 BLINK LED EXAMPLE

Page 53 of 58 Vehicle Tracking System

Snapshots

5.2 Brays Terminal

5.2.1 Baud Rate


Baud rate refers to number of signal or symbol changes that occur per second. A symbol is one of several voltage, frequency or phase changes. Whereas, the bit rate refers to data transfer in bits per second.

5.2.2 COM Port


In computer networking, COM port enables external modems connect to PC via a serial cable. The standard for serial port communication has been RS-232.

Note-Data bits, parity and stop bits are 8,none and 1 generally.

Page 54 of 58 Vehicle Tracking System

Snapshots

Fig: Command sending and Signals Receiving on Terminal

Page 55 of 58 Vehicle Tracking System

Conclusion

Chapter 6
Conclusion and Reference The Project titled Vehicle Positioning and Navigating using GPS and GSM is a model for Vehicle Tracking unit with the help of GPS receivers and GSM modem. The positioning is done in the form of latitude and longitude along with the exact location of the place, by making use of Google maps. The system tracks the location of particular vehicle and sends to users mobile in form of SMS and also to EEPROM. The arrived data, is in the form of latitude and longitude is used to locate the Vehicle on the Google maps. To see on the Google map we need to decode the received SMS. We have completed the project as per the requirements of our project. Finally the aim of the project i.e. to Position and navigate the vehicle, has been achieved successfully by using Vehicle Positioning and Navigating system.

Reference
1. www.wittyrobbo.com 2. www.robokits.com 3. www.atmel.in 4. hekilledmywire.wordpress.com 5. www.arduino.cc 6. www.probots.co.in 7. www.nskelectronics.com

Page 56 of 58 Vehicle Tracking System

Conclusion

FUTURE SCOPE We can use the EEPROM to store the previous Navigating positions up to 256 locations and we can navigate up to N number of locations by increasing its memory. We can reduce the size of the kit by using GPS+GSM on the same module. We can increase the accuracy up to 3m by increasing the cost of the GPS receivers. We can use our kit for detection of bomb by connecting to the bomb detector. With the help of high sensitivity vibration sensors we can detect the accident. Whenever vehicle unexpectedly had an accident on the road with help of vibration sensor we can detect the accident and we can send the location to the owner, hospital and police. We can use our kit to assist the traffic. By keeping the kits in the entire vehicles and by knowing the locations of all the vehicles. If anybody steals our car we can easily find our car around the globe. By keeping vehicle positioning vehicle on the vehicle.

Page 57 of 58 Vehicle Tracking System

Page 58 of 58 Vehicle Tracking System

You might also like