Arduino GPS Datalogger
Do you want to log some GPS data onto an SD card using your Arduino? Do you already own a Sparkfun microSD shield and GPS module? Did you try the Adafruit Sheild (although it is awesome and cheap) but it stole all of your pins? Want it to output into a nice, Google Earth friendly format? Well read on…
Step 2: Hook It All Up
It’s a simple as, stacking the sheilds.
I put the GPS Shield on top to maximize reception.
The led is on pin 13 (see close up pic). This will flash every time it logs a GPS point.
To work with my code, make sure the little switch is set to “DLINE” on the GPS Shield. (Included a close up if you have no idea what I’m talking about) This is so we can use pins 2 and 3 to communicate with the GPS instead of the “UART” setting, which uses pins 0 and 1. This is a personal preference, modify the code as you wish. If you are using the UART, then make to switch it over to DLINE while uploading code to the Arduino if the shield is attached.
Lastly remember to have your microSD card formatted to FAT (FAT16).
Sparkfun (and many others!) has some awesome tutorials on the product pages that I referenced in this Instructable’s Hardware page for both of the shields. I’d highly recommend a glance through them if this is a little too confusing. (Especially the microSD tutorial!!!!!)
Step 3: The Software
I’m assuming if you’ve read this far you know a bit about the Arduino and how to upload programs using the Arduino IDE, so I will not be covering the basics. Lets walk through some sudo-code
initialize serial, libraries and variables.
create a text file on SD card with header
pull GPS data
write GPS data in the end of the text file.
I’m not going to go into my code in to much detail but it’s commented enough to understand whats happening.
You will notice I’m using two really awesome libraries written by Mikal Hart, so make sure you have downloaded them! (TinyGPS and NewSoftSerial )
TinyGPS basically makes it easier for us to extract data like longitude and latitude from the slightly complex NMEA sentences that the GPS module spits out.
NewSoftSerial allows us to transform any pins into “serial pins”. In this case pins 2 and 3 as previously mentioned.
For more detail: Arduino GPS Datalogger
EasyEDA: Ideas for Circuit Design, Innovation for Electronics Access
Free Circuit Design: Schematic – Simulation – PCB Layout – Gerber Viewer
Cheapest PCB Prototype: Only $2 for 10pcs 10×10cm PCBs, 24 hours Quick Turn, DHL Delivery in 3 Days
This Post / Project can also be found using search terms:
- arduino gps
- arduino can bus data logger gprs
- Arduino GPS Logger