i
TITLE PAGE
TRIBHUVAN UNIVERSITY
INSTITUTE OF ENGINEERING
PULCHOWK CAMPUS
GPS GSM Integration for Enhancing Public Transportation System
By:
Anil Gaihre
Basanta Chalise
Binod Basnet
Subash Sharma
A PROJECT WAS SUBMITTED TO THE DEPARTMENT OF ELECTRONICS AND
COMPUTER ENGINEERING IN PARTIAL FULLFILLMENT OF THE REQUIREMENT
FOR THE BACHELOR’S DEGREE IN ELECTRONICS & COMMUNICATION /
COMPUTER ENGINEERING
DEPARTMENT OF ELECTRONICS AND COMPUTER ENGINEERING
LALITPUR, NEPAL
AUGUST, 2013
ii
LETTER OF APPROVAL
TRIBHUVAN UNIVERSITY
INSTITUTE OF ENGINEERING
PULCHOWK CAMPUS
DEPARTMENT OF ELECTRONICS AND COMPUTER ENGINEERING
The undersigned certify that they have read, and recommended to the Institute of Engineering for
acceptance, a project report entitled "Title of the Project" submitted by Name of Student(s) in
partial fulfillment of the requirements for the Bachelor’s degree in Electronics & Communication
/ Computer Engineering.
_________________________________________________
Daya Sagar Baral
Lecturer
Department of Electronics and Computer Engineering
__________________________________________________
Sanjeev Prasad Pandey
Lecturer
Department of Electronics and Computer Engineering
__________________________________________________
External Examiner, name of External
Title
Name of the Organization, he belongs to
------------------------------------------------------------------------------
Coordinator, Name of Coordinator
Title
Name of the coordinating committee
iii
DATE OF APPROVAL: Day.Month.Year
i
COPYRIGHT
The author has agreed that the Library, Department of Electronics and Computer Engineering,
Pulchowk Campus, Institute of Engineering may make this report freely available for
inspection. Moreover, the author has agreed that permission for extensive copying of this
project report for scholarly purpose may be granted by the supervisors who supervised the
project work recorded herein or, in their absence, by the Head of the Department wherein the
project report was done. It is understood that the recognition will be given to the author of this
report and to the Department of Electronics and Computer Engineering, Pulchowk Campus,
Institute of Engineering in any use of the material of this project report. Copying or
publication or the other use of this report for financial gain without approval of to the
Department of Electronics and Computer Engineering, Pulchowk Campus, Institute of
Engineering and author’s written permission is prohibited. Request for permission to copy or
to make any other use of the material in this report in whole or in part should be addressed to:
Prof. Dr Arun Timilsena
Head
Department of Electronics and Computer Engineering
Pulchowk Campus
ii
ACKNOWLEDGEMENT
This project is the result of dedication and encouragement of many individuals. Our sincere
and heartfelt appreciation goes to all of them.
We would like to express our hearty gratitude to the Department Of Electronics and Computer
Engineering, Pulchowk campus for providing us with the opportunity to do this project and
thereby visualize our theoretical knowledge to design some real time system.
We are thankful to Prof. Dr. Arun Timilsena, Head of Department, Department of
Electronics and computer Engineering for availing us with resources and continuous support
that helped us to carry out the project with ease.
We must acknowledge our obligation to our Project Coordinator, Dr. Aman Shakya deputy
head Department of Electronics and computer Engineering for his considerations and
suggestions throughout the project.
We owe our debt of gratitude to our Project Supervisor Mr. Daya Sagar Baral for
supervising our task and constantly motivating us with ideas regarding the project starting
from the time of its inception.
Thanks are due to Prof. Dr. Nanda Bikram Adhikari for his valuable support and ideas
regarding the project. He has motivated us a lot in the course of this project.
Last but not the least, we are obliged to everyone who have suggested and supported us in
course of our project from the start to the end.
iii
ABSTRACT
The project “GPS GSM Integration For Enhancing Public Transportation System” is
an attempt to design a tracking unit that uses the global positioning system to determine
the precise location of a vehicle and through GSM modem the vehicle location is
transmitted to remote user. This system contains single-board embedded system that is
equipped with GPS and GSM modems along with processor. During vehicular motion, its
location can be reported by accessing a website. The website maintained has the vehicular
information in its database. Information from the GSM to the website is send via SMS. The
location of the vehicle is traced in Google map which users can obtain through their mobile
phones with internet accessibility. Similarly, at the station the audio information about the
status of the bus is broadcasted along with displaying it on the LCD which helps passenger at
the station to know the status of their vehicle and helps the visually impaired person to board
the bus.
The use of GSM and GPS technologies allows the system to keep trace of vehicle and
provides the updated information about ongoing trips. This system finds its application in
real time traffic surveillance and can be effective in case of city like Kathmandu where traffic
congestion is often a situation. The system aims to help people to board the vehicle they intend
to travel in time.
iv
TABLE OF CONTENTS
TITLE PAGE................................................................................................................................i
LETTER OF APPROVAL..........................................................................................................ii
COPYRIGHT...............................................................................................................................i
ACKNOWLEDGEMENT...........................................................................................................ii
ABSTRACT...............................................................................................................................iii
TABLE OF CONTENTS...........................................................................................................iv
LIST OF FIGURE.....................................................................................................................vii
LIST OF TABLES...................................................................................................................viii
LIST OF ABBREVIATIONS.....................................................................................................ix
1. INTRODUCTION...................................................................................................................1
1.1. Background.......................................................................................................................1
1.1.1. Background Research.................................................................................................1
1.2. Objectives..........................................................................................................................2
1.3. Methodology.....................................................................................................................3
2. LITERATURE REVIEW........................................................................................................4
3. COMPONENTS AND TECHNIQUES...................................................................................6
3.1. Global Positioning System................................................................................................6
3.1.1. Structure......................................................................................................................6
3.1.2. GPS Operation............................................................................................................8
3.1.3. Triangulation..............................................................................................................9
3.1.4. GPS Frequency.........................................................................................................10
3.1.5. GPS Standard Format...............................................................................................10
3.1.6. The NMEA 0183......................................................................................................11
3.2. Global System for Mobile Communication....................................................................12
3.2.1. GSM Network Structure...........................................................................................12
3.2.2. GSM carrier frequencies...........................................................................................14
v
3.2.3. Subscriber Identity Module......................................................................................14
3.2.4. GSM Data Transmission..........................................................................................14
3.2.5. Message size.............................................................................................................15
3.2.6. AT commands...........................................................................................................16
3.3. Value Added Service Provider........................................................................................16
3.3.1. Sparrow SMS............................................................................................................16
3.4. Serial Data Transmission................................................................................................17
3.5. Asynchronous Serial Data Transmission........................................................................17
3.5.1. UART.......................................................................................................................18
3.6. Microcontroller................................................................................................................18
3.7. Liquid Crystal Display....................................................................................................19
3.8. Multimedia Card.............................................................................................................19
3.9. FAT16.............................................................................................................................20
3.10. LM386...........................................................................................................................21
3.11. Local Host.....................................................................................................................23
3.12. Server............................................................................................................................23
3.13. HTTP (Hyper Text Transfer Protocol)..........................................................................24
3.14. Scripting Language.......................................................................................................24
3.15. Database management systems (DBMSs).....................................................................24
3.16. FTP/FTP Client.............................................................................................................25
3.17. Domain Name...............................................................................................................25
3.18. Web Hosting..................................................................................................................27
3.19. APIs’..............................................................................................................................27
4. PROJECT OVERVIEW........................................................................................................28
4.1. System Block Diagram....................................................................................................28
4.1.1. Embedded System in Vehicle...................................................................................29
4.1.2. Web Server...............................................................................................................31
4.1.3. Embedded System at Station....................................................................................33
vi
5. Methodology..........................................................................................................................35
5.1. Hardware Implementation...............................................................................................35
5.1.1. Liquid Crystal Display..............................................................................................35
5.1.2. GPS...........................................................................................................................37
5.1.3. GSM..........................................................................................................................40
6. Software Implementation.......................................................................................................43
6.1. Apache (2.2.19) Server....................................................................................................43
6.1...........................................................................................................................................43
6.2. My SQL(5.1)...................................................................................................................43
6.3. FileZilla (3.7.3)...............................................................................................................44
6.4. XAMPP (1.7.4)...............................................................................................................44
6.5. Web Hosting Service Provider (000webhost.com).........................................................44
6.5.1. Domain Name (.net78.net).......................................................................................44
6.6. HTML..............................................................................................................................45
6.7. PHP 5.3.5.........................................................................................................................45
6.8. JavaScript........................................................................................................................46
6.9. APIs’................................................................................................................................46
6.9.1. Google Maps API for embedding Google map in the webpage...............................46
6.9.2. Outgoing API –Sparrow SMS Service (VASP API)................................................49
6.9.3. Incoming API –Sparrow SMS Service (VASP API)...............................................49
7. APPLICATION.....................................................................................................................51
8. PROBLEM FACED...............................................................................................................52
9. LIMITATION AND FUTURE ENHANCEMENT..............................................................53
10. CONCLUSION....................................................................................................................54
11. REFRENCES.......................................................................................................................55
12. APPENDIX..........................................................................................................................56
vii
LIST OF FIGURE
Figure 3.1: Orientation of GPS Satellites in Space (Source: Wikipedia)...................................7
Figure 3.2: GSM Network Structure..........................................................................................13
Figure 3.3: Pin Diagram for LM386..........................................................................................21
Figure 4.1: System Block Diagram............................................................................................28
Figure 4.2: Flow Diagram of system in the vehicle...................................................................30
Figure 4.3: Flow Diagram of various API for subscription and sending of message................32
Figure 4.4: Flow Diagram of system at the station....................................................................34
Figure 5.3: Basic Diagram for Interfacing LCD in 4 bit mode with Microcontroller...............37
viii
LIST OF TABLES
Table 3.1: GGA data format......................................................................................................12
Table 3.2: Pin Description of MMC..........................................................................................20
Table 3.3: Capacity of Sector and Cluster in Fat 16..................................................................21
Table 5.1: Pin out function for LCD LM016L..........................................................................35
Table 5.2: Command Control Code...........................................................................................36
ix
LIST OF ABBREVIATIONS
1G: First Generation
2G: Second Generation
ADC: Analog Digital Converter
API: Application Programming Interface
AT: Attention
BSS: Base Station Subsystem
CPU: Central Processing Unit
CS: Control segment
CSS: Cascading Style Sheets
DUART : Dual Universal Asynchronous Receiver/Transmitter
EDGE : Enhanced Data rates for GSM Evolution
EEPROM : Electrically Erasable Programmable Read Only Memory
ETSI : European Telecommunications Standards Institute
FIFO : First In First Out
GLONASS : Global Navigation Satellite System
GND : Ground
GPRS : General Packet Radio Services
GPS : Global Positioning System
GSM : Global System of Mobile Communication
HTML: Hyper Text Markup Language
ID : Identification
IDE : Integrated Development Environment
IMSI : International Mobile Subscriber Identity
LCD : Liquid Crystal Display
LED : Light Emitting Display
LVTTL : Low Voltage Transistor Transistor Logic
MAP : Mobile Application Part
x
MCS : Master Control Station
MO : Mobile Originating
MT: Mobile Terminated
OCS : Operation Control Segment
OEM : Original Equipment Manufacturer
OSS : Operations Support System
OTP ROM : One Time Programmable Read Only Memory
PHP: Personal Home Page/Hypertext Preprocessor
PIN: Personal Identification Number
PSTN : Public Switched Telephone Network
PWM : Pulse Width Modulation
PUK: Personal Unblocking
RAM : Random Access Memory
RD : Receive
RDBMS: Relational Database Management System
RF : Radio Frequency
RISC : Reduced Instruction Set Computer
ROM : Read Only Memory
SBS : Smart Bus System
SIM : Subscriber Identity/ Identification Module
SMS : Short Message Service
SMSC : Short Message Service Centre
SMS-CB : Short Message Service Cell Broadcast
SMS-PP : Short Message Service Point to Point
SRAM : Static Random Access Memory
SS : Space segment
SV : Space Vehicles
TD: Transmit
TDMA: Time Division Multiple Access
UART: Universal Asynchronous Receiver/Transmitter
UDH: User Data Header
xi
US: User segment
USART: Universal Synchronous/Asynchronous Receiver/Transmitter
VASP: Value Added Service Provider
1
1. INTRODUCTION
1.1. Background
The existing public transportation system in our country has posed troubles to the general
public. There is no systematic provision of traffic routes and hardly does any vehicle arrive at
a station in time. Under such circumstances people are compelled to waste a good part of their
busy hours just waiting for their buses to arrive. The system, ‘Smart Bus’ seeks for a solution
to this impending problem of public transportation in Nepal and focuses to make the vehicular
transportation systematic, in-time and easy.
The Smart Bus system is a system design based on Global Positioning System (GPS) and
Global System for Mobile Communications (GSM). The bus has an On-Board module which
consists of a GPS modem and a GSM modem interfaced with microcontroller. GPS receiver
identifies the location of the vehicle and the information of the vehicle’s location is sent to a
web server via GSM network using SMS service. People can know the whereabouts of the
vehicle by logging into a website through their mobile phone with internet accessibility.
The system is efficient, cost effective and useful in our nation’s context. It provides a real time
solution to the existing transportation system.
1.1.1. Background Research
The intelligent transportation system has already been developed and implemented by the
different countries. The different countries that already have implemented the system are:
Taipei Smart Bus System : This system consists of On-Board Technology and Bus
Stop Technology. The On-Board Technology consists of GPS devices and transit
control centre. The real time schedule is handled by the transit control centre. If a bus
2
arrival event is deviant from the assigned schedule, the transit centre will send the new
schedule to be displayed at bus stops and on the website.[1]
Singapore Bus Service Transit: The real time schedule is handled by SBS Transit
(Intelligent Route Information System) service for tracking real-time bus schedule
using GPS technologies. Passengers can access real-time schedule using WiFi-enabled
devices and by downloading iris NextBus related apps.[2]
Winnipeg Transit System: Bus riders in Winnipeg can access real-time bus schedule on
the Winnipeg Transit website, on their Smartphones, and via SMS text messages.
Winnipeg Transit’s Open Data Web Service provides a way for developers to retrieve
live information about Winnipeg Transit’s services.[3]
1.2. Objectives
The project objectives may be listed as below:
To be familiar with GPS and GSM technologies and techniques of logging data into
the server.
To keep trace of vehicle location and provide the vary information to the general
public.
To make transportation system systematic and time effective.
To design a system to ease traffic related problems in major cities of the country.
To learn to work in groups and to understand the importance of group work.
Another important objective, however is to use our theoretical knowledge that we have
gained so far in four years of our engineering career and so forth employ the same to
develop some practical or real life applications.
3
1.3. Methodology
Methods used include:
Acquiring the current position (latitude and longitude) of the vehicle using GPS
Module.
Reading the thus acquired information about vehicle serially using microcontroller and
storing it and displaying the information on LCD .
The information about vehicle like position, vehicle ID, Departure Place and
Destination place is sent serially to the number provided by VASP using GSM
Module using the AT command.
Extracting the message received from the VASP to display in the web page.
Mapping the data into a Google map using Google API.
Receiving the message from the Server and announcing the status of the vehicle based
on the message received.
Replying the mobile user with vehicle current position when asked about its
information.
Giving the message alert for the subscriber who has subscribed for a particular bus for
a particular location.
4
2. LITERATURE REVIEW
Vehicle tracking is finding its course and is an uprising subject in navigation and wireless
communication technology. Vehicle tracking and security applications using GPS and GSM
technology are being invented and implemented in different geographical locations in different
criteria. The use of GPS enabled vehicles has made life so easy that one can get to an unknown
place with no help of others at all. Different projects concerning vehicle tracking are proposed
and are implemented intended to make transportation and navigation easier, effective and
systematic. So far no projects and sufficient research have been done concerning this topic in
Nepal. Our project is an attempt to make something useful to make the public transportation
somewhat regulated and man friendly.
A similar project is done by the students of the university of Victoria Under title “Design a
Smart Bus System” where the students have tried to explore ideas of integrating the Victoria
Regional Transit System with appropriate communication technologies developing a
corresponding Smartphone app. In the SBS, users can access real-time passenger information
such as schedules, trip planners, bus capacity estimates, bike rack availability and bus
stop locations, via Smartphone, on computers and at bus stops. This system is inclusive
to all users including people with special needs.[4] Here the GPS is used to obtain the current
location of the bus and the obtained location in latitude and the longitude is fetched to the
central server using the GSM. The user can obtain the information by logging into the site.
Beside this, the data is also transmitted to the bus station where obtained data is displayed in
the LED and audio is played through the Speaker which helps the Visually Impaired people
to access the Bus through which they want to reach their destination.
Another similar project under Titled “User Triggered Bus Identification and Homing
System: Making Public Transport Accessible For the Visually Challenged” is done by
the students of the Indian Institute Of Technology where the system comprises of three
modules:
5
User Module
Bus Module, placed in each bus and
Programming unit, changes route numbers at the depot.[5]
Once the user hears a bus approaching the bus stop, he or she presses the Query Button on the
User Module, transmitting a RF signal to all buses in the vicinity. Each bus responds by
transmitting its route number. All numbers received are sequentially read out by the user
module. The user selects the desired route number by pressing the Selection Button
which triggers a voice output at the entry of the selected bus. This acts as an auditory cue and
assists in moving towards the gate of the bus. The system allows flexibility to customize
operation according to user specific bus usage patterns, saving time and effort. Using an
auditory interface, the user can store the route numbers of commonly boarded buses (called a
restricted set) in the user module. This allows the user to concentrate only on relevant bus
numbers by filtering out the undesired ones while querying. The modes of operation available
are:
Auto-Query mode (optionally with a restricted set): The device automatically
scans for buses and notifies the user.
Pre-selection mode: In case the user is interested in boarding one particular bus, he or
she can store its route number in advance and use the selection button to check
if the desired bus is present at the bus stop. This allows the user to skip the query
phase and immediately check for desired bus.
6
3. COMPONENTS AND TECHNIQUES
1)
2)
1.
2.
1.
2.
3.
3.1.
2.
3.
3.1. Global Positioning System
The Global Positioning System 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.[6] It is maintained by the
United States government and is freely accessible to anyone with a GPS receiver.
A GPS receiver calculates its position by precisely timing the signals sent by GPS satellites
high above the Earth. Each satellite continually transmits messages that include
Time the message was transmitted
Satellite position at time of message transmission.
7
The receiver uses the messages it receives to determine the transit time of each message and
computes the distance to each satellite using the speed of light. Each of these distances and
satellites' locations define a sphere. The receiver is on the surface of each of these spheres
when the distances and the satellites' locations are correct. These distances and satellites'
locations are used to compute the location of the receiver using the navigation equations. This
location is then displayed with latitude and longitude; elevation or altitude information may be
included. Many GPS units show derived information such as direction and speed, calculated
from position changes.
3.1.1. Structure
The current GPS consists of three major segments.
Space segment
Control segment
User segment
1.1.1.
GPS satellites broadcast signals from space, and each GPS receiver uses these signals to
calculate its three-dimensional location (latitude, longitude, and altitude) and the current time.
Space Segment.
The SS is composed of the orbiting GPS satellites. The orbits are centered on the Earth, not
rotating with the Earth, but instead fixed with respect to the distant stars. The six orbit planes
have approximately 55° inclination (tilt relative to Earth's equator) and are separated by 60°
right ascension of the ascending node (angle along the equator from a reference point to the
orbit's intersection). Orbiting at an altitude of approximately 20,200 km orbital radius of
approximately 26,600 km each SV makes two complete orbits each sidereal day, repeating the
same ground track each day. There are 32 satellites in the GPS constellation. The additional
satellites improve the precision of GPS receiver calculations by providing redundant
measurements.
8
Figure 3.1: Orientation of GPS Satellites in Space (Source: Wikipedia)
Control Segment .
The control segment is composed of
a MCS
an alternate master control station
four dedicated ground antennas and
six dedicated monitor stations
Satellite maneuvers are not precise by GPS standards. So to change the orbit of a satellite, the
satellite must be marked unhealthy, so receivers will not use it in their calculation. Then the
maneuver can be carried out, and the resulting orbit tracked from the ground. Then the new
ephemeris is uploaded and the satellite marked healthy again.
User Segment .
GPS receivers are composed of an antenna, tuned to the frequencies transmitted by the
satellites, receiver-processors, and a highly stable clock (often a crystal oscillator). They may
also include a display for providing location and speed information to the user. A receiver is
9
often described by its number of channels: this signifies how many satellites it can monitor
simultaneously. This has progressively increased between 12 and 20 channels.
3.1.2. GPS Operation
GPS satellites broadcast radio signals to enable GPS receivers on or near the Earth's surface to
determine location and synchronized time. GPS signals include ranging signals, used to
measure the distance to the satellite, and navigation messages. The navigation messages
include ephemeris data, used to calculate the position of each satellite in orbit, and information
about the time and status of the entire satellite constellation, called the almanac. The GPS
receiver will pick up the GPS signal. The GPS signal is made up of 3 different bits of data
which are known as pseudo random code, almanac data and ephemeris data as follows:
Pseudorandom code: It is the ID code that detect which satellites are broadcasting
information. It also tells the time difference between the transmitter and receiver.
GPS satellites are around 20,000,000 meters above the Earth. The shift, which due to
propagation delay is the so-called “Time difference”. Time difference can be computed
using the formula as shown below:
Time Difference (in seconds) * 2.99792458 108 meters/second = Distance (in meters)
Almanac data: Data which has orbital parameters to differentiate between which
satellite is to be seen on the GPS receiver in the unobstructed sky. As such, the receiver
will know which satellite to follow. However, this Almanac data is not accurate as
it can be valid for several months.
An Ephemeris data: It allows the receiver to know where the GPS satellite is at
any point of time in the day. Conversely, this Ephemeris data can be only valid for 2 to 4
hours.
10
Essentially, it is quite accurate as the GPS receiver receives the signal to provide the orbital
information that interprets the path which the satellite is following as its orbit around.
With the aid of pseudorandom code, almanac data and ephemeris data, the GPS receiver can
easily determine the time, date, distance from satellite, velocity and satellite status and
coordination. For the GPS receiver’s location, a process called triangulation is used. And there
will a shift in frequency called Doppler Effect.
3.1.3. Triangulation
For the determination of exact position GPS receiver uses the method of triangulation which
calculates three or more distance of satellites. Two satellites are centered in a sphere at some
distances from the sphere. The point of intersection of two spheres defines the location points.
However, the true location cannot be determined if the average area is too large. So using a
third satellite we can determine two points where the 3 satellite spheres intersect. These 2
points are far apart, so to find a true location a 4th satellite is needed.
So knowing distance from one satellite gives some point where on a spherical surface that's
centered on the satellite. Knowing distances from two satellites gives some point somewhere
along a circle that's between the two satellites and defined by the intersection of their "distance
spheres". Distances from three satellites usually intersect at two points and distances from four
or more GPS satellites will intersect at just one point. Thus this process works by finding the
intersection of distances from three or more satellites.
3.1.4. GPS Frequency
Every satellite transmits at two different frequencies called L1 and L2 frequencies. L1
has a frequency of 1575.2MHz and L2 a frequency of 1227.6MHz. These carrier
frequencies were chosen for GPS because the atmosphere is transparent to them. Also,
two frequencies are used instead of one because this allows easy correction for the effect
of the ionosphere on the signal propagation. The ionosphere slows the signals and bends their
11
path. However, ionosphere slows down the lower frequencies more than the higher
ones. Comparing the difference in signals' delay times allows removing the effect of the
ionosphere. The two carriers are modulated by various signals. Both L1 and L2 frequencies
carry and broadcast satellite messages which are a low frequency data stream
containing information about the satellites' position.
3.1.5. GPS Standard Format
Due to GPS manufacturers using their own format for GPS data representation it
would be difficult to use the data due to format differences. To overcome this problem various
standards has been made. Some of them are RINEX, RTCM SC-104, NMEA 0813.
3.1.6. The NMEA 0183
It refers to a data stream in ASCII format. The NMEA 0183 data stream includes information
on position, datum, water depth and other variables. The data is sent in the form of sentence
each starting with a $ sign and terminating with a carriage return –line feed. The $ sign is
followed by five characters address field which identifies the talker, the data type and the
string format of the successive fields. The last field in any sentence is a check sum filed which
follows a checksum delimiter “*”. The maximum total number of characters in any sentence is
82.
Our sentence of interest is GGA which is Global Positioning System fix data. This sentence
represents the time and position.
The structure of the sentence is as below:
$GPGGA,hhmmss.ss.llll.ll,a,yyyyy.yy,a.x,xx,.x.x.x.x,M,x.x,xxxx*hh<CR><LF>
$ Start of sentence delimiter
GP Talker identifier (GPS in this case)
GGA Data identifier (GPS fix data in this case)
12
, Data field delimiter
hhmmss.ss Time of position in UTC system (hours minutes seconds .decimal)
llll.ll Latitude (degrees minutes. decimal)
A N/S(North or South)
yyyy.yy Longitude (degrees minutes .decimal)
A E/W (East or West)
X GPS quality indicator (1=points positioning with C/A-code)
Xx Number of satellites used in producing the solution
x.x HDOP
x.x Orthometric Height
M Meters (units of orthometric Height)
x.x Meters (units of Geoidal Height)
Xxxx Age of DGPS data in seconds (time since last RTCM message type 1 or 9
was received; null field when DGPS mode is not used
* Checksum delimiter character
Hh Checksum field (last field in the sentence)
<CR><LF> Sentence termination
Table 3.1: GGA data format
3.2. Global System for Mobile Communication
Global System for Mobile Communications is a standard set developed by the ETSI to
describe protocols for 2G digital cellular networks used by mobile phones. The GSM standard
was developed as a replacement for 1G analog cellular network, and originally described a
digital, circuit-switched network optimized for full duplex voice telephony. This is expanded
over time to include data communications, first by circuit-switched transport, then packet data
transport via GPRS and EDGE.
13
3.2.
3.2.1. GSM Network Structure
The GSM Network Structure consists of following sections.
BSS – the base stations and their controllers
Network and Switching Subsystem – the part of the network most similar to a fixed
network, sometimes just called the "core network".
GPRS Core Network – the optional part which allows packet-based Internet
connections
OSS – network maintenance
Figure 3.2: GSM Network Structure
14
3.2.2. GSM carrier frequencies
GSM networks operate in a number of different carrier frequency ranges with most 2G GSM
networks operating in the 900 MHz or 1800 MHz bands. In Asia, most of the providers use
900 MHz and 1800 MHz bands. GSM-900 is most widely used.
Regardless of the frequency selected by an operator, it is divided into timeslots for individual
phones. This allows eight full-rate or sixteen half-rate speech channels per radio frequency.
These eight radio timeslots are grouped into a TDMA frame. Half-rate channels use alternate
frames in the same timeslot. The channel data rate for all 8 channels is 270.833 kbit/s, and the
frame duration is 4.615 ms.
3.2.3. Subscriber Identity Module
A SIM is an integrated circuit that securely stores the IMSI and the related key used to
identify and authenticate subscribers on mobile telephony devices.
A SIM circuit is embedded into a removable plastic card. This plastic card is called a "SIM
card" and can be transferred between different mobile devices. A SIM card follows certain
smart card standards. A SIM card contains its unique serial number (ICCID), IMSI, security
authentication and ciphering information, temporary information related to the local network,
a list of the services the user has access to and two passwords: a PIN for ordinary use and a
PUK for PIN unlocking.
3.2.4. GSM Data Transmission
The GSM standard provides separate facilities for transmitting digital data. This allows a
mobile phone to act like any other computer on the Internet, sending and receiving data via the
Internet Protocol.
15
General Packet Radio Service.
The GPRS is a packet-switched data transmission protocol. It is backwards-compatible with
systems that use pre-1997 versions of the standard. GPRS does this by sending packets to the
local mobile phone mast (BTS) on channels not being used by circuit-switched voice calls or
data connections. Multiple GPRS users can share a single unused channel because each of
them uses it only for occasional short bursts.
Short Message Service.
SMS is the most used data application on mobile phones. The messages are usually sent from
mobile devices via the SMSC using the MAP protocol. The SMSC is a central routing hub for
Short Messages. Many mobile service operators use their SMSCs as gateways to external
systems, including the Internet, incoming SMS news feeds, and other mobile operators.
Messages are sent to a SMSC, which provides a “store and forward” mechanism. It attempts to
send messages to the SMSC's recipients. If a recipient is not reachable, the SMSC queues the
message for later retry. Some SMSCs also provide a “forward and forget” option where
transmission is tried only once. SMS is a stateless communication protocol in which every
SMS message is considered entirely independent of other messages.
3.2.5. Message size
Transmission of short messages between the SMSC and the handset is done whenever using
the MAP of the SS7 protocol. Messages are sent with the MAP MO- and MT-Forward SM
operation. Short messages can be encoded using a variety of alphabets: the default GSM 7-bit
alphabet, the 8-bit data alphabet, and the 16-bit UCS-2 alphabet. Depending on which alphabet
the subscriber has configured in the handset, this leads to the maximum individual short
message sizes of 160 7-bit characters, 140 8-bit characters, or 70 16-bit characters. GSM 7-bit
alphabet support is mandatory for GSM handsets and network elements.
16
3.2.6. AT commands
Many mobile and satellite transceiver units support the sending and receiving of SMS using an
extended version of the Hayes command set, a specific command language originally
developed for the Hayes Smart modem 300-baud modem in 1977.
The connection between the terminal equipment and the transceiver can be realized with a
serial cable (e.g., USB), a Bluetooth link, an infrared link, etc.
Common AT commands include:
AT+CMGS (send message)
AT+CMSS (send message from storage)
AT+CMGL (list messages) and
AT+CMGR (read message).
3.3. Value Added Service Provider
In telecommunications industry Value-added service (VAS) are the services beyond standard
voice calls and fax transmissions. On a conceptual level, value-added services add value to the
standard service offering, spurring the subscriber to use their phone more and allowing the
operator to drive up their ARPU (Average revenue per user).
Value-added services are supplied either in-house by the mobile network operator themselves
or by a third-party value-added service provider (VASP), also known as a content provider
(CP). They typically connect to the operator using protocols like Short message peer-to-peer
protocol (SMPP), connecting either directly to the short message service centre (SMSC) or,
increasingly, to a messaging gateway that gives the operator better control of the content.
17
3.3.
3.3.1. Sparrow SMS
Sparrow SMS is a mobile marketing solution to help businesses acquire and engage
customers. It is one of the VAS providers in Nepal. Sparrow SMS was Initiated by Janaki
Technology Pvt. Ltd in 2010 to provide SMS services to general public as well as business
enterprises to communicate and promote their products and business.
We have used the Sparrow SMS service in order to bridge the GSM network and the Internet
so that the system could communicate with its various parts. The service provides a short code
in which we have to send SMS from our GSM module. We can choose our own keyword and
API Endpoint.
The Service provider forwards the keyword, text and messaging time, which can be used for
various purposes as per our requirement.
3.4. Serial Data Transmission
The digital data can be transmitted between any two devices in two ways, parallel or serial.
Serial data transmission means information is transmitted from source to destination over a
single pathway and one bit is transmitted at a time. There are two modes of serial data
transmission.
Simplex: Data is transmitted in single direction.
Duplex: Data is transmitted in either direction.
Half duplex: Transmission can be done on both direction but not simultaneously.
Full duplex: Transmission can be done on both direction and simultaneously.
18
3.5. Asynchronous Serial Data Transmission
The receiving and transmitting devices need not to be synchronized in asynchronous serial
data transmission system. The transmitting device can send one or more data units when it is
ready to send data. Each data unit must be formatted i.e. it must be transformed into specified
format before transmission.
For asynchronous transmission, each data character has bit which identifies its start and 1 or 2
bits which identify its end. Since each character is individually identified, characters can be
sent at any time i.e. asynchronously.
3.4.
3.5.
3.5.1. UART
A Universal Asynchronous Receiver/Transmitter, abbreviated UART is a piece of computer
hardware that translates data between parallel and serial forms.
A UART is usually an individual (or part of an) integrated circuit used for serial
communications over a computer or peripheral device serial port. UARTs are now commonly
included in microcontrollers. A DUART, combines two UARTs into a single chip. Many
modern ICs now come with a UART that can also communicate synchronously; these devices
are called USARTs.
The UART takes bytes of data and transmits the individual bits in a sequential fashion. At the
destination, a second UART re-assembles the bits into complete bytes. Each UART contains a
shift register, which is the fundamental method of conversion between serial and parallel
forms. Serial transmission of digital information (bits) through a single wire or other medium
is less costly than parallel transmission through multiple wires.
The UART usually does not directly generate or receive the external signals used between
different items of equipment. Separate interface devices are used to convert the logic level
signals of the UART to and from the external signaling levels. External signals may be of
19
many different forms. Examples of standards for voltage signaling are RS-232, RS-422 and
RS-485 from the EIA.
3.6. Microcontroller
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
NOR flash or 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.
Microcontrollers are used in automatically controlled products and devices, such as
automobile engine control systems, implantable medical devices, remote controls, office
machines, appliances, power tools, toys and other embedded systems. By reducing the size and
cost compared to a design that uses a separate microprocessor, memory, and input/output
devices, microcontrollers make it economical to digitally control even more devices and
processes. Mixed signal microcontrollers are common, integrating analog components needed
to control non-digital electronic systems.
Microcontrollers that we used in our project are PIC 16f877A and Atmega-8.
3.7. Liquid Crystal Display
LCD is an electronic visual display device. It uses the light modulating properties of liquid
crystals. It has been used to display current position (latitude, longitude, time, height,
number of satellite).
The ability of LCD to display numbers, characters, and graphics and its low price and easy
availability in the market encouraged us in using it. LCD incorporates a refreshing controller.
Based on the command it can be operated in four bit and eight bit mode.
20
3.8. Multimedia Card
It refers to a flash memory card standard. MMC is used as a storage medium for a portable
device. Modern computers, both laptops and desktops, often have SD slots, which can read
MMCs if the operating system drivers support them.
Communication is based on serial bus designed to operate in a low voltage range. The Multi
Media Card identification and addressing methods are replaced by a hardware Chip Select
signal. For every command, a card is selected by asserting the CS signal. The CS signal must
be continuously active for the duration of the SPI transactions. The MM card bidirectional
CMD and DAT lines are replaced by unidirectional DATA in and DATA out signals.
PIN Signal Description
1 CS Chip select(neg.true)
2 DI DATA in
3 Vss Ground
4 Vcc Power Supply
5 SCLK Clock
6 Vss2 Ground
7 DO Data Out
Table 3.2: Pin Description of MMC
3.9. FAT16
21
FAT (File allocation table) is the name of computer file system architecture and a family of
industry standard files systems utilizing it.
Thus is a well-suited format for data exchange between computers and devices. The
configuration files of every sector are expressed by 16 bytes in FAT16 and this is why it is
named FAT16. Because of the innate limitation, when it exceeds the regular capacity of the
sector, the number of the cluster must be expanded to adapt to larger disk space. Cluster is the
allocation unit of disk space, just as a grid of bookshelf in library. Every file must be allocated
enough clusters, and then it can be stored on the disk.
The relationship between capacities of sector and cluster in FAT 16 are following:
Capacity of Sector (MB) Capacity of Cluster (KB)
16-127 2
128-255 4
256-511 8
512-1023 16
1024-2047 32
Table 3.3: Capacity of Sector and Cluster in Fat 16
3.10. LM386
TheLM386 is a power amplifier designed for use in low voltage consumer applications. The
gain is internally set to 20 to 200 keep external part count low, but the addition of an external
resistor and capacitor between pins 1 and 8 will increase the gain to any value from 20 to 200.
22
Figure 3.3: Pin Diagram for LM386
The inputs are ground referenced while the output automatically biases to one-half the supply
voltage. The quiescent power drain is only 24milliwatts when operating from a 6volt supply,
making the LM386 ideal for battery operation.
Figure 3.2: Schematic Diagram for LM386
23
Figure 3.3: Application Circuit for LM386 Audio Amplifier
Features
Battery operation
Minimum external parts
Wide supply voltage range:4V–12V or 5V–18V
Low quiescent currentdrain:4mA
Voltage gain from20 to 200
Ground referenced input
Self-centering output quiescent voltage
Lowdistortion:0.2%(AV =20,VS =6V,RL =8Ω,PO =125mW,f=1kHz)
3.11. Local Host
In computer networking, local host means user computer. It is a hostname (nickname that is
given to a device connected to a computer network) that the computer's software and users
may employ to access the computer's own network services via its loopback (routing of
electronic signals, digital data streams, or flows of items back to their originating devices)
network interface. On most computer systems, local host resolves to the address 127.0.0.1,
which is the most-commonly used IPv4 loopback address.
The local loopback mechanism (local host) is useful for programmers to test software during
development independent of any networking configurations.
3.12. Server
Web Server is the hardware (the computer) or the software (the computer application) that
helps to deliver web content that can be accessed through the Internet. The primary function
of a web server is to serve web page to the request of clients using the Hypertext Transfer
24
Protocol (HTTP). This means delivery of HTML documents and any additional content that
may be included by a document, such as images, style sheets and scripts.
A user agent, commonly a web browser or web crawler, initiates communication by making a
request for a specific resource using HTTP and the server responds with the content of that
resource or an error message if unable to do so. The resource is typically a real file on the
server's secondary storage, but this is not necessarily the case and depends on how the web
server is implemented.
Many generic web servers also support server-side scripting using Active Server Pages (ASP),
PHP, or other scripting languages. This means that the behavior of the web server can be
scripted in separate files, while the actual server software remains unchanged. The former is
primarily used for retrieving and/or modifying information from databases. The latter is
typically much faster and more easily cached.
3.13. HTTP (Hyper Text Transfer Protocol)
HTTP is the data transfer protocol used on the World Wide Web. Hypertext is structured text
that uses logical links (hyperlinks) between nodes containing text. HTTP is the protocol to
exchange or transfer hypertext.
HTTP defines how messages are formatted and transmitted, and what actions Web servers and
browsers should take in response to various commands. For example, when you enter a URL
in your browser, this actually sends an HTTP command to the Web server directing it to fetch
and transmit the requested Web page.
3.14. Scripting Language
A high-level programming language that is interpreted by another program at runtime rather
than compiled by the computer's processor as other programming languages (such as C and C+
+) is Scripting language. They can be embedded within HTML, and are used to add
functionality to a Web page, such as different menu styles or graphic displays or to serve
dynamic advertisements. These types of languages are client-side scripting languages,
25
affecting the data that the end user sees in a browser window. Other scripting languages are
server-side scripting languages that manipulate the data, usually in a database, on the server.
JavaScript, ASP, JSP, PHP, Perl, and Python are examples of scripting languages.
3.15. Database management systems (DBMSs)
A database is an organized collection of data. The data are typically organized to model
relevant aspects of reality in a way that supports processes requiring this information.
Database management systems (DBMSs) are specially designed applications that interact with
the user, other applications, and the database itself to capture and analyze data. A general-
purpose database management system (DBMS) is a software system designed to allow the
definition, creation, querying, update, and administration of databases. Well-known DBMSs
include MySQL, PostgreSQL, SQLite, Microsoft SQL Server, Microsoft Access, Oracle, SAP,
dBASE, FoxPro, IBM DB2, LibreOffice Base and FileMaker Pro.
3.16. FTP/FTP Client
FTP stands for File Transfer Protocol. Using an FTP client is a method to upload, download,
and manage files on our server.
FTP is a commonly used protocol for exchanging files over any network that supports the
TCP/IP protocol. There are two computers involved in an FTP transfer: a server and a client.
The FTP server, running FTP server software, listens on the network for connection requests
from other computers. The client computer, running FTP client software, initiates a connection
to the server. Once connected, the client can do a number of file manipulation operations such
as uploading files to the server, download files from the server, rename or delete files on the
server and so on. Virtually every computer platform supports the FTP protocol. This allows
any computer connected to a TCP/IP based network to manipulate files on another computer
on that network regardless of which operating systems are involved (if the computers permit
FTP access).
26
3.17. Domain Name
Domain names are used to identify one or more IP addresses. Domain names are used in
URLs to identify particular web pages.
Eg. http://www.ioe.edu.np/ is the domain name of the website of IOE, Tribhuwan University,
Nepal. Every domain name has a suffix that indicates which top level domain (TLD) it
belongs to. There are only a limited number of such domains.
Because the Internet is based on IP addresses, not domain names, every Web server requires a
Domain Name System (DNS) server to translate domain names into IP addresses.
Figure 3.4: The hierarchy of labels in a domain name (source: http://en.wikipedia.org/wiki/File:DNS-names-ru.svg)
27
3.18. Web Hosting
A web hosting service is a type of Internet hosting service that allows individuals and
organizations to make their website accessible via the World Wide Web.
Single page hosting is generally sufficient for personal web pages. A complex site calls for a
more comprehensive package that provides database support and application development
platforms (e.g. PHP, Java, Ruby on Rails, ColdFusion, or ASP.NET). These facilities allow
customers to write or install scripts for applications like forums and content management.
Also, Secure Sockets Layer (SSL) is typically used for e-commerce. The host may also
provide an interface or control panel for managing the Web server and installing scripts, as
well as other modules and service applications like e-mail.
3.19. APIs’
An application-programming interface (API) is a set of programming instructions and
standards for accessing a Web-based software application or Web tool. A software company
releases its API to the public so that other software developers can design products that are
powered by its service.
An API is a software-to-software interface, not a user interface. With APIs, applications talk to
each other without any user knowledge or intervention.
28
4. PROJECT OVERVIEW
3)
4)
4.1. System Block Diagram
Figure 4.4: System Block Diagram
29
This project entitled “GPS GSM Integration for Enhancing Public Transportation System” is
broadly classified into three sections;
Embedded System in Vehicle
Web Server
Embedded System in Station
4.
4.1.
4.1.1. Embedded System in Vehicle
The embedded system in the vehicle contains three main components.
GPS Receiver: It receives the GPS signal from the satellite. The signal contains
different information like date, time, latitude and longitude at the time of transmission
from the satellite.
Microcontroller: Microcontroller is serially interfaced with the GPS and GSM module.
The signal received from the GPS Receiver is decoded and is passed to the GSM
Modem.
GSM Modem: The GSM as mentioned earlier is serially interfaced with the
microcontroller and operates depending upon the AT command it receives from the
Microcontroller. Thus received message from the microcontroller is sent to the web
server through the SMS.
LCD: The LCD is used for displaying the current position of the vehicle.
30
Flow Diagram
Figure 4.5: Flow Diagram of system in the vehicle
Working Principle
The GPS module interfaced serially to the microcontroller receives the signal from the
satellite. The received signal is sent to the microcontroller serially at the baud rate of 4800 bits
per second. The data thus sent are of different formats like RINEX, RTCM SC-104, NMEA
0813. Among which NMEA0813 format having $GPGGA is desirable. This format contains
different information like Universal Time Constant, Latitude, and Longitude. The Latitude and
31
longitude thus is received by the microcontroller and placed on the variable latitude and
longitude in the microcontroller. On successfully receiving the latitude and longitude it is
transferred to the web server which requires message to be sent to the VASP gateway. For
transmitting the message AT commands are needed to be transferred to the GSM module. For
this the GSM module is serially interfaced to the microcontroller. The GSM module has
capable of setting baud rate automatically. For simplicity the baud rate is fixed at 4800 bits per
seconds. Now the commands can be serially transferred to the microcontroller and the
response to the command is replied by the microcontroller. Due to limitation of hardware
UART in PIC16F877A we are not using the TX pin of the GSM module. The command
sequence is:
AT + carriage return
AT+CMGF=1 + carriage return
AT+CMGS=”mobile number” +carriage return
KEY WORD latitude longitude + ASCII value of CTRL+Z
Here the keyword is provided by VASP while registering the mobile number. Based on the
keyword the message is transferred to the web server.
4.1.2. Web Server
Flow Diagram
32
Figure 4.6: Flow Diagram of various API for subscription and sending of message
Working Principle
The VASP (Value Added Service Provider) gets the information like vehicle identification,
place of departure, place of destination, latitude and longitude from the GSM module in the
vehicle via GSM network. The data provided in the SMS is then redirected to the API
endpoint (API endpoint is a PHP file in the server). The encoded user information is appended
to the page requested by the GET method.
$keyword = $_GET["keyword"];
$from = $_GET["from"];
$text = $_GET["text"];
33
The API Endpoint then interacts with the data base in order to extract, insert or edit
information in the database in the server. The end users can be benefited directly with a HTTP
request. The users can also get the information about the vehicle by text messaging to a certain
keyword via VASP. They can even create a message alert in their Cell phone. Whenever a
vehicle is about to reach the station a text message is sent to the station with the reference of
which the vehicle arrival information is announced.
4.1.3. Embedded System at Station
The Embedded system in station consists of the following hardware components.
GSM Module: It is used to receive the message sent from the web server. The
message contains information about the vehicle like vehicle ID, Destined Place,
departure Place and the current position of it.
Microcontroller: It is used for interfacing with GSM module, LCD and the audio
speaker. Sends the AT command serially to the GSM Module and thus extracts the
message send from the server.
LCD: Used for displaying the information like vehicle ID, Destined Place, departure
Place and the current position of it.
Audio Speaker: Used to play the audio information about the vehicle Status.
34
Flow Diagram
Figure 4.7: Flow Diagram of system at the station
Working Principle
The information sent by the GSM module is extracted and the Vehicle ID is obtained. Then
according to the vehicle ID the WAV audio file associated to it is sent to the PWM of Atmega-
8. The audio signal in the MMC read through Atmega-8 is amplified by LM386 and played
through the speaker.
35
36
5. METHODOLOGY
5)
5.1. Hardware Implementation
5.
5.1.
5.1.1. Liquid Crystal Display
The LCD used for the project is LM016L. The following table shows the pin diagram of the
LCD along with the function of each pin.
37
Table 5.4: Pin out function for LCD LM016L
Although the datasheet specifies 5Volt dc supply as the working voltage it can work in 6 Volt
as well as 4.5 Volt. For functioning of the LCD the command needed to be transferred
parallel. The table shows the command control codes for the LCD.
Table 5.5: Command Control Code
The signal on RS pin of the LCD determines whether the data bytes transferred are commands
or data. When this pin is low the data bytes transferred to LCD is treated as command and data
bytes are treated as data when this pin is high. Similarly the enable pin is used to initiate the
actual transfers of commands or character between module and data line. While writing to the
display, data is transferred only on high to low transition of the signal on this pin.
38
Interfacing LCD with Microcontroller.
Here the lcd LM016L is used in 4 bit mode. Lcd is initialized in 4 bit mode by instruction
from the microcontroller. As the lcd is initialized the data and command can be provided. The
lcd distinguishes whether the received information is a command or data by checking the
signal. If the signal on the RS line is low then it interprets that the received byte as command
else as data. The data is written to the
lcd during the high to low transition of
the signal on the enable pin.
Figure 5.8: Basic Diagram for Interfacing LCD in 4 bit mode with Microcontroller
5.1.2. GPS
We used GT-320RW as a GPS receiver in this project. The GT-320RW is a compact all-in-
one GPS module intended for a broad range of OEM products, where fast and easy system
integration and minimal development risk is required. The module continuously tracks all
satellites in view and provides accurate satellite positioning data. Its 16 parallel channels and
4100 search bins provide fast satellite signal acquisition and short startup time. Its low power
consumption is suitable for a wide range application in handhelds, sensors, asset tracking, and
vehicle navigation products.
Both the LVTTL-level and RS232-level serial interface are provided on the interface
connector. Supply voltage of 3.8V~8.0V is supported.
39
Features:
16 parallel channels GPS receiver
4100 simultaneous time-frequency search bins
-140dbm acquisition sensitivity
Hot start <5 second
Cold start <60 second
Power consumption <45mA
5m CEP accuracy
Input Voltage 3.7V-5V
Operating Temperature -40 - +85 degree
Pin
Number
Signal Name Description
1 Serial Data Asynchronous serial output at LVTTL level, to output
2 Serial Data In Asynchronous serial input at LVTTL level, to input
3 Serial Data Asynchronous serial output at RS-232 level, to output NMEA
4 Data In 2 Asynchronous serial input at RS-232 level, to input command
5 Power 3.8V ~ 8.0V DC input
6 Ground Power and signal ground
Table 5.3: Pin out Function Description of GPS
40
Simulation of GPS using Hyper Terminal.
Figure 5.5: Data obtained from GPS using Hyper Terminal.
The data shown within the red line is the required data to be extracted from the GPS module. It
shows that the data Is started from the $GPGGA followed by Universal time Constant,
Latitude, Longitude and the time stamp.
Interfacing GPS with PIC 16F877A.
Figure 5.6: Interfacing of GPS with PIC 16F877A
41
5.1.3. GSM
GSM module used in this project is SIMCOM’S SIM 300. It works on frequencies
EGS900MHZ, DCS1800MHZ, and PCS1 1900MHZ. The module is fitted with standard
interface for a power supply, an antenna, a pc and a headset with its plug and play
technology. It uses SIM Card and can be controlled by means of AT Commands.
Features:
Highly Reliable for 24x7 operation with Matched Antenna
Status of Modem Indicated by LED
Simple to Use & Low Cost
Quad Band Modem supports all GSM operator SIM cards
Figure 5.7: GSM SIM300 Modem
Interfacing GSM modem with PIC16F877A .
A GSM modem is used in the data acquisition section of the project for transmitting
the measured GPS data to the central server or the logging section via SMS. The
42
modem is given the appropriate AT commands by the microcontroller to which it is interfaced
through a serial port.
Figure 5.8: GSM interfacing with PIC 16F877A using both TD and RD line
The connection between a data terminal device and a modem is termed as null modem
connection. There are various kinds of null modem connections among which a simple
data transfer mechanism without the use of handshaking is employed in this project. A
COM-connector, is used for connecting the serial port pins of the microcontroller and the
modem. Since handshaking is not used, the signal lines: DTR, DCD, RTS, CTS, RI and
DSR are left unconnected.
Software flow control mechanism is employed for transferring the data between the
microcontroller and a modem.
AT commands used to send SMS in text mode.
AT+CMGF=1 +carriage return
AT+CMGS=”mobile number” carriage return
Once The AT commands is given’ >’ prompt will be displayed on the screen.
Type the message to send via SMS. After this, press “ctrl+Z” to send the SMS.
43
If the SMS sending is successful, “ok” will be displayed along with the message
number
Figure 5.9: Null modem connection of GSM modem with PIC
44
6. Software Implementation
6)
6.1. Apache (2.2.19) Server
We used Apache Server for serving the website in the Webhost Service Provider .The Apache
HTTP Server, commonly referred to as Apache is a web server application notable for playing
a key role in the initial growth of the World Wide Web.
Apache supports a variety of features, many implemented as compiled modules which extend
the core functionality. These can range from server-side programming language support to
authentication schemes. Some common language interfaces support Perl, Python, Tcl, and
PHP.
4.
5.
6.
6.1.
6.2. My SQL(5.1)
The Database Management System (DBMS) that we have used in order to manage the
database of the vehicle, users information is My SQL.
MySQL is the world's most widely used open-source relational database management system
(RDBMS) that runs as a server providing multi-user access to a number of databases.
Features of MySQL:
Relational Database System
Client/Server Architecture
45
SQL compatibility
User interface
Programming languages
Platform independence
6.3. FileZilla (3.7.3)
FileZilla Client is a fast and reliable cross-platform FTP, FTPS and SFTP client with lots of
useful features and an intuitive graphical user interface.
6.4. XAMPP (1.7.4)
XAMPP is a free and open source cross-platform web server solution stack package,
consisting mainly of the Apache HTTP Server, MySQL database, and interpreters for scripts
written in the PHP and Perl.
We used XAMPP for using Apache HTTP Server, MySQL database , and interpreters for
scripts written in the PHP.
6.5. Web Hosting Service Provider (000webhost.com)
000webhost.com ($0.00 webhost), is an industry leader in providing top class free web hosting
services. Every account receives 1500MB space and a whopping 100GB bandwidth was the
main point of attraction about this Web Host. As the project is not yet commercially launched
and we can tolerate server overload sometimes we planned to use its free webhosting service.
It also supports various software/services like My SQL, phpMyAdmin, Website Builder, File
Manager, Free Domain Name etc.
46
6.
6.1.
6.2.
6.3.
6.4.
6.5.
6.5.1. Domain Name (.net78.net)
The webhost also provides free domain name as “.net78.net”.We registered our website with
domain name www.smartbussystem.net78.net in 000webhost.com.
6.6. HTML
Hyper Text Markup Language (HTML) is the main markup language for displaying web
pages and other information that can be displayed in a web browser. HTML is written in the
form of HTML elements consisting of tags enclosed in angle brackets (like <html>),
within the web page content. HTML tags most commonly come in pairs like <h1> and
</h1>, although some tags, known as empty elements, are unpaired, for example <img>.
The first tag in a pair is the start tag, the second tag is the end tag (they are also called
opening tags and closing tags). In between these tags web designers can add text, tags,
comments and other types of text-based content.
Web browsers can also refer to Cascading Style Sheets (CSS) to define the appearance
and layout of text and other material.
6.7. PHP 5.3.5
PHP(Hypertext Preprocessor) is a general-purpose server-side scripting language
originally designed for Web development to produce dynamic Web pages. It is one of
47
the first developed server-side scripting languages to be embedded into an HTML source
document rather than calling an external file to process data. The code is interpreted by a
Web server with a PHP processor module which generates the resulting Web page.
PHP generally runs on a web server. Any PHP code in a requested file is executed by the PHP
runtime, usually to create dynamic web page content or dynamic images used on Web sites
or elsewhere. It can also be used for command-line scripting and client-side graphical user
interface (GUI) applications. PHP can be deployed on most Web servers, many operating
systems and platforms, and can be used with many relational database management systems
(RDBMS).
48
Figure 6.1: Working of Server database and PHP
6.8. JavaScript
JavaScript is a programming language used to make web pages interactive. It runs on
visitor's computer and doesn't require constant downloads from website. It is programming
code that can be inserted into HTML pages to be executed by web browser. Most of the
APIs’ that we have used are scripted in JavaScript.
6.9. APIs’
We have used some of the most widely used API of Google and the VASP (Sparrow SMS
Service) .They are discussed below:-
49
6.6.
6.7.
6.8.
6.9.
6.9.1. Google Maps API for embedding Google map in the webpage
Google Maps API allows us to integrate Google Maps into our websites. It is a free
service. By using the Google Maps API, it is possible to embed Google Maps site into an
external website, on to which site specific data can be overlaid.
Loa d i n g the G oogle M a p s A P I.
<script src="https://maps.googleapis.com/maps/api/js?sensor=false"></script>
The URL contained in the script tag is the location of a JavaScript file that loads all of the
symbols and definitions we need for using the Google Maps API. This script tag is required.
The map Object:
var map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
This code defines a variable (named map) and assigns that variable to a new Map object,
also passing in options defined within the mapOptions object literal. These options will be
used to initialize the map's properties. The function Map() is known as a constructor.
Latitudes and Longitude:
Because we want to center the map on a specific point, we create a LatLng object to hold
this location by passing the location's coordinates in the order latitude, longitude :
center = new google.maps.LatLng(-34.397, 150.644)
Loading the Map:
<body onload="initialize()">
50
The Google Distance Matrix API
The Google Distance Matrix API is a service that provides travel distance and time for a
matrix of origins and destinations. The information returned is based on the recommended
route between start and end points, as calculated by the Google Maps API, and consists of
rows containing duration and distance values for each pair.
A Distance Matrix API request takes the following form:-
http://maps.googleapis.com/maps/api/distancematrix/output?parameters
or,
https://maps.googleapis.com/maps/api/distancematrix/output?parameters
In both cases, output may be either: Json, indicating output in JavaScript Object Notation (JSON); or Xml, indicating output as XML.
The parameters are origins, destinations and sensors. As we have only one destination and
only one origin the output matrix consists of one row. The estimated vehicle duration and
distance between the two points are displayed with the code:-
results[j].distance.text and results[j].duration.text where ‘j’ is the row.
The Google Geocoding /Reverse Geocoding API
Geocoding is the process of converting addresses (like "1600 Amphitheatre Parkway,
Mountain View, CA") into geographic coordinates (like latitude 37.423021 and longitude -
122.083739), which you can use to place markers or position the map.
Reverse geocoding is the process of converting geographic coordinates into a human-readable
address. A Geocoding API request is of the following form:
http://maps.googleapis.com/maps/api/geocode/json?address=ADDRESS&sensor=true
or
https://maps.googleapis.com/maps/api/geocode/json?address=ADDRESS&sensor=true where
output may be either of the following values:
json indicates output in JavaScript Object Notation (JSON)
xml indicates output as XML
51
the required parameters for google geocoding are address or latlong and sensor (Indicates
whether or not the geocoding request comes from a device with a location sensor. This value
must be either true or false.)
$json_a['results'][0]['geometry']['location']['lat'];
$json_a['results'][0]['geometry']['location']['lng'];
gives the latitude and longitude of the given location.
Similarly for reverse geocoding:
The request is of the from of :
http://maps.googleapis.com/maps/api/geocode/json?
latlng=".trim($latitude).",".trim($vlongitude)."&sensor=false
or
https://maps.googleapis.com/maps/api/geocode/json?
latlng=".trim($vlatitude).",".trim($vlongitude)."&sensor=false
and the statement
$address = $json_data->results[1]->formatted_address;
gives the formatted address of the location whose latitude and longitude are given
6.9.2. Outgoing API –Sparrow SMS Service (VASP API)
The outgoing API of the VASP requires the parameters like
Username: - username provided during the API signup
Password: - password provided during the API signup
,client_id: - client_id provided during the API signup
,from: -if multiple senders are allowed, from parameter needs to be supplied at the time of
each API request
To: - the number to send sms to
,text: - The text to be sent(Must be urlencoded)
52
6.9.3. Incoming API –Sparrow SMS Service (VASP API)
When there is an incoming SMS Hit, the URL provided by content-provider / developer is invoked and any output sent via the respective URL is delivered to the SMS sender. However, it is not mandatory for the application to send anything as output. Sparrow SMS can just relay the incoming request so that the application can keep tracking in its own way. Following are the arguments augmented to the URL on every Incoming SMS
1. timestamp :-timestamp of the time when the incoming SMS hits the Sparrow SMS Gateway server
2. keyword :-The first word of the incoming SMS text3. text :-The text after shifting the first word of the SMS content4. from :-Phone number of the SMS Sender5. 5:to :-The short code to which the SMS was received
53
7. APPLICATION
This project “GPS GSM integration for enhancing public transportation system” finds
applications in a number of ways:
Real time vehicle Tracking:
This System involves real time vehicle tracking. It can be used to locate the location of
desired vehicles or any objects which location we need to trace.
Real time transportation management:
Since passengers can get pre-informed of the location of the buses they intend to board,
it saves considerable amount of time. The queues and crowds in public vehicles and
public stations will be minimized.
Assistance to visually impaired:
The project finds its wide use in assisting the people with visual impairment. The
embedded system at the station helps those who are visually impaired to board their
vehicle with the announcement made at the station.
Security purpose:
The system can be implemented to keep any objects secure. With sensors installed into
system also security breach in different places can be checked and social crimes can be
minimized.
Implementation with Sajha Yatayat:
The system design can be applied to Sajha Yatayat within the Kathmandu valley. This
will help make Sajha Yatayat more popular among the general public and it will be
more efficient.
54
55
8. PROBLEM FACED
A number of problems were faced during the project.
Firstly it was with GPS module. The GPS module posed some problem in initial days
as no data was obtained owing to the warm start which was solved later on.
Getting the GSM data to the web server took really good time as we faced problems.
Load shedding problem made the work schedule quite untimely.
56
9. LIMITATION AND FUTURE ENHANCEMENT
The objectives set during the start of the project are almost met. However there are some ways
we could have made this project more enhanced which we will be looking to do in the future.
The project can be enhanced in a number of ways:
The project is based on SMS to the server from the GSM modem. However GPRS can
be used instead and it will be more effective.
The number of passengers and vacant seats can be logged and informed at the stations.
57
10. CONCLUSION
With the completion of the project we were able to familiarize and use GPS and GSM
modems and utilize their importance in real life. We were able to make some real time system
that would make the existing transportation system more effective. We also learned the
application of microcontrollers and different components to visualize some real application
and understood what role electronics can play in transforming a society.
58
11. REFRENCES
[1] Xiaoya Guo, E. H. (2012). Design a Smart Bus System. ELEC 399 Final Project Report ,
Victoria University,USA.
[2] SBS Transit. (n.d.). Retrieved 02 15, 2013, from http://www.sbstransit.com.sg/
[3] Winnipeg Tranist. (n.d.). Retrieved 02 15, 2013, from http://winnipegtransit.com/en
[4] Xiaoya Guo, E. H. (2012). Design a Smart Bus System. ELEC 399 Final Project Report ,
Victoria University,USA.
[5]
Dheeraj Mehra, V. S. (2010). User Triggered Bus Identification and Homing System: Making
Public Transport Accessible For the Visually Challenged. . Indian Insitute of Technology.
[6] National Research Council (U.S.). Committee on the Future of the Global Positioning
System; National Academy of Public Administration (1995). The global positioning system: a
shared national asset: recommendations for technical improvements and enhancements.
National Academies Press. p. 16. ISBN 0-309-05283-1. Retrieved 2013-08-16., Chapter 1, p.
16
// refrences website haru pani raknu paryo
59
1. APPENDIX
Top Related