sdfat vs. sd

Hi everybody,

I'm a newbie to all of this, but I'm doing a rainfall measurement project and I need to collect and store data quickly with Arduino

What's the difference between the SDfat library and the regular SD one that came with the Arduino program? I've got both of them, and SDfat library seems to be more involved but is also associated with some posts on storing data quickly. Is one better than the other to use?

I am the author of SdFat. SD.h is a wrapper for an old version of SdFat that provides an alternative API.

SD.h works well for most people. It has bugs but these don't affect most people. Most users don't need the features or higher performance of SdFat so SD.h will probably work fine for you.

So the SD library included with the Arduino IDE is SdFat with a simple API that reduces features but makes the library easy to understand and use. The new SdFat is also easy to use for simple sketches but has a different API.

1 Like

Well, I can definitely confirm SDfat is much faster than SD.h. I was saving somewhere around 14 samples per second using SD.h, but with SDfat I'm somewhere around 500 per second. There may be a case of apples-to-oranges since I'm not sure I was saving the same thing in both situations, but the difference is still amazing. I have a few questions about reading with SDfat, but I'll have to organize my questions better before asking.

SDfat is a project-saver, fat16lib! Thanks!

1 Like

my experience, sdfat works, sd doesn't

3 cents (thats a bonus cent)

I am trying to get sdfat or sd to work.

I try the example data log sketches and watch in the serial monitor. sdfat reports no errors. I can see the rx led on the sd card shield light up. I have double checked the wiring.
When I pop the micro sd card in a reader and try to access the file on my computer I get a "problem opening the file...the file you opened has some invalid characters." Sometimes the first couple of lines will open correctly, but garbage for the rest.
I checked the card, it is formatted Fat16.

Is the card bad? Is there a command (not used in the Analogger example) to close the file so you can open it on the computer? Any suggestions on trouble shooting?

When I pop the micro sd card in a reader and try to access the file on my computer I get a "problem opening the file...the file you opened has some invalid characters." Sometimes the first couple of lines will open correctly, but garbage for the rest.
I checked the card, it is formatted Fat16.

Your PC can't access the files on the SD card. Some application running on the PC can. It wasn't the PC that said "Problem opening file...". It was an application on the PC.

So, what application is doing the complaining?

What sketch is writing to the SD card on the Arduino?

Hi

(my first post to this part of the Arduino forum)

Yesterday i tried to add SD.h to my project and gave up after 2h.
I converted everything to SdFat and got all running within 30 min.

Additionally: SD.h uses 2K more flashrom.

And to the Author of SdFat: Excellent library and outstanding documentation.

Oliver

Wow, I wonder all the time what the difference is thanks for all the answer. Cheers

Highly recommend SdFat! :slight_smile: Just started using Arduino framework with an AdaFruit Feather M0 datalogger. The SD library worked and was relatively easy to use but saw huge delay variations (not good for the acceleration/positioning data I want to log). In addition there was little documentation on how to resolve this.

SdFat can provide a similar interface, however its documentation starts out with tips on performance. The QuickStart code example has recommendations and shows a simple mechanism provided to up the SPI clock rate. My delay variation problem was solved via this mechanism and switching to SdFat. Note that you also get support for upper and lower case characters in file names (as well as long file names). Also you get C++ style streams if you want them.

Thanks for the library!

Greg