SparkFun Electronics will be closed on November 26, 2020 and November 27, 2020 for the Thanksgiving holiday. We will begin normal operations at 9:00 AM Mountain Time on November 30, 2020.


Please see all COVID-19 updates here as some shipments may be delayed due to CDC safety and staffing guidelines. If you have an order or shipping question please refer to our Customer Support page. For technical questions please check out our Forums. Thank you for your continued support.

Rocket Sensors and gnuplot

We use a 9DoF Stick IMU and gnuplot to read and analyze model rocket data.

Favorited Favorite 1

Update: The 9DoF Stick IMU is now available! Check it out!

Recently, we completed development of our new 9DoF Stick IMU. The goal of the project was to make a very small and powerful 9DoF board with the simplest interface possible. What we came up with is a very slim, lightweight board with three sensors and a single I2C interface. We made the PCB itself thinner (0.88mm), resulting in a total weight of 0.9 grams. It's a light, simple, and versatile IMU, so naturally, we shoved it in a rocket. 

If you love something, set it free...

To log the data coming from the 9DoF Stick, we used the OpenLog, our small SD logger. We hacked the standard OpenLog code to initialize the sensors and log over I2C, and powered it with our smallest LIPO battery. The whole payload weighed in at just 5.26 grams.

Out in our back lot, we powered the device, placed it in the rocket, wired up the engine, and fired. We had waited for a nice calm day since we have lots of neighbors. The rocket flew beautifully (C6-5 engine), seemed to deploy its parachute correctly, and then triumphantly drifted down to our neighbor's 3rd story roof to do some battery-life testing.

We plied our neighbors with cookies and finally got the rocket back the next day. The parachute deployed, but the parachute lines were twisted so it didn't make what one would consider a "safe" landing. Our electronics were intact, but one of the rocket fins was not.

...if it comes back to you, analyze it.

The data log from the launch showed that the device logged at 59Hz for 1,512,225ms, or about 25 minutes. We have a huge amount of data, the task now is to analyze it as easily as possible. Since Excel and OpenOffice Calc have a max of 65,536 rows of data, we used gnuplot to analyze our 89,000+ rows. For those unfamiliar with gnuplot, it is a simple and well-documented text-based plotting tool. We were a bit rusty on the syntax, but found a brief but thorough tutorial that told us everything we needed to know.

When we plotted the entire data set, we found that only the first three minutes have interesting data. The remaining 22 minutes are just the rocket recording the conditions on our neighbors roof, so we cut it down to just view the action. Below are the three graphs that we got from the sensors.

The last graph is the data that was taken from the ITG-3200 gyro. It has been annotated to show what was happening during the three minutes of the rocket launch. Namely, placing the device in the rocket, attaching the ignition leads, the launch and landing, and then the first bit of the 22 minutes of waiting for the battery to die.

We used gnuplot to view the data because it was the quickest route to a descriptive graph. There are, however, many ways to represent this data that are more meaningful and aesthetically pleasing. Python, Processing, and other tools offer infinite ways to represent this kind of data. What do you use? What do you like? What do you find most useful? We've included all our data below along with the gnuplot script used to graph it. It's a good example of quick graphing from a data file, and can be quickly applied to large blocks of sensor data to see a quality graph.

Comments 41 comments

  • It looks like you Ay maxed (check out point 7485 to 7852), however if the senor was the ADXL345 (+- 16 g) its is not likely to be the case. <br />
    <br />
    Also, whats up with your magnetometer data? that must have been one ruff flight

  • How do you wire the 9DOF Stick IMU to the logger? I see how the battery is wired but how do you connect the SCL and SDA to openlog?

  • I used MATLAB to look at the data. One thing interesting that I saw before even trying to decipher the accel data was the variation in sample time. With a sample rate of 59hz there should be roughly 17ms between each reading. But when you graph the variation between sample to sample ( e.g. time(2) - time(1) ) there is a saw tooth like progression of variation between sampling frequency with peak variations of 163ms between samples. I would imagine this would not be very good if you were integrating the data to find velocity or position. Really cool what you guys are doing though. Hoping santa brings me a logomatic this christmas.

  • The problem with this product is that it needs a full 3 axis accelerometer with at least 50G capability in the Z axis for rocketry use. A nice add-on would be the unified temperature/humidity sensor. Great idea this product, just need components capable of logging the data from high power rockets.

  • Nice experiment!
    BTW, the 65,536 row limit you mentioned is only on Excel 2003 and older. All of the versions after that will support 1,048,576 rows. Well over what you needed for this project, and you will get much nicer charts! :)

  • The Beetle in the parking lot is very nice. How much ice do you get in the inside of the windows in the Colorado winters? :)

  • Very interesting stuff indeed. We've been meaning to do something like this for some time now, but could get our (home built) rocket finished.
    Anyhow, for those who are trying to make some sense out of the accl data, think I can help a little.
    1.) Prior to launch - 0ms - 130,000ms. Nothing interesting here. Y axis measuring a high + const value w.r.t x and z means that Y axis was vertical and pointing downwards.Z is measuring zero - it is nearly horizontal. X is measuring a slight + value - it is slightly slanted (which in-turn tells us that the value on Y axis should be slightly less than 1g)
    2.) Launch and Acceleration - This section in the graph is very small. It starts from the point the green line starts a sharp drop at about 130,000ms and ends at the point where the green line starts going up again. This is actually the burn time of the rocket engine.
    3.) Coasting - After the rocket has finished burning, the rocket continues to cost upward for a short time and then starts falling under gravity. When an accelerometer freefalls, it will measure a 0g. that's why the Y measurement suddenly goes to 0 for a brief moment at around 135,000
    4.) Parachute deployed descent - 135,000ms - 175,000ms Once the parachute deploys, the rocket is not falling under gravity. The downward acceleration is much smaller than 1g, therefore the green line is now not zero, but a negative value. One interesting thing to note is that the chute deployed slightly late. Ideally it should have deployed right at the end of coasting phase. This could be the reason why it got entangled.
    5.) Drop to the roof and staying there - from 175,000ms onwards
    Again not very interesting, but it seems that the rocket dropped on one of its sides, with X axis pointing approximately upwards.

  • I smoothed it severely and plotted, how do I upload the PNG?

  • Also, to add to the endless stream of product requests, I'd love a similar stick for weather measurements (temp, humidity, pressure) that can be easily waterproofed.<br />
    <br />
    Oh, and something like OpenLog that's built for I2C, because it seems like that'd be a great way to chain a bunch of these small sticks together (IMU, weather, light/proximity, GPS, etc) for custom logging projects. If not a separate product, at least post the I2C code you guys hacked together for this.

  • This looks great! You guys really should update the Accelerometer, Gyro, and IMU Buying Guide. Not only is this not in it (nor is it linked from this product's page), it still references the deprecated 6DOF Razor. Keep up the good work!

  • Your post mentions the word "power" three times, yet you don't measure it? ;) <br />
    <br />
    I took the first 20 seconds of data(skipped the first row) and calculated "1g" to be roughly 285 units with a standard deviation of about 5%. The datasheet for the ADXL says a range of 232-286 LSB per g is typical, but the variation seems high. I see a lot of spikes in the data when the rocket should have been sitting still. Where could that come from? I presume it isn't noise since it's battery power -- environmental vibrations?<br />
    <br />
    If I did the math right, the max acceleration was only 3.1g +/- .1, which seems low. -- how much did that puppy weight, all-in? :)

  • You chaps at Sparkfun need to make an all-in-one logger that has magnetometer, accelerometer, gyro and altimeter functionality, is tiny and runs of a lipo cell. Maybe something with a button to press to start logging.

  • JRMorrisJr:<br />

    Wonder what the data would look like if you taped this logger to the back of a boxers head.
    <br />
    You mean the dog, or the athlete?<br />
    <br />
    Major LOL either way!<br />
    <br />

  • Wow, between this article and the one on using accelerometers to measure seismic activity, it seems like now would be a great time to throw down a tute (or even links) on =making sense= of this kind of real-world data. Specifically, some guidance on design, config, and analysis, especially for real-time embedded applications.
    <br /><br />
    I have to imagine there are a whole lotta SF customers who buy these kinds of sensors thinking they are going to get smooth data that makes logical sense... and instead they are either overwhelmed by the noise seen in the rocket's logs, or underwhelmed by an earthquake barely registering on the sensor.
    <br /><br />
    For example, what information about the dynamics of the rocket flight can be teased out of that data set? How high did it go? How fast was it going when it hit the neighbor's roof? More broadly, how can a smart layman start with twitchy data and get to that kind of information? How would you go about doing the same calculations on an 8-bit microcontroller, so that the flight computer itself knows that it's falling too fast?
    <br /><br />
    Juicy stuff, and a golden opportunity to share the next few steps.

  • if you only want to plot data, gnuplot is nice, but if you want do do some computation and show graph, you can use SCILAB => http://www.scilab.org/en<br />
    it's a kind of opensource matlab...

  • So when are you going to do an 11-Dof by adding one of the baro/temp sensors?<br />
    <br />
    if you do, would one of the newer, smaller i2c accels work better?.<br />
    <br />
    (I told you to add I2C to the OpenLog!).<br />
    <br />

  • judging from your accelerometer data, the electronics were not mounted perpendicular to the ground, if they were, red and blue charts would mirror each other prior to launch.

  • I typically use Octave or Python+numpy for data exploration and then VTK and ParaView to do more in-depth analysis. VTK and ParaView both have Python+numpy integration but do have a bit of a learning curve.<br />
    <br />
    Octave is nice because it provides a lot of tools for doing filtering which kwan3217 and Ben121 hinted at.<br />
    For instance, since you don't appear to have calibrated the accelerometer beforehand, I thought it would be interesting to see if I could use the quiescent period before launch to pick out the maximum acceleration. But it looks like you set the accelerometer range to +/- 2g.<br />
    <br />
    Also, as far as all the noise goes... how well was the 9-DOF stick mounted to the rocket? And how well were the PCB components mounted to the board? Any chance the sensor stick could bend over and short wires against the data logger? Because you might be recording the sensor bouncing around instead of the rocket motion. Or you might be recording electrical noise. If you haven't seen it, this guy had some cleaner-looking data and he epoxied the circuit components together on the board...
    Edit: I was looking at the wrong columns in the data in the previous version of this comment (and couldn't make sense of the peak acceleration because it wasn't acceleration I was looking at).

    • I also use Octave. It's got a pretty healthy support community, and is very compatible with Matlab code.
      I've used Octave for most of my Matlab assignments throughout college without any significant issues - while it doesn't have the same external hardware interfacing and other features of Matlab, it's still very powerful.
      It also outputs things nicely using gnuplot, without requiring you to know all the funky syntax.

  • I built this very same rocket when I was a kid!<br />
    Estes Payloader?

  • Thirding the recommendation of Python + matplotlib + NumPy (if data analysis is needed). Matplotlib is historically focused on 2D plotting, but in recent versions there is some support for 3D (surface / mesh) graph types as well.<br />
    <br />
    BTW, much of matplotlib's published docs/examples assume operation from a Matlab-like interactive shell. If anyone is interested in code examples for embedding matplotlib in a stand-alone GUI, I / my employer recently released an open-source python GUI for basic vibration data analyses (time, FFT, STFT / spectrograms). It's written with our USB vibration recorder stick in mind, but will also take any .CSV file of (timestep, x, y, z) from your own favorite source, and may make a helpful starting point for writing your own grapher.

  • That board's size & mass are amazing. I do biomechanics research and would love to play with one of these in our lab. Couple it with a data logger (as you did) and it would be ideal for some of our experiments (although a magnetometer is overkill, lol). Please post your link ASAP! :)

  • I agree with NinjaMoose. Python + matplotlib = win!

  • That accelerometer data looks awfully noisy. Or are they data/bus errors?<br />
    <br />
    As for processing the data, I'd use Perl. But that's just because I've long used Perl for all sorts of stuff. Python would probably be just as good, it depends on what you know and are good with.<br />
    <br />
    And lastly, don't use JPEG for diagrams. Use PNG instead. The files will actually be a lot smaller because the content will better suite PNG's compression methods, and you won't have any artefacts.

  • Tutorial on chute packing?? :-)

  • The Data appear unintelligible. It might be improved if it were filtered.<br />
    <br />
    I would expect a strong and isolated acceleration signal from the rocket firing, followed by a single-axis gyration signal; instead I see noise amplitude where signal should be. Cool and all though, I'd be interested in the board with the mag sensor left out (optional though, leave the footprint). Also .1 pitch connections are beginning to overwhelm the size constraints - perhaps a footprint on the other end for a smaller profile connector?

  • And here I am dinking around with web-based XML/SWF Charts (http://www.maani.us/xml_charts/). Ah well, gnuplot here I come.

  • I've been planning on designing one of these for BatchPCB. Thanks for saving me the trouble (if you picked the right sensors). I have flown a Logomatic along with 9dof of sensors in a much wider rocket, see a reconstruction on [YouTube] (http://www.youtube.com/watch?v=it6BsJS9C4w). The rocket reached a top acceleration of just under 6 Gs, and reached 50m/s and 150 m altitude. The parachute then failed and the nose cone plummeted from 150 meters. The electronics survived, I still use them to this day.<br />
    <br />
    This data appears a bit noisy, also did you calibrate the sensors before flight?<br />
    <br />

  • Awesome stuff.<br />
    <br />
    Just wanted to note, excel 2007 and over support 1 million+ rows and make prettier graphs :P

  • Wonder what the data would look like if you taped this logger to the back of a boxers head.

    • You mean the dog, or the athlete? <br />
      <br />
      Major LOL either way.<br />
      <br />

  • For plotting, I use matplotlib which is a library for python. For all those students out there, I highly recommend the Enthought Python Distribution which sets up python, matplotlib and a ton of other useful libraries with one install, on lots of different operating systems and it's free for students.

  • The link to the Rocket Data and gunplot script is bad...404 Not Found on the .zip file

  • What a tease ! I have been looking for the perfect present for my nephew, here its is, complete a little demo of what can be achieved... but no product link for the 9DoF stick ! Common, please, you're breaking my nephews' heart )-; OK, I'll take one that was rocket-proofed if need-be.

    • We have no intention of breaking your nephew's heart. Give is a couple of days, you'll see the board.

      • What sensors are used on this board? It would be nice to see graphs for just before lift-off to just after parachute ejection. ie, zoom in on the interesting part.
        Edit: Nevermind, it's in the gnuplot script. HMC5343 Magnetometer; ADXL345 Accelerometer; ITG3200 Gyro
        If the price is right, I'll be buying one of these.
        Edit 2: Now we just need one of these with a SCP1000-D01 Barometric Pressure Sensor added.

        • The sensors are fine, but I noticed that you don't have the interrupt lines for the accelerometer and gyro broken out. This is certainly usable as is, but it would be more useful if those two lines were broken out. You would end up with microsecond precision on the timing of the measurements.<br />
          <br />
          But, I just took the surface mount soldering class, so I can probably put the wires in myself.<br />
          <br />
          Also, 59Hz is hopelessly slow, especially on the gyros. A rule of thumb I have seen is either 100 samples per rotation, if you know the rotation rate, or 200Hz, whichever is higher.
          The accelerometer guide has a recommendation for the BMA180 as best digital sensor. I have two of them and I heartily recommend them myself. What made you choose the ADXL345?

          • kwan3217:<br />
            Also, 59Hz is hopelessly slow, especially on the gyros. A rule of thumb I have seen is either 100 samples per rotation, if you know the rotation rate, or 200Hz, whichever is higher<br />
            <br />
            Where does this come from? I respectfully disagree. Since you are only integrating the data, 10x the maximum pole of the system dynamics is fine. This sample rate should be enough to reliably follow up to 6Hz of vibration.<br />
            <br />

Related Posts

Recent Posts

Cuisine A La Carte

Picture Perfect Pi


All Tags