Shop OBEX P1 Docs P2 Docs Learn Events
Help Needed Using Propeller with micro-SD Card Adapter — Parallax Forums

Help Needed Using Propeller with micro-SD Card Adapter

Juliet Oscar EchoJuliet Oscar Echo Posts: 31
edited 2011-09-16 08:02 in General Discussion
New to the forum and this is my first post. I have limited programming experience and need help. My first introduction to programming was the BS2 a few years ago, then a year ago I decided to try my hands at the Propeller.

I'm trying to build an application that saves sensor data to an micro-SD card using the Gadget Gangster Propeller Platform USB with built in micro-SD Card Adapter. Currently I'm using the fsrw object suggested by the product manual to create a comma delimited string that saves to the output.txt file opened on the SD card. The goal is to then import the .txt file to Microsoft Excel for analysis. The problem is the file is just one long string. Is there any way to modify fsrw so it writes a new line to the .txt file when you write a new set of updated sensor data? That way when I import the .txt file into excel it will automatically put it into rows and columns instead of one long row.

The goal is to go from this:

time,var1,var2,var3,var4,time,var1,var2,var3,var4,time,var1,var2,var3,var4,time,var1,var2,var3,var4,time,var1,var2,var3,var4,

to this:

time,var1,var2,var3,var4
time,var1,var2,var3,var4
time,var1,var2,var3,var4
time,var1,var2,var3,var4

The final goal is to fly the propeller with a pressure sensor (Parallax's VTI SCP1000 30-120 kPa Pressure Sensor module) on board a model rocket and retrieve the data for performance analysis.

Thanks

Comments

  • kuronekokuroneko Posts: 3,623
    edited 2011-09-11 00:26
    Assuming you use pputs now to write your strings simply add a number of pputc calls to add your required line delimiter(s), e.g.
    pputc(13)      ' CR
      pputc(10)      ' LF
    
    Or make it (delimiter) part of the payload string when you construct it.
  • Juliet Oscar EchoJuliet Oscar Echo Posts: 31
    edited 2011-09-11 00:57
    Thank you kuroneko. Works perfect.
  • prof_brainoprof_braino Posts: 4,313
    edited 2011-09-11 09:12
    Welcome to the forums

    Will you be posting any details on your project?
  • Juliet Oscar EchoJuliet Oscar Echo Posts: 31
    edited 2011-09-15 22:14
    Thanks prof_braino, I would be happy to if I get it successfully off the ground. Would I post the details in this forum or elsewhere?
  • prof_brainoprof_braino Posts: 4,313
    edited 2011-09-16 08:02
    You can post your code here in the thread to show it. Usually folks will look at it and give comments, which you can use or ignore as you see fit.

    If you think others would use it, and you want a bit of techno stardom, you can post the code in the OBEX if you want to share it with other tehcno's, ensuring your immortality.

    Between the start and end you can get lots of interesting input from other folks on the forums. Most are very knowledgeable and helpful. There's a few examples of "unmitigated cranky old man syndrome", but these are relatively few and far between. Mostly its otherwise fun.

    Tell us more about what you are doing. Also check out the SD regression tests in propforth if you want to see an example implementation in forth as an alternative to Spin or C, etc.
  • I thought I would close the loop on this project. I put my project in an Estes Big Daddy in late 2011 and flew it on the biggest engine I could legally fly without an FAA waiver. Unfortunately the parachute failed to deploy correctly and the rocket hit an empty parking lot next to the launch field really hard. The Gadget Gangster Propeller Platform USB survived but power was disconnected on impact and the data on the SD card was lost since you have to close the file to permanently save the data. Closing the file and then reopening it to continue saving data takes time. My main routine only did this every 5 minutes or so to reduce the chance of a large gap in my data during the flight. I never flew the project again.
  • I thought I would close the loop on this project. I put my project in an Estes Big Daddy in late 2011 and flew it on the biggest engine I could legally fly without an FAA waiver. Unfortunately the parachute failed to deploy correctly and the rocket hit an empty parking lot next to the launch field really hard. The Gadget Gangster Propeller Platform USB survived but power was disconnected on impact and the data on the SD card was lost since you have to close the file to permanently save the data. Closing the file and then reopening it to continue saving data takes time. My main routine only did this every 5 minutes or so to reduce the chance of a large gap in my data during the flight. I never flew the project again.

    Wow, that certainly is an update, I don't think anyone has been hanging on waiting for this news :)
    BTW, I like to preset the size of my file and simply write and flush sectors where a sector is flushed once it becomes full or else after a very short time in the range of milliseconds to seconds. If the data is in ASCII then it is always easy to read and the null at the end of the written data is easy to find and can optionally be used to change the file size in the directory if necessary at read time.

    Next we will hear what happened to Amelia Earhart!

  • Cluso99Cluso99 Posts: 18,069
    The data except for the ending is likely recoverable by doing a low level sector reads.
  • Cluso99 wrote: »
    The data except for the ending is likely recoverable by doing a low level sector reads.

    That's a great idea. Now all I need to do is find that micro SD card from 8 years ago :smile:
  • Juliet Oscar EchoJuliet Oscar Echo Posts: 31
    edited 2019-04-25 19:16

    BTW, I like to preset the size of my file and simply write and flush sectors where a sector is flushed once it becomes full or else after a very short time in the range of milliseconds to seconds. If the data is in ASCII then it is always easy to read and the null at the end of the written data is easy to find and can optionally be used to change the file size in the directory if necessary at read time.

    Sounds like you have a lot of experience with SD. At what Kbps rate are you able to save data to SD using your flushing technique without having any gaps in data due to the time necessary to write/flush sectors.

    I have about 100 bytes of raw data I need to save at 50 Hz (5 Kbps), but I would prefer to save at 100 Hz (10 Kbps) if possible. Data needs to be saved for up to 10 minutes without any gaps. I've pushed SPI with some of my propeller projects at speeds of 6 to 7 Kbps so in theory I'm not too far from my goal of 10 Kbps when saving it in its raw format. If I save the same 100 bytes of data as ASCII characters in a CSV format, I'm probably looking at at least 400 bytes of data at 100 hz (40 Kbps).
    Wow, that certainly is an update, I don't think anyone has been hanging on waiting for this news :)

    As I've gotten older (and hopefully wiser), I've started to appreciate people who don't just disappear from the thread they started once somebody solves their problem. It's always nice to know how the story ends, even when reading a thread that is over 10 years old.
  • Ha ha, 40kbps is snail's pace :) I regularly save continuous 115,200 baud streams but last time I checked on the P1 I was reading up to 1MB/s and writing almost as fast.
Sign In or Register to comment.