LESSON 23: Arduino GPS with Data Logger

In this lesson we will extend what we did in lesson 22 to include a data logger with our GPS. You should be sure and do lesson 22 first, as that shows you how to hook up and program the GPS. In this project we will connect an SD Card Reader/Writer, and will power the whole thing with a 9 Volt battery. With this, you can walk around, and the device will constantly monitor and log your position. You can then bring it back inside, and look at where you have been using Google Earth.

GPS Data Logger
Arduino connected to Adafruit ultimate GPS and a n SD card Data Logger

To start with, lets talk about what you will need to do this project. As described earlier, you need to start by doing lesson 22 which will get you going on the GPS hookup and initial software. Now, to move forward, you will need an Arduino, Adafruit Ultimate GPS, Virtuabotix SD card reader, and a Battery Clip to power the arduino during your mobile jaunts.  You will need a 9V battery. If you are going to be doing a lot of mobile work, it is probably worth it to invest in a good 9v Rechargable battery system.

When you get your gear gathered up, you will be ready to get this project going. First, hook the GPS up to the arduino as we did in lesson 22:

Connecting the Adafruit Ultimate GPS Unit to Arduino
GPS PinArduino Pin
Vin5V
GNDGND
RXPin 2
TXPin 3

You also need to hook up the SC Card Reader/Writer. You should be familiar with this from lesson 21.

Connecting the SD Card Reader
Sd Card Reader PinArduino PinDetails
GNDGNDCommon Ground
3.3 V – (NOT USED)
+55VPower
CS4Chip Select
MOSI11SPI Data
SCK13Clock
MISO12SPI Data
GNDGNDCommon Ground

Remember that this SD card reader has two rows of pins. Don’t let that confuse you, both rows are equivalent. You can connect to either row.

Most of the code has already been written in Lesson  22. In this lesson, the main thing we will be doing is to write the GPS data to the SD card. This way, as we walk around outside, it will log our positions to the SD card.  We will create two files. One will hold the raw NMEA sentences, and the other our location data, as parsed by the adafruit GPS library. You should be able to figure most of this out from what you already know from lesson 22 and lesson 21. In the video above, we take you through this code step-by-step, so watch the video to understand what we are doing. If you get stuck, you can look at the code below.