This past semester, I decided to build a GPS receiver with an iPhone app that tracks it for my semester project. Here is a step-by-step tutorial to show you how you can build your own.
Architecture of my Real-Time GPS Tracker project.
I’ll be using the diagram above to explain how the project is put together. Starting from the satellite at the top of the diagram, the GPS module receives GPS data from the satellites. The GPS data is read in from the GPS module to the Arduino. Now that we have the GPS data, we need to send it to the server. So, the GPS data is passed off to the GSM (cellular) module. The GSM module then sends the data via TCP/IP to my server program which is running and waiting for the Arduino to connect to it.
The “server” is a python socket server program that I wrote, and it is running on a linux machine. The socket server waits for connections on port 9999, and once the Arduino is connected, it starts to read in the GPS data that is being received over TCP/IP. The python script is connected to a MySQL database, and the GPS coordinates are stored in that database.
When the iPhone app is started up, it connects via http to a simple PHP page on the server. The iPhone app allows the user to store multiple GPS Trackers, each of them is identified by a unique 4 digit ID number. When the iPhone app connects to the server, it pulls the most recent coordinates for each of the trackers, and drops a pin on the iPhone’s Map View.
The hardware for my project is built on the Arduino platform. For those of you who aren’t familiar with Arduino, it is a open-source prototyping platform, which was created to make working with electronics more accessible. The GPS tracker is made up of 3 main pieces: a micro-controller, a GPS module, and a GSM/GPRS module. The micro-controller is an Arduino UNO R3, and it can be purchased at Sparkfun.com. The GPS and GSM modules used are both “shields” which are made to work with the Arduino platform. The shields make connecting the modules much easier – they simply ‘stack’ on top of one another, and there is a minimal amount of soldering required. In reality any GPS or GSM/GPRS module probably could have been fine to use, but I chose to use the shields because of the ease of assembly. The GPS module is a “GPS shield”, which is a shield designed for the Arduino platform. The actual GPS chip on the shield is the “20 Channel EM-406-A Sirf III Receiver with Antenna”. The GSM module is the “Cellular Shield with SM5100B”, which is also a “shield” made for Arduino. The GSM shield uses the “SM5100B GSM/GPRS module”, which is a miniature quad-band cellular module. Below are some photos of the modules. I purchased both of the shields from Spark Fun.
Assembled GPS Tracker:
Below is an image of the assembled GPS Tracker. As you can see from the picture, I have the Arduino UNO on the bottom, the GSM/GPRS shield in the middle, and the GPS module on top. I tried stacking the shields a couple of different ways, and this one provided the most accurate GPS coordinates.
Other things you’ll need:
There are just a few other items that you’ll need to get the hardware assembled. Here’s a short list of the other odds-and-ends. Each of the items links to sparkfun.com, but you can purchase them from anywhere you want, of course.
- 2 x Stackable Header Kit – (for stacking & connecting the shields)
- 1 x Soldering iron
- 1 x Solder
- 1 x “Third Hand” Tool – (to assist with soldering the headers to the shields)