DIY Rocket Acceleration Data Collector

by mkmprescott in Circuits > Arduino

104 Views, 1 Favorites, 0 Comments

DIY Rocket Acceleration Data Collector

IMG_8991.jpeg
IMG_8990.jpeg

Hello! This is an Instructable for building a reasonably cheap and simple model rocket flight acceleration data collector. It's very simple, so if you wanted, without too much trouble, you could probably add/switch a different sensor into this setup, e.g. a barometer, to see if the rocket goes high enough for there to be a detectable change in air pressure, or a thermistor, to measure the engine temperature during flight.

(Unfortunately I can't provide images of the building process. However, I will try my best to be very descriptive during the instructions.)

Supplies

#1--MicroSD Card Module:

https://www.amazon.com/WWZMDiB-Module-Adapter-Memory-Shield/dp/B0BV8ZQ81F/

#2--Arduino Pro Micro (this HAS to be the Micro USB 3.3V version--select that when buying):

https://www.ebay.com/itm/296708865976?

#3--LIS3DH Breakout Board:

https://www.sparkfun.com/sparkfun-triple-axis-accelerometer-breakout-lis3dh-with-headers.html

(This had a pretty high shipping cost, where I live, so you could try out something like this one:

https://www.amazon.com/HiLetgo-Tri-Axis-Acceleration-Development-TemperatureSensor/dp/B082W63MWL

However, I have never used this, nor any LIS3DH breakout board besides the listed Sparkfun one, and have no idea if it would work here. Also, you would have to redo the placing of the components, board size, etc. To stay on the safe side, I recommend the Sparkfun board.)

#4--Any good solder

#5--Wire-wrap wire + wire-wrap tool OR ordinary wire

#6--A piece of perfboard (0.1 inch hole spacing)

#7--CR123 battery:

https://www.batteriesplus.com/productdetails/pho10013

#8--pair of 2-inch female headers

#9--Red and Black/Blue stranded wire

#10--2x 1 cm pieces of the metal core of some 22-gauge solid-core wire

#11--Electrical tape

#12--Model rocket WITH PARACHUTE!!!

Trim Perfboard to Correct Size

Trim the perfboard to be exactly 1 ⅝ inches by 1 5⁄16 inches, using a saw to cut it or scoring the surface with a boxcutter or similar knife ~20 times then cracking the board along the scored line.

Solder Headers Onto SD Card Module and Arduino Pro Micro

This step is pretty self-explanatory: just solder the headers onto the boards. If you want (to save weight), for the Arduino Pro Micro, you can break off one length of 3 pins and two lengths of 4, then solder the length of 3 to the pins GND, RST, and VCC, the first length of 4 to pins 2-5, and the other length of 4 to pins A0 to 16 (see finished image, although note that there I had uselessly added an extra header pin to pin 10.) I suggest you bend the pins of the SD card module down, to make it go up vertically from the board, instead of lying parallel to it, to save space (again, see finished image).

Place Components on Board

Place the LIS3DH accelerometer breakout board on the left short side of the perfboard, with four empty holes on the bottom and three on the top (see finished image). Place the Arduino one column over from that, with one empty hole on top and one on bottom. Finally, place the SD card holder anywhere to the right of those two boards.

Connect Everything

image.png

Wire the components together as described in the above diagram. I wire-wrapped the wires to each pin, then soldered the connections. However, you can just solder wire directly to each pin, if you lack wire-wrapping tools, although that may be harder (to hold the connections steady while soldering). When you've finished, cut off some red and some black/blue stranded wire and solder a wire piece (material #10) to one end of each one. Solder the other end of the red wire to the VCC terminal of the Arduino, and the other end of the black/blue wire to the GND terminal on the Arduino. (See finished image.)

Prepare Battery

IMG_8993.jpeg

Cut off some more red stranded wire and some more black/blue stranded wire. This time, take an end of each piece, hold it against the corresponding terminal of the battery, and stretch electrical tape tightly over it to hold it down (add more tape if necessary). Take the other ends of the wires and solder each of them to a terminal of the female header pair (material # 8), adding hot glue to hold them apart if necessary. The included image should help.

Program the Device

Boards Manager URL.png
Install Boards Package.png
Add .ZIP Library.png
Install LIS3DH Library.png
Search and Select right Board.png

First, you need to install the "Sparkfun AVR Boards" package to communicate with the Arduino Pro Micro. Open the Arduino IDE. Press Ctrl+Comma (Cmd+Comma on Mac) to open the Preferences window. In the Additional Boards Manager URLs space, paste this link:

https://raw.githubusercontent.com/sparkfun/Arduino_Boards/main/IDE_Board_Manager/package_sparkfun_index.json\

Now, you can exit the Preferences window, and open Tools > Board > Boards Manager. Search for "Sparkfun," and install the "Sparkfun AVR Boards" result.

Now, you need to install the accelerometer library. Go to

"https://learn.sparkfun.com/tutorials/lis3dh-hookup-guide#getting-the-arduino-library", click "Download the Arduino Library," and install that library by going to Sketch > Include Libraries > Add .ZIP Library and selecting the downloaded file to install. See the above images for assistance.

Congratulations, you installed the board packages! Now, you just have to upload the code. Download the sketch_rocket_accel.ino file below (you can optionally download Info.cpp too, it contains the installation instructions I listed here, but it's not necessary) and open it in the IDE. (If you want, on the line in the code where it says 'myIMU.settings.accelRange = 8;' you can switch that value to something else (either 2, 4, 8, or 16)--that value is the maximum acceleration to be measured. Note that the higher that number is, the bigger range of acceleration values the device will sense, but the less precise it will be.) Connect the Arduino Pro Micro to your computer, upload the code, and you're all set!

Try It Out!

To use the device, first plug a MicroSD card into the reader, then plug the red wire from the board into the red spot on the header and the black/blue wire into the other one. It will immediately start a 30-second internal timer, at the end of which, it will blink the left LED on the bottom of the board briefly and then record data for 20 seconds and then begin alternately blinking each LED on the bottom of the board, which tells you that it was successful. To use it in a model rocket with a receptacle nosecone (e.g. an egg carrier), you would insert it into the nose cone, either flat '⎯' (the acceleration will be measured on the Z-axis) or vertical '⏐' (the acceleration will be measured on the X- or Y-axis), then plug in the battery, start a 30-second timer on your phone or other device (to match the one inside the Arduino), quickly close up the nosecone, and launch the rocket ~5 seconds after the timer is up (to be safe).

Process Data

See file.png
Select Upload.png
Browse Disk.png
Select File.png
Select Files Menu.png
Select Upload Files.png
Select Log File.png
Run Program.png

To process the data, first go to this link:

https://drive.google.com/drive/folders/1baxqW9eg6HbJYxMV9oiNJ8VkA8DMa1Oe?usp=sharing

and download the file (made by a colleague of mine and me), then go to colab.research.google.com, log in with your Google Account (or make one if you haven't already), and click on Files > Upload Notebook, click Browse, select the downloaded file (that came from the above link), and click Open. Then, once it opens, click the file icon in the left-hand toolbar, wait for it to connect to a runtime (if it shows that message), click Upload, insert the MicroSD card and select the file inside the MicroSD card labeled "LOG.TXT". Then, just run the program, and it will give you a graph of each axis of measurement!

View Graph

Vertical.png

Above is my graph of the axis that was positioned parallel to the rocket's flight direction--up (in this case, Y). I had unfortunately failed to set the range of measurement for the device correctly, and so the peak of the acceleration was chopped off in the graph. I superimposed the dotted lines on the graph (your result won't have them by default) after viewing. All in all, a reasonable success!