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.
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
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
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!
OK, now insert the SD card into the Arduino and upload the sketch
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!