Using the SD Card

The other half of the data logger shield is the SD card. The SD card is how we store long term data. While the Arduino chip has a permanent EEPROM storage, its only a couple hundred bytes - tiny compared to a 2 gig SD card. SD cards are so cheap and easy to get, its an obvious choice for long term storage so we use them for the shield.

The shield kit doesn't come with an SD card but we carry one in the shop that is guaranteed to work. Pretty much any SD card should work but be aware that some cheap cards are 'fakes' and can cause headaches.

4GB Blank SD/MicroSD Memory Card

PRODUCT ID: 102
Add mega-storage in a jiffy using this 4 GB micro-SD card. It comes with a SD adapter so you can use it with any of our shields or adapters! Preformatted to FAT so it works out of the box...
$7.95
IN STOCK
You'll also need a way to read and write from the SD card. Sometimes you can use your camera and MP3 player - when its plugged in you will be able to see it as a disk. Or you may need an SD card reader. The shield doesnt have the ability to display the SD card as a 'hard disk' like some MP3 players or games, the Arduino does not have the hardware for that, so you will need an external reader!

USB MicroSD Card Reader/Writer - microSD / microSDHC / microSDXC

PRODUCT ID: 939
This is the cutest little microSD card reader/writer - but don't be fooled by its adorableness! It's wicked fast and supports up to 64 GB SDXC cards! Simply slide the card into the edge...
$5.95
IN STOCK

Formatting under Windows/Mac

If you bought an SD card, chances are it's already pre-formatted with a FAT filesystem. However you may have problems with how the factory formats the card, or if it's an old card it needs to be reformatted. The Arduino SD library we use supports both FAT16 and FAT32 filesystems. If you have a very small SD card, say 8-32 Megabytes you might find it is formatted FAT12 which isnt supported. You'll have to reformat these card. Either way, its always good idea to format the card before using, even if its new! Note that formatting will erase the card so save anything you want first

We strongly recommend you use the official SD card formatter utility - written by the SD association it solves many problems that come with bad formatting!

The official SD formatter is available from https://www.sdcard.org/downloads/formatter_4/

Download it and run it on your computer, there's also a manual linked from that page for use

Get Card Info

The Arduino SD Card library has a built in example that will help you test the shield and your connections

If you have an older Datalogging shield without the SPI header connection and you are using a Leonardo, Mega or anything other than an UNO, you'll need to install a special version of the SD library

Open the file CardInfo example sketch in the SD library:

This sketch will not write any data to the card, just tell you if it managed to recognize it, and some information about it. This can be very useful when trying to figure out whether an SD card is supported. Before trying out a new card, please try out this sketch!

Go to the beginning of the sketch and make sure that the chipSelect line is correct, for the datalogger shield we 're using digital pin 10 so change it to 10!

Open up the Serial Monitor and type in a character into the text box (& hit send) when prompted. You'll probably get something like the following:

Its mostly gibberish, but its useful to see the Volume type is FAT16 part as well as the size of the card (about 2 GB which is what it should be) etc.

If you have a bad card, which seems to happen more with ripoff version of good brands, you might see:

The card mostly responded, but the data is all bad. Note that the Product ID is "N/A" and there is no Manufacturer ID or OEM ID. This card returned some SD errors. Its basically a bad scene, I only keep this card around to use as an example of a bad card! If you get something like this (where there is a response but its corrupted) you should toss the card

Finally, try taking out the SD card and running the sketch again, you'll get the following,

It couldn't even initialize the SD card. This can also happen if there's a soldering error or if the card is really damaged

If you're having SD card problems, we suggest using the SD formatter mentioned above first to make sure the card is clean and ready to use!

Last updated on 2016-09-06 at 12.13.53 AM Published on 2013-04-12 at 11.22.30 AM