Shop OBEX P1 Docs P2 Docs Learn Events
Model rocket datalogger and data analysis — Parallax Forums

Model rocket datalogger and data analysis

DuctapemasterDuctapemaster Posts: 90
edited 2007-12-22 22:29 in General Discussion
A while ago I ame up with this idea that I wanted to build a model rocket datalogger so I could determine the altitude, velocity, and acceleration of the rocket on its flight. I plan on using a 1 axis accelerometer (I really want a 3 axis, so I could get a 3D graph of the rocket's trajectory, but I will start here) that measures the upward (z axis?) acceleration. I am going to store the values obtained in an EEPROM and then download them to a laptop on the ground to be analyzed. Now, I can do all that without a problem, but my real question is what program do I use to do the analyzing/graphing of the data. I need to take the data, put it in a graph (acceleration v. time), take the integral of the graph, graph it (velocity v. time) and take the integral of that graph and graph it (position v. time). People have used MATLAB and Maple to do it, but I'm 17 and I don't have the funds for either of those programs or a place where I can use them nearby. I did find one program that does half of what I want. It graphs the integral of the data I input to it, but I can't graph the second integral. And, not to mention, it comes up with about 5 or 6 different memory errors when you try to use it. (If anyones interested, the program's called RT Plot) Can anyone help me find a suitable program for this? Freeware/open source is the best, but something relatively inexpensive will do also.

Thanks!

-Dan

Comments

  • steve_bsteve_b Posts: 1,563
    edited 2007-12-18 19:17
    Openoffice comes with a spreadsheet program that's close to Excel.

    I haven't tried doing integration/derivation in Excel, but it sure makes purty graphs! [noparse];)[/noparse]

    Oh ya, openoffice is free...google it!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <FONT>Steve



    What's the best thing to do in a lightning storm? "take a one iron out the bag and hold it straight up above your head, even God cant hit a one iron!"
    Lee Travino after the second time being hit by lightning!
  • Tracy AllenTracy Allen Posts: 6,667
    edited 2007-12-18 19:27
    Do you have EXCEL or some other spreadsheet program? Integration is basically cumulative addition from one column to the next. That is, assuming that your samples are taken at regular intervals. Spreadsheets include simple but effective graphing and are very helpful for all kinds of exploratory data analysis.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • DuctapemasterDuctapemaster Posts: 90
    edited 2007-12-18 20:32
    Yeah, I do have Excel and yes the samples will be taken at regular intervals (10x a second or faster). I have some test data I've been working with and I couldn't find out how to do integration in Excel so I went looking for something else. If you guys could help me do it, I would be very grateful.

    Thanks!

    -Dan
  • sylvie369sylvie369 Posts: 1,622
    edited 2007-12-18 21:43
    I did something quite like this last March. How's your basic calculus? You can do this by hand, for the most part, and learn more.

    First, graph the acceleration data that you've collected. Then find the best-fitting curves for the various parts of the flight. Rocket engines do not provide a constant thrust, so you'll find that your data vary with the thrust curve of the motor you're using, roughly. There's a number of ways of finding those best-fitting curves, including Excel, SPSS, and probably quite a few free statistical programs. Keep your functions simple - constants, straight lines, simple curves, etc. You can do that by picking appropriate segments of the data , and keep in mind that you don't have to be exact. You might even be able to get by with just lines.

    Once you've got the curves, you don't need a program to do the integration - you can do it by hand (or anyone who has had one semester of calculus can, anyway), figuring it separately for each part.

    If you want to see what I did, drop me a private message.

    What kind of rocket/engine are you using? Mine was a 16-pound, 5.5" diameter scratchbuilt, flying on an AMW K800. I got 3800 feet at about 410 miles per hour.
  • DuctapemasterDuctapemaster Posts: 90
    edited 2007-12-18 22:30
    The only reason I wanted to have it done by a computer is because I didn't really want to sit out in the desert sun doing calculus, but it works...but yeah, breaking the graph into parts would be simple enough. I know how to do best fit lines/curves in excel, so that wouldn't be terrible. Also, I was thinking that I could use the trapezoid method, programmed as a function in excel, to do the calculation. All the numbers are there; it would be as simple as writing out the equation.

    Also, I'm not using this on a large rocket. I haven't quite gotten into the larger scale stuff yet plan to eventually though) so I'm still launching Estes rockets and my own creations (heh, nicknamed "the illegal rockets"). The datalogger is going to be put into a 36D^2 rocket (dual "D" powered) which has an optional payload bay.

    I was browsing the parallax site and I found a USB flash drive datalogger module, which would be perfect for this. I could store multiple launches on a single (32mb?) drive and the data is stored as a format that excel can read, so it will work perfectly. Just another item on my christmas list...

    Thanks for the suggestions. I will definitely try that out.
  • sylvie369sylvie369 Posts: 1,622
    edited 2007-12-18 22:44
    How do you plan to mark the time in your data?

    I've got a little dual-axis accelerometer I'd like to fly, set up to transmit the data back to the ground through an XBee Pro module. But since the function needed is f = a(t) (that is, a function of time), the data points will have to be associated with specific points in time. When I did this in March, I flew a big honking Vernier Labpro unit, which recorded all of that for me, but now I want to fly a much smaller setup using Stamp modules·- something that I could put into a 3" diameter rocket and fly on H and smaller motors. Right now I'm expecting to use a 2pe unit.

    An alternative would be to look at the acceleration and compare it with the motor's thrust curve (in particular, the known burnout point) and use that as an estimate of time. But that'd add perhaps quite a bit of additional error.·A good real-time clock marking time would be very helpful.

    Of course I could set the program to sample every Nth fraction of a second (say, 10x/second, which by the way should give you a reasonable set of data to work with), and test it for accuracy on the ground against some timepiece here. What do you think?
  • DuctapemasterDuctapemaster Posts: 90
    edited 2007-12-18 23:00
    I am going to be using the SX chip for my datalogger so I plan on using interrupts to keep time. I am going to use the DS32KHz module from maxim (it outputs a temperature stable 32.768KHz signal), scale it down in the software, and take samples every so many pulses. I can't think of another reliable way to do it. Maybe if you had an external clock source, polled it in a loop from the stamp, and took a sample every time the source went high that would give you a reliable time base. But then again, you have to be careful how long the sampling/writing routine takes, so that you don't miss clock cycles.

    The thrust curve idea is one of those "good on paper, bad in practice" things. Rocket motors aren't especially known for consistent performance, so there would be some deviation from the rated specs. How much, I don't know, but from what I read it can be a lot (think 20+%). I don't know how the larger motors (bigger than "E") perform, but I suspect that they have the same characteristics due to manufacturing inconsistencies.

    You might be interested in this page: http://www.rocket-roar.com/rap/alt.html

    That is where I got this whole idea from. I'm obviously changing/improving his setup, but what he did seems to work fine.

    You might consider looking into the SX. They are easy to program (slightly more difficult than the Stamps, but it's still BASIC), very fast and adjustable processor speed, and they're really cheap if something happens to the chip. And, it's only slightly more expensive to get started with them than the cost of a new Basic Stamp.

    Let me know if you need anything else!

    -Dan
  • sylvie369sylvie369 Posts: 1,622
    edited 2007-12-19 00:27
    Oh, excellent - yes, that site does have a lot of information that I can use. His data look a lot like what I got (upscaled, of course) from my flight carrying the Labpro. We also had a rapid response temperature probe recording during the flight, and found a temperature inversion on the way down. I'm impressed that he was able to build a recording accelerometer that'd fit into a Hercules. Too bad about the CATO. Man.

    Agreed re. the crudeness of using thrust curves - it's not any better when you're using large (I, J, K) motors than when you're using A, B, C, or D motors. Lots of variation. It'd be a last resort. I think they typically tell us that the variation is +/- 10%, but the variation in delays (when you're using motor ejection) is obviously a LOT higher than that, and I have to believe that there's the same kind of variation in things like burn time.

    I've been considering getting into the SX chips, and obviously the interrupts thing is a good reason to do so. I almost ordered some a couple of weeks ago, but I saw that "end-of-life" warning on the SX-Key, and thought I'd hold off a while. I've got plenty of projects going already here.
  • DuctapemasterDuctapemaster Posts: 90
    edited 2007-12-19 01:15
    Great! Glad I could help. It's too bad that he hasn't updated his page in a long time. I would have talked to him a bit about this stuff...oh well, thats why I'm here!

    Also, about the SX key, parallax is phasing out the serial version and thats why it's labeled with "end-of-life". They're coming out with a USB version, like the SX blitz. Personally, I would wait for it. USB is so much better than serial!

    -Dan
  • DuctapemasterDuctapemaster Posts: 90
    edited 2007-12-19 19:58
    I was reading about something called an "integrating" or "sigma-delta" ADC...from what I saw they are commonly used in this application. I don't really understand how it works, so could anyone explain?
  • Paul BakerPaul Baker Posts: 6,351
    edited 2007-12-20 01:20
    There was a utility called StampDAQ which permited importing data into Excel via the serial port, a while back the package underwent a significant revision and was named to something else (something like ParallaxDAQ, but that search term isn't turning anything up), I can find out what the name of it is now and where to find it.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.
  • sylvie369sylvie369 Posts: 1,622
    edited 2007-12-20 01:29
    Paul Baker (Parallax) said...
    There was a utility called StampDAQ which permited importing data into Excel via the serial port, a while back the package underwent a significant revision and was named to something else (something like ParallaxDAQ, but that search term isn't turning anything up), I can find out what the name of it is now and where to find it.

    It's PLX-DAQ, and it's right here:

    http://parallax.com/ProductInfo/Microcontrollers/BASICStampSoftware/tabid/441/Default.aspx
  • Paul BakerPaul Baker Posts: 6,351
    edited 2007-12-20 02:28
    Thanks sylvie

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.
  • Tracy AllenTracy Allen Posts: 6,667
    edited 2007-12-20 06:40
    Hi again,
    Integration: Once you have your data imported into EXCEL, it will be a sequence of acceleration values in one column. If it is not acceleration, but something like voltage, then you need to make another column that has a formula to get to acceleration. You can make a graph of acceleration vs time ticks. So now you have a column (column A say) with an acceleration for each tick of the clock produced by your accurate DS32Hz/SX interrupt system. Say the time tick is 1/4 second. Now in the next column make a cumulative sum of the acceleration column, as follows. In cell B1, write (=A1/4), and in cell B2, write (=B1 + A2/4). Copy that formula into the rest of column B, so each cell is the sum of the one above it plus the one to its left. The /4 comes from the the area of a little bar that is 1/4 second wide times the acceleration at that instant of time. (but of course use your time tick value!) The sum of all those little areas is the integral of the acceleration, and now you can graph it. That's it, integration is just a cumulative summation. There are of course refinements to be had with better instruments and little tricks in the analysis, but hey! These are discrete time samples, and there will be lots of little errors that accumulate, always a problem with dead reckoning inertial navigation. Can you see how to get the second integral, distance traveled, which should of course end up back on the ground?!

    PLX-DAQ is for real time import of data into EXCEL. Say you had a radio-telemetry module on the rocket, the xbee pro for examle, you could send the readings in real time back to a ground receiver attached to a PC, and the data would appear in the EXCEL spreadsheet row by row. It is a different matter if you log the data during the flight and retrieve it after. Say the data is a text file on a thumb drive. Then you can put the thumb drive in the PC and open the data file in EXCEL.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com

    Post Edited (Tracy Allen) : 12/20/2007 6:46:18 AM GMT
  • DuctapemasterDuctapemaster Posts: 90
    edited 2007-12-20 20:25
    Wow, thanks for writing all that out! It makes a lot of sense. I am going to order the USB datalogger module sometime soon so I will try this out as soon as I get it. Thanks again for all the help!

    Also, if someone could help me out with my other question on integrating/sigma-delta ADC's that would be great. I need to decide which ADC to use with this project too...I need a 16 bi one, preferably serial. Any suggestions/example code?

    Thanks,

    Dan
  • Tracy AllenTracy Allen Posts: 6,667
    edited 2007-12-21 16:44
    First off, I don't know if this is a confusion, but the "integrating" as in sigma-delta has nothing at all to do with the integration of acceleration to velocity and postion we were talking about before.

    Sigma-delta ADCs use a capacitor to "integrate" the sum of an input current plus a +/- quantized current provided by a binary output (from the microprocessor). The integration takes place on a capacitor, connected to a threshold detector that detects whether the voltage on the capacitor is > or < a fixed threshold. Through feedback, the voltage is made to hover very close to the threshold, and the feedback comes out through that quantized binary output. If the input current is high positive, as a result the binary feedback will stay low a proportional amount to compensate. The result of the measurement is in fact the proportion, as the microprocessor keeps track of the proportion as it counts the highs vs lows. There has been a lot of discussion of this on both the SX forum and also on the Propeller forum, and you can find examples of code. However, for a variety of reasons, you cannot expect to achieve close to 16 bits of resolution when using one of those micros. 8, 10 or even 12 bits, yes, with careful layout. Another thing is, the more bits you want to measure, the longer you have to wait in order to determine the proportion, and that time is also directly related to the clock frequency.

    There are other converters, of course with serial interface. At more than 12 bits, things become kind of specialized. Many converters at that resolution are in fact sigma-delta, but are designed specifically for that purpose and get around the limitations that you would have in implementing it on the microprocessor. For example, a single conversion might take 10 or 20 milliseconds. How often do you expect to sample? Will you need other measurements as well?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • DuctapemasterDuctapemaster Posts: 90
    edited 2007-12-21 20:08
    Haha...I meant 8 bit resolution. I had hex on my mind all afternoon and I was thinking base 16...

    But yeah, 8 bits should be enough resoluion for what I am trying to obtain. I could go to 10, but only if time doesn't become a problem. I plan on sampling about 60 times a second MAX. It may be less than that in the end, but that is my goal. I have to make sure I can write to the USB datalogger module that fast though (I could write multiple measurements at once).

    So, I now understand how those ADC's work (I didn't actually expect them to integrate for me, although that would be awesome if it did) but I am still wondering whether they are any better than a normal ADC. What advantages do they have over a regular one? Do I really need one in this application?

    Thanks for all the help! It's greatly appreciated!

    -Dan
  • Tracy AllenTracy Allen Posts: 6,667
    edited 2007-12-22 22:29
    Sixty times a second will not be possible with the BASIC Stamp, and you probably won't need that many samples anyway. It takes time to do the A/D conversion, and to format and send the data to the card. On a BASIC Stamp a tight loop of that kind might take 30 milliseconds, but with transfer to the card, you might allow more like a 100 milllisecond loop. 10 samples per second. Things can be faster on an SX or Propeller. There are tricks too, for example, by having the Stamp do other tasks while waiting for the ADC or the card to finish.

    ADCs vary widely in capabilities, and that partly explains the bewildering array of options. One 12 bit ADC I have used is the ADS1000, which is a 12 bit converter in a tiny SOT23 package that can be mounted right next to a pressure sensor, and it contains a x8 programmable gain amplifier. It takes about 8 miliiseconds for it to do a conversion. The similar higher resolution (sigma-delta) ADS1100 or MCP3421 takes anywhere from 8 to 125 milliseconds for one conversion, depending on the resolution required. You don't want the acceleration to change very much during the course of one conversion! You mentioned the AD7705 in PM, but I am not familiar with it. The successive approximation converters that I use most often are much faster, with conversion times at around 10 microseconds, and they also have track and hold circuits, so they can grab a level from a changing waveform. There are several different "topologies" for these converters. I would say that since you are just starting with this, use a converter for which you have example code available for the Stamp or SX. I'd recommend *against* using a sigma-delta routine in firmware in the chip. It will simply require too much calibration and hassle. Experiment, yes, but buy an external ADC for the project.

    8 bit converters are quite common, and code is available, but you have to be sure that it will give you enough resolution. That is, how do the acceleration values you expect fill up the range of the converter? Some sensors have a tiny differential voltage output, whereas others have a lot of internal circuitry that brings their output up to a more convenient zero to full scale range.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
Sign In or Register to comment.