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

  • SuperFlux / about 14 years ago / 2

    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

  • flight / about 14 years ago / 1

    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?

  • WarDamnEagle / about 14 years ago / 1

    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.

  • HardwareGeek / about 14 years ago / 1

    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.

  • BlueValleyTech / about 14 years ago / 1

    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! :)

  • BBB / about 14 years ago / 1

    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? :)

  • Dinuka / about 14 years ago / 1

    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.

  • Member #160581 / about 14 years ago / 1

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

  • Gulopine / about 14 years ago / 1

    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.

  • Gulopine / about 14 years ago / 1

    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!

  • Lee / about 14 years ago / 1

    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? :)

  • Azayles / about 14 years ago / 1

    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.

  • PeterG / about 14 years ago / 1

    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.

  • Member #76709 / about 14 years ago / 1

    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 =><br />
    it's a kind of opensource matlab...

  • tz / about 14 years ago / 1

    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 />

  • chortik / about 14 years ago / 1

    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.

  • Butterwaffle / about 14 years ago / 1

    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).

    • superbrad / about 14 years ago / 1

      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.

  • CF / about 14 years ago / 1

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

  • Drmn4ea / about 14 years ago / 1

    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.

  • Exonerd / about 14 years ago / 1

    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!

  • Imroy / about 14 years ago / 1

    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.

  • dksmall / about 14 years ago / 1

    Tutorial on chute packing?? :-)

  • Ben121 / about 14 years ago / 1

    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 ( Ah well, gnuplot here I come.

  • kwan3217 / about 14 years ago / 1

    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] ( 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 />

  • Aditya / about 14 years ago / 1

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

  • JRMorrisJr / about 14 years ago / 1

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

    • PeterG / about 14 years ago / 2

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

  • RobotNinja / about 14 years ago / 1

    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.

  • AtommotA / about 14 years ago / 1

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

  • pubdc / about 14 years ago / 1

    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.

      • Chip Geek / about 14 years ago / 1

        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.

        • kwan3217 / about 14 years ago / 1

          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?

          • jbrandmeyer / about 14 years ago / 1

            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

2 Open 2 Sauce


All Tags