Datalogging with GPS
After sifting through the parts I had on hand, I decided to pair up my Adafruit Adalogger Feather with my GPS Featherwing and see if I could log my GPS location.
In the past I had unsuccessfully used the GPS Featherwing with an Adafruit FONA Feather in an attempt to accomplish some Geofencing; unfortunately both boards require hardware serial, and I have not yet accomplished the appropriate timing in order for these two pieces of hardware to work together.
This project is a fun intermediary and is a great introduction to using both the GPS Featherwing and the Adalogger Feather
Not many materials are needed for this project, but the cost isn't trvial - about $80 worth of parts. That said, the ease of assembly may be worth it for those new to hardware and programming. I highly recommend purchasing Adafruit parts as their support is unparalleled and all the code and hardware they produce is open source.
Adafruit Adalogger 32u4 Featherwing with Male Headers - $21.95
Micro SD Card and Reader - $9.95
Adafruit GPS Featherwing with Stacking Female Headers - $39.95
LiPo Battery (at least 500mAh) - $7.95
Soldering Iron and Soldering Materials (if boards not pre-assembled with headers)
Computer with Arduino IDE Software
Micro USB to USB Cable
As mentioned, the assembly is pretty expensive as far as parts go, but that places very little dependency on soldering and other hardware assembly skills. Adafruit does give the option to purchase their feathers and featherwings pre-assembled with headers. If you don't opt for this, the headers can be purchased separately for a couple dollars and assembled using a soldering iron and soldering materials with relative ease. If you need a refresher on soldering, you can check out this post on Through-Hole Soldering with a PCB.
On the programming end a firm understanding of navigating your computer's operating system and a basic understanding of the Arduino IDE Software is required. The Arduino IDE Software is free, available for all OS's, and available for download using the link in the Material's List.
Step 1: Assembling the Hardware
Make sure the microSD card has nothing on it by inserting it in the card reader, connecting it to the computer, and deleting any files that may be on the card.
Solder the headers if necessary, then stack the GPS Featherwing on to the Adalogger Feather. Insert the microSD card and attach the battery. Plug the micro USB cord into the feather and then into the computer.
If using a non-stacking configuration, the GPS Featherwing utilizes the following pins:
3.3V - Power
GNS - Ground
RX - Hardware Serial
TX - Hardware Serial
Because the GPS Featherwing uses hardware serial, it will not work with any board that uses hardware serial for bootloading, such as the ESP8266. I have also had issues with the Adafruit FONA Feather board, though I suspect that issue can ultimately be circumnavigated using precise timing and software serial.
Step 2: Loading the Software
The software I've used was originally developed by Tak Yanagida and you can view his posts on his GPS Logging Project here. The original code can be downloaded from his Github here. I have modified the code slightly to better work for my application and have added some simple comments.
The code can be downloaded from my Github here. Download the compressed file and extract - or use Git to pull the file down to your local computer.
Open the Arduino IDE software, and open the ADALOGGER_GPS_FEATHERWING.ino file. You may be prompted to create a new folder for the file, click 'OK'. Ensure that you have the following libraries installed:
The following Board Manager will need to be installed:
Adafruit AVR Boards
With the 'Adafruit Feather 32u4' board selected, and the active COM Port for the board selected, upload the code to the board.
Step 3: Logging GPS Data and Use
The software is set up to log data as soon as it is turned on, and it will continue to log data until the battery dies. It will automatically generate a text file with a name variant of "AA000000.txt". The data is printed as plain text using NMEA GPS sentences which we will make sense of in the next step. The photo below shows an example of what the data should look like.
In order for the GPS to find a signal, it must be exposed to the open sky or a window. The red 'FIX' LED on the GPS Featherwing will flash about once-per-second as the GPS is looking for a signal. Once a signal is found the 'FIX' LED will flash only once about every 15 seconds - when this happens you know your device has begun to log its own location.
GPS Signal is passive, and though it cannot pass through metal and substantial building structures, I have had no difficulty locking on to signal through a backpack or plastic container.
The battery charges through the Featherwing board using the micro USB cable. An optional backup CR1220 coin cell battery can be added to the shield.
Step 4: Mapping GPS Data
The NMEA GPS sentences are hardly useful on their own, and the coolest part about GPS logging is overlaying that data on a map. The website GPSVisualizer allows you to copy and paste your entire text file into the data input field, and it will automatically overlay that data on to a Google Map.
Copy ALL the text from the text file and paste it into the box on the GPSVisualizer website titled "Or paste your data here:". Then, click the "Draw the map" button. If you get a notification window that pops up notifying you about the valid header row (see image below) click 'OK' to proceed.
GPSVisualizer will draw your path on Google Maps and provides a link for saving the map, adding photos, or sharing.
The map above shows the data I logged walking around the house and then to the Safeway grocery store after building the project. I kept the hardware assembly in a plastic box inside my backpack during the walk.
Conclusion and Further Work
Overall this project was fun and easy choice for an afternoon project. Though the cost is a bit high, the ease of the project will be worth it for some. Additionally, it is a fantastic proof-of-concept project for anyone seeking to do GPS logging. The nature of the feather ecosystem means that I can easily re-purpose all of the project components for different projects in the future if I so choose.
To build on this project, I would recommend the following steps in addition to checking out Tak Yanagida's project iterations on his blog:
Add a button for selective location logging
Add an OLED screen (Tak Yanagida)
Add external LED's
Add an accelerometer for sensing only when movement is present