February 7, 2006
Build Your Own Web-Based GPS Tracking System
Having your own web-based mobile GPS tracking system doesn't have to be a complicated
and expensive ordeal. Now you can build your own simple mobile GPS tracking system from a laptop
and have the data delivered, via Internet, right to your own computer.
be able to see the data over the web on an interactive map!
is a commercial quality Open Source protocol and framework
designed for the transmission of location based information over high-latency/low-bandwidth networks.
Using the OpenDMTP C client reference
we'll describe how to build your own GPS tracking system, and explore the various
options that are possible once you have the system up and running.
The Basic Components:
Building your own web-based GPS tracking system requires 3 basic components:
Mobile Client Hardware
The mobile client hardware performs the collection of GPS messages, analysis of various
GPS-based rules, and the transmission of generated events back to a server.
For our client, we will use a laptop running a current version of Linux (however Windows-XP
Cygwin works fine as well),
with an attached GPS
receiver and GPRS
Data Analysis and Transport Protocol
On the client side, this includes the analysis of the GPS events to determine
motion state changes (StartMotion, InMotion, StoppedMotion), as well as transmitting
this data to the server. The OpenDMTP
C client reference implementation includes several GPS
rule modules as well as full-featured support for client/server communications.
The server needs to accept incoming connections from our client (laptop) and store
received GPS events for later viewing. This stored data can then be presented in a web
interface, along with a map, to a user wishing to view the data in a browser. For our GPS
tracking system, the backend server will be a Linux machine
running over a broad-band Internet service (again Windows XP with Cygwin should work fine).
The OpenDMTP C client project provides a
simple socket server which we will configure to listen for
client connections over Internet. And with the availability of Google Maps, we can also
Putting It All Together:
First we need to
the latest version of the
OpenDMTP C client
zip file and place a copy of the unwrapped
project files on both our client laptop, and our backend server. (Detailed
instructions can be found in the project documentation).
Configure the server:
To configure our backend server, first we'll build the simple OpenDMTP
'sockserv' binary which acts as our backend service provider.
Next we configure our webserver. No special
features are necessary here, the webserver just needs to be able to serve our static page,
"track.html" (derived from examples provided by Google Maps and included in the
OpenDMTP C client project). Since we'll be
using Google Maps to display a map we'll also need to apply for a "Google Maps API Key" which we place
in our "track.html" webpage. After checking to see that our firewalls are routing
the necessary ports, we're now ready to start the server to listen for our client connections.
(Note: When using Google Maps, make sure you fully comply with their
Configure the client:
To configure our client we'll
build the OpenDMTP
C client code with GPRS support enabled, and attach
a GPS receiver and GPRS modem. The GPRS wireless service provider may require some special
connection parameters which we will configure the client to provide when necessary. We will leave the default
GPS rule configuration as-is, which includes event generation for start and stop motion, and every 2 minutes
We are now ready to start the client to begin collecting GPS data and transmitting it to our server.
We start it up and monitor the client connections to the server to make sure everything
is working as expected. The client generates events and sends them to the server.
server collects the data and stores it for the webserver. The webserver presents the data and
a map to the users client web browser. We're up and running! After taking a short
road trip, here is a sample
of the resulting data and map.
From here, the options are nearly endless for where changes and improvements can be made
to our simple GPS tracking system.
The OpenDMTP C Client:
The client has a full-featured reference implementation
of the protocol and has many configurable options, including the ability to generate/send events
based on an arrival to, or departure from, a specific "GeoZone". It also supports straight socket
connections, which means it should work with most PCMCIA wireless airtime cards.
Instead of a laptop we could also use an embedded computer system like GumStix
(http://www.gumstix.com) to perform the same
The OpenDMTP C Server:
The server we used has a simple minimal implementation of the protocol and could be improved
to support multiple clients, additional protocol features, user login/logout, and an improved
This is just the beginning of the possibilities available with
Try out the OpenDMTP
project yourself. You'll find the protocol documentation and reference implementation
download at "http://www.opendmtp.org".
For questions or comments, please feel free to contact us at