Go Down

Topic: Best SD-card ? (Read 2160 times) previous topic - next topic

Simpson_Jr

Hi,
After building a few projects I'd like to start working with SD-cards.
2 GB will be huge for now, if a smaller one works better, it could be great as well
whatever its capacity. (I hope it's still available though ;))

I wonder which SD(HC)cards have been most successful in combination with an
arduino so far since I get the impression some can be quite difficult/impossible to work with.
Advice on which card's best for arduino is greatly appreciated.

Besides a weather-station data-logger I'm building a 5x5x5-led cube at the moment.
Being able to read the patterns from SD would be great, but to prevent flickering
I'll probably need to read a block of data as fast as possible.

Reading speed will probably differ depending on card and reading method used. Reading at
at max speed of most card-specs may also never be possible with an arduino. But, how fast (~)
might I be able to read blocks of 512 bytes if I'd find a good card/way of reading it ?

Thanks in advance, best wishes.




cyclegadget


There is on thread a little bit down that gives some good info. http://arduino.cc/forum/index.php/topic,64813.0.html

I would recommend reading most threads by fat16lib, he has made a libraries and examples that really help with SD cards.


Mark
Good links: Eagle tutorial= http://www.youtube.com/playlist?list=PLDE1858BD83D19C70
General Arduion tutorials = http://tronixstuff.wordpress.com
http://www.gammon.com.au/forum/bbshowpost.php?bbtopic_id=123

fat16lib

#2
Jul 04, 2011, 12:21 am Last Edit: Jul 04, 2011, 12:37 am by fat16lib Reason: 1
Most SD/SDHC cards should work for your applications.

Modern SD/SDHC cards are not designed for The Arduino environment so you never get close to a card's specs.

Most cards perform o.k. for read.

The Arduino accesses cards using the SPI bus at a maximum speed of 8 MHz with no DMA so you will never get a transfer rate faster than about 500 KB/sec, about half the bus speed.  In practice The maximum read rate from a file is about 300 KB/sec.

You can benchmark cards for read/write by using the bench.pde sketch in the examples folder of my SdFat library http://code.google.com/p/sdfatlib/downloads/list.

PCs, Macs, and most other devices access SD cards using the SD bus at a clock rate of up to 50 MHz and the bus is 4-bits wide so 25 MB/sec is possible.

Newer cards use the UHS-I bus which is capable of 104 MB/sec.

The biggest problem for writing is erasing the cards flash memory.  The Arduino can't optimize writing so it causes lots of rewrite to file structures.  This means the card must do lots of flash erase operations.  This shows up as occasional 100-200 millisecond write latency.  This can result in lost data for fast data logging applications.

For your weather-station this should not be a problem.

I like SanDisk cards but Transcend should also work for you use.  Amazon sells 4GB Transcend cards for $6.99
http://www.amazon.com/Transcend-Class-Flash-Memory-TS4GSDHC6/dp/B000JMJWV2/ref=sr_1_3?s=electronics&ie=UTF8&qid=1309729211&sr=1-3

4GB SanDisk cards are $7.50 at Amazon
http://www.amazon.com/Sandisk-Ultra-Memory-SDSDH-4096-Reader/dp/B000PO3CTM/ref=sr_1_4?s=electronics&ie=UTF8&qid=1309730881&sr=1-4

These cards will have the occasional 100 or more millisecond write latency while they do a big flash erase.

You will pay a lot more if you need very short write latency for fast data logging.

I have ordered a Panasonic 4GB SDHC-UHS-I Memory Card for $24.99.  It is the newest thing and I can't wait to see how it performs.
http://www.jr.com/panasonic/pe/PAN_RPSDU04GU1K/

Simpson_Jr

#3
Jul 05, 2011, 01:54 am Last Edit: Jul 05, 2011, 11:19 am by Simpson_Jr Reason: 1
Thank you both !

I guess I'll buy an 4 GB card, it's hard finding one in the neighbourhood
2GB (or less) which also is fast. The faster ones don't seem to cost very much more.
Reading the specs of UHS-cards they certainly seem nice but... those are still a
little out of reach in terms of budget. I'd probably need USB3.0 + reader to really test 'm
at full capacity on my PC ;)

Getting data on/from the card will be most important for now, if you'd
like me to test a specific card (assuming I succeed and the card's not too expensive), please tell me.
Just tested the brand-less 1GB SD of my camera using h2testw. It could
do with an upgrade should I not get the new card working with arduino.

cyclegadget


  I didn't have a microSD card reader until recently so, I used my Cell phone to connect my card to the computer. I was able to format the card using windows then take the card out of the phone and write to it with the Arduino.


Mark
Good links: Eagle tutorial= http://www.youtube.com/playlist?list=PLDE1858BD83D19C70
General Arduion tutorials = http://tronixstuff.wordpress.com
http://www.gammon.com.au/forum/bbshowpost.php?bbtopic_id=123

Simpson_Jr

Just got a set of 74HC125s + SD adapter.

Last year I almost got bald tearing my hairs out when trying to talk to an SD-card,
also didn't have my arduino long yet. Now... the first sketch loaded, Bench, worked immediately !
I did get 67.73 KB/s write and 297.97KB/s read speed using a brand-less 1 GB.

I didn't expect such a "low" writing speed, but I probably have to fake a lot of weather station data
to loose data ;-)
Reading speed is what I was most interested in, it's more then fast enough.

I would... like to connect my cube to the SPI-port as well, and do wonder whether the initialisation-time of the SD-card might cause problems. Using software SPI I'm able to get a frame rate up to 360fps though, so... it hardly matters and I know what I'll be "playing" with this summer ;-).

Thank you both for your help and Fat16lib, thank you for writing a great library, I have no doubts I'll learn a lot by dissecting it!



fat16lib

The SPI port may cause problems for your cube.  SdFat can do bit-bang on other pins and can read at up to 80 KB/sec in bit-bang mode.

Your write speed is not the worst I have seen.

In the bench test, this card has the worst write speed I have seen but has good read speed.

Dane-Elec 2GB
Write 38.68 KB/sec, Read 324.65 KB/sec

This card has the best write speed but you can't buy it.

Corsair 60X 512 MB (no longer available)
Write 301.84 KB/sec, Read 327.48 KB/sec

This is typical an old SanDisk card.

SanDisk "blue" 1GB (old card)
Write 183.39 KB/sec, Read 293.94 KB/sec

This is a high priced 30MB/sec class 10 SanDisk Extreme card

SanDisk 4GB Extreme 30MB/sec
Write 158.74 KB/sec, Read 268.53 KB/sec

The SanDisk Extreme doesn't perform very well in the bench test but it is the best card for fast data logging where you need low write latency.

The above tests are for file I/O.  For file I/O SdFat uses the SD write single block command, CMD24.  New cards are not optimized for this command.

The write multiple block command, CMD25, is used by PCs, Macs, and most consumer devices.  It is much faster for large writes but I can't use it for file I/O because the Arduino doesn't have enough RAM for buffers.

In my binaryLogger.pde example sketch I use CMD25 and just stream data to a large pre-allocated contiguous file.

I can log 40,000 16-bit ADC samples per second to the SanDisk Extreme card without dropping samples.


mmcp42

does it help if the card has been "low-level" formatted, for example on a PC before you try and write to it?
there are only 10 types of people
them that understands binary
and them that doesn't

fat16lib

Low level formatting on a PC tends to cut SD card performance.  PC and Mac format utilities don't understand the structure of the flash chips in SD cards.

There is a standard for formatting SD cards and a program exists for the PC but not Mac to correctly format SD cards.

http://www.sdcard.org/consumers/formatter_3/

The new version of SdFat has a formatting  sketch, SdFormatter.pde, in the examples folder that complies with the standard and formats SD cards for optimal performance on the Arduino.

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

Note: The Arduino SD.h library is a wrapper for an older version of SdFat.

mmcp42

ah
glad I asked!
thanks
there are only 10 types of people
them that understands binary
and them that doesn't

Go Up