Real Time GPS with Google Maps


GPS technology is useful for many applications. For example, I built a hand-held GPS unit just to mess around with the EM-406. It was cool because I got some useful information like speed, heading, and altitude. I also got latitude and longitude - useful information if you know what to do with it and have some detailed maps handy. But for me, latitude and longitude readings were just numbers I couldn't readily interpret. I really wanted to find a way to display this information on a map, but I just wasn't sure how.

This project from SparkFun customer Jayesh Sukumaran is an excellent example of how to integrate GPS data into an easy to read/interpret format. Jayesh took an Arduino, the SM5100B cellular module, the EM406A GPS module, and a bunch of really clever work in Arduino, Python, and MySQL to create a GPS module that provides real-time updates to Google maps.


The cellular module used to transmit GPS data.

When the GPS unit receives data, it transmits this information via the cellular module (GPRS) to the mobile operator's GGSN (Gateway GPRS Support Node) and then to a remote server over a TCP connection. This information is then stored in a mySQL database. When a user navigates to the tracking page (made using Zope), it serves up an HTML page with an embedded JavaScript code. The JavaScript grabs the information from MySQL, combines that info with Google Maps API, and displays it on the map. The Real Time Mobile GPS Tracker updates every second (and the map is updated at the same frequency) so it provides instant results.

If you want to build your own, Jayesh did a fantastic job documenting the build and also provides all the code that was used. Great project!


Comments 28 comments

  • Great project and it can show that you might start off with a simple idea of “I just want to track my GPS coordinates” and then add features to it to turn it into something quite amazing.
    Sort of like, “I know I can setup LEDs in a matrix and turn it into a ‘touchscreen.’ Maybe I can add a cellular module to have it text me with a random combo, etc."
    So, remember hobbyists, top-down design, bottom-up implementation!

    • Could you elaborate on what you mean by “top-down design, bottom-up implementation”? I like the sounds of it, but I’m not sure how you separate design from implementation.

      • You basically design your system “top-down” meaning you take the overall picture of what you want to achieve and break it into smaller blocks and smaller blocks. Once you reach a point where you can’t break them down anymore, you start implementing each block (writing code, wiring, etc). Then you test each block. From here he combine blocks until you get your entire system.
        http://en.wikipedia.org/wiki/Top-down_and_bottom-up_design

  • Hi Do anybody have a suggestion for a battery pack solution for this setup, with parts available on sparkfun ?

    Thanks!

  • An alternative is APRS. All you need is a Technician class ham radio license. I have a trackuino up and running.
    http://aprs.fi/
    http://code.google.com/p/trackuino/
    aprs.org

  • Nice documentation. I just finished the same project but with a XBee modem and not a GSM modem (I worried about costs). I too started with Python on the web server side, but realized I’d be serving livelink updates to Google Maps/Earth with Javascript, so I rewrote that module in Java and persisted the data with Hibernate – hides all of that icky SQL stuff. I’ve also had a board fab’d to hold all the parts and I’ve gotten the package down to 1.1"X 1.6".
    I might offer another suggestion: Add “ID” and “DATETIME” fields to your table… I quickly realized not only would it be fun to watch more than one target, but being able to “play back” the tracks can be interesting/valuable.

  • So you need your cell phone provider’s APN?? It seems to me like verizon has a main one emgsm.vzw3g.com and then perhaps a more unique one [yourphone#].vzw3g.com. Which one gets used in the code?? Will you need to have a data plan on the phone you supply the APN of??? Or is it more general than that, allowing you to put the APN of any cell phone provider???
    I’d love to do this project but I don’t want to get stuck because I’m on verizon with no data plan.

    • GPS tracking system facilitates in gathering and analyzing large information accurately which can be used to improve fleet performance. With GPS tracker you can ensure that your fleet is always safe by continuously knowing where they are. Vehicle tracking system also ensures you provide your customers with unmatched service by letting them know where their belongings are.

  • You wouldn’t use so many technologies to do something so simple unless it was a job application. Never got the point of tracking a GPS module from a stationary computer. A portable e-ink display which showed your position on Goog maps by downloading Goog maps from an SD card would be useful, but wouldn’t need Mysql anywhere. Don’t think anyone is into e-ink anymore, either.

    • Never got the point of tracking a GPS module from a stationary computer.
      Anytime you need to trace something that isn’t you, and that which is being tracked also doesn’t need to have feedback of that tracking itself - such as your car without you in it, perhaps - such a device comes in quite handy.

  • Great project! :) very cool way to learn about a whole lot of different things. I did a very similar thing for my final project at college. I’m waiting and hoping for some bureaucratic crap to pass so I can share the code publicly, but if anyone would like, just ask. meanwhile, here’s our project book, in Hebrew, so enjoy the pics and stuff :)
    Very similar stuff, just that I used a load of PHP instead of the python with a few extra features..
    kudos.

  • The image above of the SM5100B cellular module shield looks way different than the images on the actual product page. Has the design changed and which picture(s) are of the current shield for the SM5100B?

  • I had google-earth with network links on a Kyocera K1 cell router years ago (hacking the firmware, basically customizing gpsd and adding it to the linux distro in the firmware).
    My minigpsd on the nokia tablets would log every point (at 10HZ!) to a KML and to gpsgate for live tracking, as well as all of the above (and my harley data). Since I have a MiFi I tend not to do as much with other stuff.
    On github, I have tz1/webgpsd that has multiple ways of displaying position info. It has an HTML5 based satellite display built in - you can watch on an iPod touch or Android.
    Newegg had Motorola C168i for about $20 a few weeks ago and I got 4 more. The headset jack is 3.3v TTL UART right into the hayes-command cell chip so I can SMS with an arduino pro or even an at2313.

  • Perfect
    Good start point for professional.

  • Of course it is a great project! Must be nice to have access to all those parts. No wonder you guys are in the electronics building projects!

  • As a HAM, I did this 10 years ago with a GPS, and 2m Ham radio using APRS. Transmit the data via AX.25 protocol, other hams have nodes set up that receive the info and then upload to the internet. Only difference is this uses cell towers instead of HAM

    • Ditto - still use APRS here. If you’re really interested in tracking things - get a Amateur Radio license - anyone here can pass the Tech test - no Morse code required - just basic electronics and safety. I run APRS from my Kenwood D-700 while mobile - for free! Take that cellular companies!

    • I was going to say the same thing. Plus using APRS there is no monthly fee and probably works where there is no cell coverage if you crank up your wattage.

  • Brilliant work ! Thanks for bringing this up here, awesome documentation !

  • Looks like very nice work. But it seems like the cost/benefit is a little high when you could go buy a garmin for $100 or less which is the cost of the cellular shield alone. But if your bored and looking for a project I say its all good.

    • Does Garmin sell a unit which reports its position remotely over GSM/GPRS?

      • Strictly speaking, yes: https://buy.garmin.com/shop/shop.do?pID=67686

        • and where’s the fun? ;)

        • That’s about $200, too. This project can easily be made cheaper as it is by leaving out the shield purchases (they do make things a lot easier). In addition, you’ve got an open platform to work with (thanks largely due to the Arduino UNO at the core).. not sure if you can reprogram the Garmin device and make it interface with other bits and pieces.
          If one were to make a GPS SatNav then, yes, buying premade from any of the major vendors is going to be a lot simpler and cheaper than trying to do it yourself. Then again, buy a cheap smartphone and grab any SatNav piece of software and you’ve got something even more powerful (screen’s going to be on the small side, though).
          But in this specific use case, it doesn’t seem so bad.

          • probably easy to write a java app for a cheap nokia or the likes that has a gps in, which has almost everything built in already. heck, there is already an android app and a free service that popped up somewhere which does exactly this.. to each his own :) I prefer solder-iron slinging :D

    • there’s also a plugin that allows google maps and google earth to accept NMEA streams directly.


This Week

This Month

Heartbleed

Happy Arduino Day!