JeremyBlum.com

v3.1

Tutorial 15 for Arduino: GPS Tracking

| 225 Comments

This tutorial was featured on the Cooking-Hacks website on 07/18/2012

This was easily the most time I’ve spent producing an Arduino Tutorial. I’ve been sporadically walking around NYC with this GPS for weeks as I’ve tweaked the code and gotten it just right. If it wasn’t obvious from the title, this tutorial will teach you how to use an arduino paired with a GPS Module and an SD Card Module to log your latitude and longitude over the course of a day. As a bonus, I’ll also show you how to easily overlay this data onto a map using services like Google Earth and Google Fusion Tables. I added a short “history lesson” to this episode to explain how GPS came to be; it’s the first time I’ve done that, so please let me know if you like the extra knowledge. Grab some popcorn and your Arduino, because this tutorial is pretty long – GPS is complicated! The schematics, programs, parts list, sample data, and important links are available for download below.

I used the tinyGPS library to decode the NMEA GPS Data. Cooking-Hacks generously supplied both the GPS shield and SD Card shield that I used in this tutorial.

You can download the files associated with this episode here: Arduino Tutorial 15 Files

Source materials for all my arduino tutorials can be found in my github repository.
GNU GPL License Distributed under the GNU General Public (Open-Source) License.
Please Attribute and Share-Alike.

This video can also be viewed at element14.com.

225 Comments

  1. Hi
    I have
    1. An Arduino
    2. A GPS module (I’m using the EM-406 from Sparkfun )
    3. A matching way to hook the GPS module to the Arduino (I went with Sparkfun’s GPS Shield )
    4. And a microSD Sheild

    would what i have work with this code

  2. Hi, i was trying with your code for GPS shield, but i got all this errors: I’m using Arduino 1.6.1 compiler, can you help me?

    GPS_cesar.ino: In function ‘void loop()':
    GPS_cesar.ino:38:17: error: ‘class TinyGPS’ has no member named ‘satellites’
    GPS_cesar.ino:38:31: error: ‘GPS_INVALID_SATELLITES’ is not a member of ‘TinyGPS’
    GPS_cesar.ino:39:17: error: ‘class TinyGPS’ has no member named ‘hdop’
    GPS_cesar.ino:39:25: error: ‘GPS_INVALID_HDOP’ is not a member of ‘TinyGPS’
    GPS_cesar.ino:41:21: error: ‘GPS_INVALID_F_ANGLE’ is not a member of ‘TinyGPS’
    GPS_cesar.ino:42:21: error: ‘GPS_INVALID_F_ANGLE’ is not a member of ‘TinyGPS’
    GPS_cesar.ino:45:33: error: ‘GPS_INVALID_F_ALTITUDE’ is not a member of ‘TinyGPS’
    GPS_cesar.ino:46:31: error: ‘GPS_INVALID_F_ANGLE’ is not a member of ‘TinyGPS’
    GPS_cesar.ino:47:35: error: ‘GPS_INVALID_F_SPEED’ is not a member of ‘TinyGPS’
    GPS_cesar.ino:48:31: error: ‘GPS_INVALID_F_ANGLE’ is not a member of ‘TinyGPS’
    GPS_cesar.ino:48:71: error: ‘cardinal’ is not a member of ‘TinyGPS’
    GPS_cesar.ino:49:21: error: ‘GPS_INVALID_F_ANGLE’ is not a member of ‘TinyGPS’
    GPS_cesar.ino:49:80: error: ‘distance_between’ is not a member of ‘TinyGPS’
    GPS_cesar.ino:50:23: error: ‘GPS_INVALID_F_ANGLE’ is not a member of ‘TinyGPS’
    GPS_cesar.ino:50:54: error: ‘GPS_INVALID_F_ANGLE’ is not a member of ‘TinyGPS’
    GPS_cesar.ino:50:85: error: ‘course_to’ is not a member of ‘TinyGPS’
    GPS_cesar.ino:50:141: error: ‘GPS_INVALID_F_ANGLE’ is not a member of ‘TinyGPS’
    GPS_cesar.ino:51:21: error: ‘GPS_INVALID_F_ANGLE’ is not a member of ‘TinyGPS’
    GPS_cesar.ino:51:61: error: ‘cardinal’ is not a member of ‘TinyGPS’
    GPS_cesar.ino:51:79: error: ‘course_to’ is not a member of ‘TinyGPS’
    Error compiling.

  3. Hi, Thank you very much for posting this, I managed to get it working but for some reason the SD part does not work, I keep getting the error below even thought the CSV file is on the SD card . please help me, i need urgently help, doing this for my university project

    Couldn’t open the log file!
    Card Failure

  4. i got the latitude and longitude but cant log the data in sd card.
    couldn’t open the log file
    help me plzzz

  5. Thanks for sharing this, I have plan with my GPS project module. this is really help!

  6. GPS_EM-406A is need any sim and gsm module

  7. I could not get the test_with_gps_device code to work. I am also using a mega 2560 and set it up as per your instructions. I get the same readings you got in the video on the serial monitor, but I shouldn’t because the module has a gps fix. I verified it with adafruit’s parsing code prior to uploading the test_with_gps_device sketch. The module (an adafruit ultimate gps breakout) also has an led indicating that it has established a fix. Any ideas on what might be preventing the serial monitor from displaying the data?

Leave a Reply

Required fields are marked *.