The OpenDMTP Project
Home | Project | Downloads | Contact

February 7, 2006

Build Your Own Web-Based GPS Tracking System


Map Image (C)Google 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. With the addition of a webserver, and Google Maps client-side JavaScript, you'll be able to see the data over the web on an interactive map!

OpenDMTP 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 implementation, 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 with Cygwin works fine as well), with an attached GPS receiver and GPRS wireless modem.

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.

Backend Server
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 view this data on a map using client-side browser JavaScript.



Putting It All Together:

Download OpenDMTP:
First we need to download 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 Terms of Use)

Configure the client:
To configure our client we'll Client Configuration 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 while moving. 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. The 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 view of the resulting data and map.



Other Options:

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 tasks.

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 web-interface.

This is just the beginning of the possibilities available with OpenDMTP. 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 devstaff@opendmtp.org


Copyright (C) 2006 Martin D. Flynn, All rights reserved. SourceForge.net