Introduction: How to Build a Freescale Avionics Module
So we have a somewhat expensive yet oddly satisfying hobby: High Powered Rocketry.
High Powered rocketry is exactly what it sounds like, it is a class of Amateur Rocketry with bigger rockets and bigger solid motors. To learn more about High Powered Rocketry please checkout Tripoli or the National Association of Rocketry. These are not the kinds of rockets that you can launch in your back yard so please do your research and find a rocketry group near you before getting into this hobby.
High Powered Rockets can travel anywhere from 2000 ft to 20,000 ft or higher depending on the size of the motor, weight of the rocket, aerodynamics and many other parameters, determining how high the rocket has traveled and what it's doing as it travels can become quite a challenge which is why we wanted to include some sort of Avionics system in our rocket to record as much inertial and atmospheric data as possible during flight.
The Freescale FRDM-K64F Dev Board and FRDM-STBC-AGM01 9-Axis Inertial Measurement Sensor Board that we got for our EurekaFactoryInstructables August Build combined with a Freescale MPL3115A2 Barometer and Thermometer proved to be very cost effective and reliable electronics setup to gather the information we wanted.
Unfortunately our Avionics Module got damaged when the Chute Deployed, however the Micro SD Card and all of the information it gathered up to apogee survived and allowed us to determine exactly what wen't wrong and what we can do to prevent the module from getting damaged at the next launch.
So please check out the next few steps to see what we did and how you can do the same and possibly actually recover the Avionics Module Intact.
Step 1: Required Components
Before you get started, you are going to need the following Components
- FRDM-K64F: Freescale Freedom Development Platform
- FRDM-STBC-AGM01: 9-Axis Inertial Measurement Sensor Board (Optional, the FRDM-K64F does have a built in Accelerometer and Magnetometer, but the AGM01 also has a Solid State Gyro which can give us some additional information about the rate of acceleration)
- MPL3115A2 Adafruit Breakout Board
- Arduino Protoshield such as the Makershield
- A High Powered Rocket with atleast a 3 Inch Diameter Payload bay such as the LOC Precision CALIBER ISP Kit from Discount Rocketry (Special thanks to the HCC (Hillsborough Community College) Physics Club for providing the rocket).
- Micro SD Card, Both Launches used up about 1MB so even the cheapest MicroSD Card should work fine.
- MicroUSB Cord
- Cell Phone Portable Charger. We got ours from FIRST though you can get them from Amazon or anywhere else as long as its at-least 2200Mah (there is a good chance your rocket will sit at the pad for a few minutes before launch)
Step 2: Build the Module
This parts pretty straight forward, press the AGM01 sensor board onto the K64F as you would any other Arduino Shield.
The Pressure sensor will require a bit more work, This is where an Arduino Protoshield comes in handy, Your going to want to connect 5v to the vin pin on the breakout board and gnd to one of the gnd pins on the K64F (the pinout is nearly the same as the arduino pinout. the odd part is your going to want to connect the SCL pin to PTC10 (A4 on an Arduino Protoshield) on the K64F, and the SDA Pin to PTC11 (A5 on Protoshield). In our case we used a set of female header pins to connect the pressure sensor so we could remove it if we wanted to, but the pinout is the same.
After you've soldered everything together, press the protoboard with the pressure sensor attached onto the top of the AGM01 board. This will complete the stack. You now have a module capable of logging 9-axis of Inertial Data, as well as temperature and Pressure which can also give you altitude information (we'll get into that later)
Now all that's left is programming the board
Step 3: Programming the Board
We chose to use mbed to program the Freescale board, because of this it is incredibly simple to upload the code onto the board.
First get a Micro-USB to USB Cable, plug the Micro-USB Side into the port on the board labeled SDAUSB (should be the left Micro USB Port on the board if the Ethernet Port is facing towards you. Plug the other side into your computer and the board should act like a USB Thumb Drive, You'll see a drive in Windows Explorer labeled "MBED" .
Download the Attached BIN File below and save it into that drive, Your browser may complain about security issues or even say "Download Failed" but if the drive disappears from Explorer for a few seconds then reappears that means it probably worked regardless of the errors. Press the Reset button next to the Micro-USB Port on the board to confirm that the code has been Uploaded, If it works an LED On the board will light up Cyan. If it did not work, you may want to try downloading the bin file to a different directory on your computer, then copying it over to the drive manually
If you have a Micro-SD Card plugged into the port next to the LED, the LED will blink blue in 1/4 second intervals after you reset the board.
Step 4: Test the Board
Now that you've assembled the board and uploaded the code to the board its time to make sure everything works.
To test the board first make sure the Cell Phone Portable Charger is fully charged (just plug it in overnight or something). Once your sure its charged, plug a MicroSD Card into the MicroSD Port near the USB port on the K64F. After that plug a MicroUSB Cord into the USBSDA port like you did in the previous step, but instead of plugging the other end into the computer, plug it into the Portable Charger. If you have the one from FIRST, you may have to press the button on the charger to turn it on. If everything works you should see the LED on the K64F light up Cyan as before. Hit the Reset button once and the Cyan LED will start blinking Blue in 1/4 second intervals.
To start Logging data, hold down the button labeled SW2 (on the Right side of the MicroSD Port) until the Led Blinks Green twice with a quick 1/8 Second Interval. after it blinks twice the Led will turn off, don't worry, its begun recording, we disabled the LED after it starts recording to save a little bit more battery power (though it really doesn't save much we figured every Milliamp Matters when it comes to rocketry).
Feel free to let the module record for a few minutes if you want to make sure it continues to work. When your done, hold down the button labeled SW3 (the button closest to the LED) until the LED begins blinking in 1 second intervals, this means it has safely closed the file and you can remove the MicroSD Card and plug it into your computer. The MicroSD Card should contain a CSV file in the root directory of the Card labeled log_1.csv. every time you reset the board and begin logging the board will create a new file to log the current session, labeled log_#.csv, where # is the log number, the log number will increase by one each time it starts logging, that means you do not need to worry about any data being overwritten with new launch data.
Step 5: What Went Wrong and How You Can Fix It
After building this Module in August we attended the Tampa Tripoli Rocketry Association Meeting on September 20th and Launched the rocket with the module as a payload twice. You can check Here for more details on the launch process. The end result however is relevant to this particular Instructable as you will want to find a solution to the problem we had before launching your own avionics module.
According to the data we collected from both launches, we have concluded that the G-Forces caused by the parachute deployment After the ejection charge fired damaged the MicroSD card holder as the card itself got forced too far into the holder. This is most likely because we placed the avionics module in the payload bay in such a way the the Micro SD Card was facing upwards, and the only thing holding it in place was some packing foam that happened to fit into the payload bay.
A better approach would probably be to create a two piece enclosed holder with just enough room to fit the board with the SD card facing downwards, this would prevent the G-Forces from pulling the card outward as it would be braced against the back of the holder.
Such a holder could also be made with a Epilog Zing Laser Cutter, though instead of designing it as you see in the third image, we've designed an alternate type of mounting system consisting of 8 separate laser cut sheets of wood or plastic which can then be glued together to form a clean mounting board that can fit into the payload bay. there are still some modifications that need to be made, but the basic concept is pretty much finished (as seen in the fourth and fifth images and the attached PDF file).
We will not be able to test either solution for another month, and the dimensions have not been confirmed yet but we will be sure to post the finished CAD design of our mounting system here when its finished.