Go Down

Topic: Which micro SD card do you recommend for data logging? (Read 3748 times) previous topic - next topic

bbqq

Hi, several micro SD card modules are available for Arduino. Do they perform the same regardless of manufacturer? For data logging using the Mega, which card and at what speed do you recommend?

CrossRoads

I would select one that has it's own 3.3V regulator, a part like cd74HC4050 for 5V to 3.3V level shifting, and one equivalent gate of 74HC125 for buffering MISO back to 5V level.
Then you can confidently run it at full speed and not be concerned about a 3.3V level MISO dragging down MISO from any other 5V SPI devices.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

bbqq

Thanks. Do you mean it is better to provide the sdcard module its own dedicated power source? Is 3V coin battery better than 2xAA? In the Arduino world, is there a limit on the capacity of the card? Are 64GB or higher capacity cards supported by all SD card modules?

fat16lib

You can't use cards larger than 32 GB with the standard SD.h library.  

SdFat supports larger cards if they are formatted FAT32.  The default format for SDXC cards is exFAT.

The SD shield/module will not matter for performance as long as voltage levels are correct.  Coin cells don't provide sufficient current.

Performance of microSD cards is not easy to predict on Arduino.  Arduino uses SPI to access the cards and the SD library has a single 512 byte cache.

Modern SD cards are designed to be used on the high speed 4-bit SDIO bus with very large multi-block writes and reads.

Modern SD cards have very large, 16 KB or larger, flash blocks and emulate the single block access that Arduino libraries use.  This can mean much internal data movement, erasing of flash, and rewriting of data.

If you use the standatd SD.h library you will be limited to 4 MHz half speed SPI so performance will be limited.

If you use print text to the card, overhead in formatting the data may dominate performance.

If you use multi-byte binary writes SanDisk Extreme perform well in most applications.

Here is binary write performance for a 32 GB SanDisk Extreme microSD with SdFat at 8 MHz SPI.  

Quote
buffer size (bytes): 1, time (sec): 18.15, rate (KB/sec): 28.88
buffer size (bytes): 2, time (sec): 9.63, rate (KB/sec): 54.47
buffer size (bytes): 4, time (sec): 5.37, rate (KB/sec): 97.67
buffer size (bytes): 8, time (sec): 3.25, rate (KB/sec): 161.37
buffer size (bytes): 16, time (sec): 2.17, rate (KB/sec): 241.85
buffer size (bytes): 32, time (sec): 1.77, rate (KB/sec): 296.77
buffer size (bytes): 64, time (sec): 1.74, rate (KB/sec): 300.60
buffer size (bytes): 128, time (sec): 1.77, rate (KB/sec): 296.88
Here is performance for a 16 GB SanDisk Ultra microSD.
Quote
buffer size (bytes): 1, time (sec): 18.28, rate (KB/sec): 28.68
buffer size (bytes): 2, time (sec): 9.76, rate (KB/sec): 53.73
buffer size (bytes): 4, time (sec): 5.88, rate (KB/sec): 89.11
buffer size (bytes): 8, time (sec): 3.92, rate (KB/sec): 133.82
buffer size (bytes): 16, time (sec): 2.87, rate (KB/sec): 182.67
buffer size (bytes): 32, time (sec): 2.63, rate (KB/sec): 199.08
buffer size (bytes): 64, time (sec): 2.60, rate (KB/sec): 201.88
buffer size (bytes): 128, time (sec): 2.60, rate (KB/sec): 201.62
So, the SD card is only important for larger binary writes.  There will be little difference for reads.

bbqq

Thanks for the info. I have not used SD card with Arduino before. I plan to follow the instructions posted in the following links:

https://www.arduino.cc/en/Tutorial/ReadWrite
http://www.arduino.cc/en/Reference/SD

What do I need to change to enable multi-byte binary writes? The instructions do not mention multi-byte.


If I want to use a card with more than 32GB, I have to use sdFat-beta by Bill Greiman. Am I right?
https://github.com/greiman?tab=repositories


Go Up