Introduction: How to Build a Lightweight GPS Datalogger for Model Rocket Applications
I have been dreaming of building a flight computer that will not only control the flight sequence, but also log data aboard a model rocket. But I do need to walk before I can run, so I started with a simple GPS data logger (GPSDL) that is just a piece of my future flight computer idea. This GPSDL will sit in a payload bay or nosecone of a rocket during flight.
My finished GPSDL weighs 62 grams with the power supply and has a 1.5 inch W x 3 inch L x 1 inch D footprint. The weight of the data logger can be further reduced by .25 to .75 oz. by using a simpler GPS antennae than the one I used. Cost can run from $100 to $200 depending on how careful a shopper you are. My cost was $200 for the parts used in this article.
The design is simple consisting of three major parts: a 5.5g accelerometer switch, a BS2p microcontoller and a GPS receiver. A parts list, pictures, source code and a schematic are included in this article.
The GPSDL records the date, time, latitude, longitude, altitude, speed, heading in degrees and number of satellites that are in communication with the receiver every second for a total of 5 minutes. The source code provided will record two 5 minute flights before you have to download the data. This is completely customizable for any number of flights or a single 12 minute flight. The comments in the source code explain not only how to make this flight time change, but also what the program is doing throughout its runtime. The source code was split into two programs to maximize the amount of data that could be stored, negating the need for a separate EEPROM. The first program parses the GPRMC and GPGGA GPS sentences for the data points and writes them to memory. Post flight, the second program is downloaded to read the data points stored in memory and prints them to your PC screen. The data points are finally copied/pasted into a spreadsheet for conversions and graphing.
My first step was to familiarize myself with the parts chosen to work with by reading the data sheet for the GPS antennae and spending some time online learning how to use the free IDE that Parallax provides to develop and download code from my PC to the BS2p microcontroller via a serial port. This is quite simple and you can learn how to do this in an evening. If you want to just cut and paste my code onto your microcontroller that is about all you need to know code-wise to get the circuit running. If you want to customize my code or roll your own, PBASIC, which is the language that the BS2p runs on, is probably the easiest language to learn. There are multiple online forums catering to the Basic Stamp where help is available if you need it.
Next, I breadboarded the circuit. Then I perched my breadboard monstrosity on my windowsill to get a good GPS signal and developed the code by trial and error.
After getting the code developed and the circuit running quite nicely on a breadboard, I had to duplicate it on a PCB small and light enough for rocket work. It was not necessary, but I etched a custom PCB for my circuit.
Step 4: Operation
Prior to launch, the only communication there is between you and the GPSDL is the blinking LED included on the GPS antennae PCB. A flashing LED means less than 3 satellites are acquired, a steady on LED signals that the antennae has acquired at least 3 of the 12 satellites available. Once you have visual that three or more satellites are acquired, the GPSDL is loaded into the rocket. At liftoff the 5.5g normally open, non-latching accelerometer switch is momentarily tripped signaling the microcontroller to log 20 bytes of GPS data every second for 5 minutes. Once 5 minutes is up it automatically resets itself to take another 5 minutes of data once the accelerometer switch is tripped again. You can record two 5 minute flights before data will need to be downloaded or you will overwrite the data already collected. The power supply is a 300 mAh 7.4V Li-Po battery. The GPSDL needs a steady diet of 5V, and it will run for approximately 3 hours on a full charge with this battery. No data is lost if power is lost. The only way data can be lost is if it is overwritten. GPS signals will travel through plastic, glass and cardboard.--The staples of model rocketry. The only things that will block the signal is concrete, metal or in the form of heavy rain or snow--H20. The antennae tested showed excellent Rx, even in a crowed, signal noisy, urban environment where I live.
Step 5: Ready for Flight
Unfortunately, I have not been able to test the GPSDL with an actual rocket launch. That will happen in the weeks to come. To run the GPSDL I shake it by hand to trip the accelerometer switch and take data from my dashboard as I drive. The GPSDL works flawlessly at this point. I will post not only real flight data but a video of its maiden flight to my website soon. I would appreciate any feedback on improvements to my source code or circuit, particularly in reducing its size or weight.
The .bsp sourcecode files are posted. You need to download the free IDE from Parallax to read them properly. They might open as a .txt file. ? I have also posted a .pdf file of this article that includes the source code.
Parallax BS2p 24 pin microcontroller
Parallax GPS Receiver Module
5.5g non-latching, normally-open, accelerometer switch
Female serial port
JST battery connectors x 3 pair
10 k Ohm resistor
300 mAh 7.4 Li-Po battery