GPS Data Logging
When I decided to build a multi-rotor, I knew I that I wanted to track its flight path, as I would be flying several hundred yards once I had the FPV setup going. I spent weeks searching for and reading up on small-scale GPS Data Loggers that were simple to use and easy to program. Then one day, I stumbled upon an article on Make.com that was exactly what I was looking for, and I had everything already on hand to build it.
You might remember a review I did on the TinyCircuit's Arduino-compatible development kit a few months back. Turns out that the hardware used in the Make.com article utilized this same hardware, and was in fact, written by the founder of TinyCircuits. So with hardware in hand, and the code pre-existing, I had a quick head start to get this small sub-project off the ground.
Included in the kit I received was a fully functional micro-GPS shield that was not much larger than a quarter, an SD card shield, and an Arduino. When stacked together, the entire package is about 1-inch cubed, which makes the stack the perfect size for attaching to RC aircraft. With everything I needed to develop my GPS logger, I sat down at my bench to get the party started.
The GPS data logging project I found on Make.com was designed to track the author's cat, but the code I needed to get my project off the ground would do the job whether it was tracking a cat or tracking the flight path of my quad copter.
The TinyDuino series is pretty cool because you have a full Arduino Pro / Pro Mini packed onto a board the size of a quarter. I won't go into great detail about the boards and what makes them so special, but if you would like further information on them, check out the full overview I wrote that is located here on TweakTown. Below is a list of everything you need to create a simple GPS Data Logger of your own using the TinyCircuits hardware. You can find all of the code and needed files on the Github Repository I made for this sub-project. I will eventually update the QuadCopter repository to include these files as well.
- TinyShield microSD
- TinyShield GPS
- TinyShield USB & ICP
- TinyDuino Mounting Kit
- 3D Printed Case
- Class 4 or higher 4GB microSD Card
There really is not much to building the GPS Data Logger other than stacking the shields in the correct order, uploading the code to the Arduino, and then getting outside and logging some data. The stack should be built-in the following order. The bottom most board should be the TinyDuino, which should then be followed by the TinyShield microSD board. Up next would be the TinyShield GPS, which is followed by the TinyShield USB and ICP.
I chose to power my GPS Logger using an 18650 powered USB cellphone charger instead of the CR2023 or JST methods that the TinyDuino also supports. If you chose to go this route, you will need to arrange your stack with the TinyShield USB & ICP board placed between the TinyDuino and TinyShield GPS; I chose this route because I had several spare USB cellphone chargers laying around.
With everything stacked together, let's prepare the TinyDuino for coding. Plug a microUSB cable into the TinyShield USB & ICP board, then select the appropriate USB port that the TinyDuino is now connected to. Once the correct port has been selected, we need to set the Arduino IDE to recognize the correct Arduino-compatible board. Since we are using a TinyDuino, we need to select Arduino Pro or Pro Mini (3.3V, 8MHz) w/ ATmega328. Once finished, we should be ready to import some test code to the TinyDuino to test that everything is working correctly.
Before we upload any code, we will need to make a minor change to the SoftwareSerial library in the Arduino IDE. You will need to replace the SoftwareSerial.cpp and SoftwareSerial.h Library files with the ones found in the GitHub repo for this tutorial. Replacing the files is quite easy, and you simply need to navigate to Arduino>libraries>SoftwareSerial and rename the existing files to SoftwareSerial_cpp.bak and SoftwareSerial_h.bak and then download the new files into this directory.
Now that that is complete, let's upload some test code to make sure that everything was configured correctly and the TinyShield GPS module is sending raw NMEA data to the Tiny Duino. Upload the code that is embedded below (also found in the Git repo titled GPS_Test_Firmware.ino and then open the serial terminal in Arduino and set the baud rate to 9600. You should see some weird strings that look like the pasted code below the GPS Test Firmware code.
If the data that appears in the serial terminal does not look like this, then you will need to re-upload the SoftwareSerial files and upload the test code again.
Now that everything is working fine, we need to upload the actual GPS Data Logging code to the TinyDuino. I have pasted the code below, and remember to insert a properly formatted microSD (read how to do this here) card into the TinyShield microSD.
PRICING: You can find products similar to this one for sale below.
United States: Find other tech and computer products like this over at Amazon's website.
Australia: Find other tech and computer products like this over at PLE Computer's website.
Canada: Find other tech and computer products like this over at Amazon Canada's website.