Go Down

Topic: SD card file naming (Read 3105 times) previous topic - next topic

aurelius

I need some coding help, and would appreciate any suggestions as to the feasibility of this idea and how to accomplish it.

I'm looking to incorporate a SD card to log disolved oxygen readings from an atlas scientific probe and breakout board. I would like to set up the arduino to write to a new file for each reading. I'm looking for a way in which I can have the file be named based on the date/time as well as a user defined 5 digit number. i.e. 2012.10.10.09.30.xxxxx.csv.

I would like the date and time section of the file name to be set automatically, and use a rotary encoder to scroll through 0-9 and use the momentary switch to move to the next number in the user defined section. Once the last number is selected, pressing the momentary switch would begin logging.

As far as the SD card, I was looking at using the Parallex SD card adapter sold by Jameco (2082935), but am open to other options. Any guidance would be greatly appreciated.


dxw00d

I don't think any of the Arduino SD libraries support filenames that are not in 8.3 format.

aurelius

ok, so I'm limited to 8. I suppose if the file has a date created stamp, it would have a time as well, and I could name the file simply the user defined number.

dxw00d

Someone else will have to confirm, but I don't think files are date/time stamped either. Generally, the Arduino doesn't have date/time information.

dannable

There is a function for time stamping the files - try a search for it. I've had a play with it an it seems to work. If you can't find it I think I have a copy saved at home.

I have a directory named with the date (20121011) and put my files, named with the time (132310.txt), in there.
Beginners guide to using the Seeedstudio SIM900 GPRS/GSM Shield

PaulS

Quote
I would like to set up the arduino to write to a new file for each reading.

Why? A new file per day I'd understand. One file for all readings, time stamped, I'd understand.

One file, one reading, I don't.

aurelius

#6
Oct 12, 2012, 02:13 am Last Edit: Oct 12, 2012, 02:23 am by aurelius Reason: 1
PaulS,

I would like one file, one reading and the date and time stamp to correlate DO to brix in a fermenting barrel of wine. The user defined number will be the 5 digit barrel number. We're looking to see with a few hits of oxygen from a stone at different intervals affects the rate of fermentation and temperature. I'm looking for an easy way to differentiate the different times we hit each barrel with O2. Since I can't use more than 8 characters for the file name, I'm thinking of adding a letter to the end of the number sequence to denote the time sequence. This however, runs into the problem that I would need to write out the letter to keep track of which is next in the sequence. If I'm doing that, I might as well write down the time and date as well on a paper list & rename the files to the format I originally suggested once on the computer. That is just more work, and I think there could be a more elegant solution that isn't causing me to spend a bunch of time cross referencing that paper list.

dxw00d

If you are using sdfatlib, rather than the cut down version (SD.h) supplied with the IDE, you can update the timestamp on files, but you will need to maintain the time within your sketch, either with an RTC, or using the software-only Time library functions.

http://code.google.com/p/sdfatlib/

Go Up