Creative Commons images are CC BY-NC-SA 3.0

14.95

added to your
shopping cart

quantity
In stock 88 in stock
14.95 1+ units
13.46 10+ units
11.96 100+ units

Update: After taking a figurative lashing from the comments section we're begging for mercy by updating the microSD Shield board. All new microSD shields have a voltage converter chip on-board that converts the Arduino 5V signals to 3.3V signals in accordance with SD specifications. No more 'blown up' SD cards!

Description: Running out of memory space in your Arduino project? The microSD Shield equips your Arduino with mass-storage capability, so you can use it for data-logging or other related projects. A microSD quickstart guide is available!

Communication with microSD cards is achieved over an SPI interface. The SCK, DI, and DO pins of the microSD socket are broken out to the ATmega168/328's standard SPI pins (digital 11-13), while the CS pin is broken out to Arduino's D8 pin. If you decide to use one of the many open source FAT libraries (like FAT16 or SDFat) make sure to change the code to reflect the location of the CS pin.

Most libraries assume the CS pin is connected to D10; this will have to be changed to D8. Also for the libraries to work pin D8 will have to be set as an output in the 'setup()' section of your sketch. The shield also includes a large prototyping area with a 13x12 grid of 0.1" pitch PTHs.

This shield comes populated with a microSD socket, red power indicator LED, and a reset button; but it does not come with headers installed. We recommend the 6 and 8-pin stackable headers.

Documents:

Comments 116 comments

  • Hi,

    How do I make this work with Arduino Due ?

    Thank you.

    • This shield will work with the Arduino Due as long as you use the software SD library (https://github.com/adafruit/SD). It behaves the same as the normal SD library, except you can manually specify the miso, mosi, and sck pins, and it will simulate SPI communications on it. With that, you can just use the shield as-is.

      • Hi. How much is the wiring diagram for connecting a arduino due? Of all these pins whats’s the minimum necessary to get reading and writing on an SD card with a arduino due?

  • A couple tips to save you some headache:

    1) For the latest Arduino (1.0.5) update the example sketch to include SD.h rather than SdFat.h and SFatUtil.h.

    2) The SS pin for an Uno is defined on line 278 of Sd2PinMap.h in $(ARDUINO)/libraries/SD/utility/ where $(ARDUINO) is your Arduino installation directory. Be sure to set it to 8.

    With those updates the example sketch works great.

    • Ok for using SD.H rather SdFat.h and SFatUtil.h

      but there is no Sd2PinMap.h file in my MacBookAir where Arduino 1.0.5 is installed

      Why ?? Thanks

  • i saw the schematic , what is the hex converter? is it a chip ?

  • Will there be an update for this sheild for the Leonardo?

    • You can solve the compatibility issues from software side. Follow this: http://arduino.cc/forum/index.php/topic,113058.msg887287.html#msg887287 It worked for me!

  • You can get this shield to work with the Arduino Mega. For those who have tried and failed, here is how. You do not need to change anything software-wise.
    The SPI pins for Arduino Mega are located elsewhere (pin 50-53 instead of 10-13). Simply bend out pins 10, 11, 12 and 13 on the shield so that they do not go into the Mega. Stick the shield in. Put a jumper wire in the headers of pin 10-13 and route them as follows:
    Shield pin 10 –> Mega pin 53
    Shield pin 11 –> Mega pin 51
    Shield pin 12 –> Mega pin 50
    Shield pin 13 –> Mega pin 52
    This applies to all SPI shields.
    Thanks to: http://mcukits.com/2009/04/06/arduino-ethernet-shield-mega-hack/

  • Jonnyboy323: Well not knowing what I was getting myself into I bought this shield. Now waiting to receive it I started reading the comments realizing that it was a poor choice. So whats the deal with this thing? is it junk and should I have it sent back and get something like, http://www.sparkfun.com/commerce/product_info.php?products_id=9530
    or does the diode method work? Does anyone have this shield working and if so whats your setup?
    Jon

    Well i did get the shield working perfectly fine. But I had to basically not install the header for pins 8, 11, 12, 13. Then just used the diode diagram here, http://www.sparkfun.com/commerce/tutorial_info.php?tutorials_id=65 and asembled it on the small prototyping area. The code works and I’m using a kingston 2gb memory card.
    Jon

  • The sample code for this shield has a few problems:
    1) fat16.cpp has a comment in FAT::Write that said it will always write to EOF. It will not because the second argument to fat_seek_file was 0 and not a pointer to an offset as it needs to be.
    2) fat16_example.pde says read(buffer) will read sizeof buffer. The actual read routine will read 512 bytes regardless of the size of the buffer.
    3) When the test file gets >512 bytes the example will fail.
    4) fat16.cpp should be rewritten to: a) return more error indications b) take size args, rather than assume strings c) have seek function.
    I’ve fixed the items above. Let me know if you want it posted somewhere.
    I’m successfully using this code with a shield that takes regular SD cards instead of microSD cards. The SD shield can get its power from the 3.3v supply on the Duemilenove board. This code works much better than the filelogger/nanofat code that came with the SD shield. The nanofat code takes 300 milliseconds on every write call. This code takes less than 2 milliseconds.
    The only advantage to the nanofat code is that it is 9000 bytes smaller than this code.

    • Hi Daled,
      Thanks for the critiques, we’ll try and implement some of them when we can. In the meantime we’d love to post your code. Feel free to send us a link that we can add to the product description, or you can send us the source and we’ll host it and provide a download link.

  • Trouble Adding SD Card

    I am using an MicroSD Shield with a GPS and a LCD display on a Arduino Uno. I have a GPS data logger i am working on. I added to Sparkfun MicrosSD shield recently. I have a LCD using I2C on analog pins 4 and 5. The GPS uses UART communications via pins Rx and Tx (0 and 1 digital pins). Without the SD card software, the sketch ran fine, with the addition of the SD software, it constantly reboots. I believe i may have a conflict with the various I/O methods. Can anyone help me out?

    #include <TinyGPS++.h>
    #include <SoftwareSerial.h>
    #include <Wire.h> 
    #include <LiquidCrystal_I2C.h>
    #include <stdio.h>
    
     //Add the SdFat Libraries
     #include <SD.h>
    
    // ==================================
    #define I2C_Address 0x27
    #define I2C_NumChar 20
    #define I2C_NumLines 4
    #define LED 9
    #define BUTTON 7
    #define SDCARD 10
    #define PRINT_DATA 0
    #define DONT_PRINT_DATA 1
    
    static const int RXPin = 0, TXPin = 1;
    static const uint32_t GPSBaud = 9600;
    
    // 4 line, 20 character/line LCD Display
    LiquidCrystal_I2C lcd(I2C_Address,I2C_NumChar,I2C_NumLines); 
    // The TinyGPS++ object
    TinyGPSPlus gps;
    // The serial connection to the GPS device
    SoftwareSerial ss(RXPin, TXPin);
    
    // MicroSD Card
    //Create the variables to be used by SdFat Library
    char fileName[] = "GPS_Teat_01.txt";//Create an array that contains the name of our file.   
    
    // Chip Select pin is tied to pin 8 on the SparkFun SD Card Shield
    const int chipSelect = 8;  
    
    // Global variables
    bool haveData=true;
    bool firstPass = true;
    float homeLat, homeLong, currentLat, currentLong;
    unsigned long last = 0UL;
    char Latitude[20],Longitude[20],CurrentTime[20],Status[22],CurrentShortTime[20],LatShort[20],LongShort[20];
    int lastDistance=0;
    unsigned long dist;  
    static int lastChecksum=0,currentChecksum=0;
    
    void setup()
    {
      Serial.begin(9600);
      ss.begin(GPSBaud);
    
      Serial.println(F("GPS Example.ino"));
    
      pinMode(LED,OUTPUT);
      pinMode(BUTTON,INPUT);
    
      lcd.init(); 
      lcd.backlight();
    
      // initialize the SD Card
      Serial.println("Initializing SD card...");
      // make sure that the default chip select pin is set to
      // output, even if you don't use it:
      pinMode(chipSelect, OUTPUT);
    
      // see if the card is present and can be initialized:
      if (!SD.begin(chipSelect)) {
        Serial.println("Card failed, or not present");
        // don't do anything more:
        return;
      }
      Serial.println("card initialized.");
    }
    
    void LCD_Print()
    {
      Serial.println("Call to LCD_Print");  
    
      if(haveData)
        {
        lcd.setCursor(0, 0);
        lcd.print(Latitude);
        lcd.setCursor(0, 1);
        lcd.print(Longitude);
        lcd.setCursor(0, 2);
        lcd.print(CurrentTime);
        lcd.setCursor(0, 3);
        lcd.print(Status);
        }
      smartDelay(0);
    }
    
    static void printDateTime(TinyGPSDate &d, TinyGPSTime &t)
    {
      int hours;
    
      if (!t.isValid())
       {
    //    Serial.println(F("Time is invalid"));
        sprintf(CurrentTime,"Time: %02d:%02d:%02d  ",0,0,0);
    
       }
      else
       {
        // -4 hours to get to EST
        hours = t.hour() - 4;
        if(hours < 0)
           hours += 24;
        sprintf(CurrentTime, "Time: %02d:%02d:%02d  ", hours, t.minute(), t.second());
        sprintf(CurrentShortTime, "%02d:%02d:%02d  ", hours, t.minute(), t.second());
    
    //    Serial.println(CurrentTime);
       }
      smartDelay(0);
    }
    
    void SPrintLatitude()
    {
      currentLat = gps.location.lat();
      // Location parameters have 5 decimal places
      int dec = (float)(currentLat - (int)currentLat)*100000;
      int num = currentLat;
    
      sprintf(LatShort,"%4d.%5d",num,dec);
      sprintf(Latitude,"Lat: %s St%02d",LatShort,gps.GetSatellites());
      smartDelay(0);
    }
    
    void SPrintLongitude()
    {
      currentLong = gps.location.lng();
      // Location parameters have 5 decimal places
      int dec = abs((float)(currentLong - (int)currentLong)*100000);
      int num = currentLong;
    
      sprintf(LongShort,"%4d.%05d",num,dec);
      sprintf(Longitude,"Long: %s",LongShort);
      smartDelay(0);
    }
    
    // This custom version of delay() ensures that the gps object
    // is being "fed".
    static void smartDelay(unsigned long ms)
    {
      bool homeSet=false;
    
      unsigned long start = millis();
      do 
      {
        while (ss.available())
          gps.encode(ss.read());
       if(digitalRead(BUTTON) == HIGH && !homeSet)
          {
          digitalWrite(LED,HIGH);
          homeLat = currentLat;
          homeLong = currentLong;
          Serial.println("Home Position set");
          homeSet = true;
          }
      } while (millis() - start < ms);
     digitalWrite(LED,LOW);
    }
    
    static void printStr(const char *str, int len)
    {
      int slen = strlen(str);
      for (int i=0; i<len; ++i)
        Serial.print(i<slen ? str[i] : ' ');
      smartDelay(0);
    }
    
    void SaveData(int option)
    {
      char outData[60];
    
      Serial.println("Call to SaveData");  
    
      lastChecksum = currentChecksum;
      currentChecksum = gps.failedChecksum();
    
      sprintf(outData,"%s,%s,%s,%05d,%05d,%05d,%05d\n",
         CurrentShortTime,LatShort,LongShort,dist,abs(gps.GetSatellites()),currentChecksum-lastChecksum);
    
       Serial.println("In SaveData Routine");
    
    // open the file. note that only one file can be open at a time,
      // so you have to close this one before opening another.
      File dataFile = SD.open(fileName, FILE_WRITE);
    
      // if the file is available, write to it:
      if (dataFile) {
        dataFile.println(outData);
        dataFile.close();
       }  
      // if the file isn't open, pop up an error:
      else {
        Serial.println("error opening data file");
      } 
    
      if(option == PRINT_DATA)
         Serial.println(outData);
    
      Serial.println("Finished SaveData Routine");
    }
    
    void loop()
    {
       bool haveLocation=true;
       char text[80];
    
       Serial.println("In Loop");
    
       SPrintLatitude();
       SPrintLongitude();
       printDateTime(gps.date, gps.time);
    
       if(firstPass && gps.location.isValid())
         {
         firstPass = false;
         homeLat = currentLat;
         homeLong = currentLong;
         Serial.println("Home Position set");
         }
       else
         {
         dist = gps.distanceBetween(homeLat,homeLong,currentLat,currentLong);
         if(dist < 0)
        dist = 0;
         if(dist > 99999)
        dist = lastDistance;
         sprintf(Status,"Distance %5d yards",(int)((float)dist*1.0936));
         lastDistance = dist;
         }
      LCD_Print();
    
      SaveData(PRINT_DATA);
    
      smartDelay(1000);
     }    
    
  • You can just use the SD card examples in the 1.0.5 version of the Arduino IDE. Change the chipSelect pin from 10 to 8 for the Sparkfun shield and you’re good to go. No need to use the outdated FAT library

  • The photo of the microSD card shows a 16 pin level shifter (74HC40500 from a purchased one). The schematic (microSD_Shield_v13) has a 14 pin level shifter.
    Do you have an updated schematic for microSD card that uses the 16 pin level shifter board? -Clark Dailey

    • Sorry for the confusion- the schematic is actually showing the current shield with the 16 pin shifter. The two pins that are not shown on the schematic (pins 13, and 16) are designed to not be connected, so all the connections on the schematic are the same connections made on the board. We’ll get the schematic updated to clear this up.

  • This shield works fine with Arduino Uno..Do not use a micro sd card ,which is rated above class 4.I used a kingston class 4 micro sd card(worked perfectly) .Remember to change the CS pin to 8(both in sketch and header files).While installing the shield on the arduino board ,push the shield all the way down to ensure proper connection b/w the arduino and shield.This shield communicates to the mcu via SPI protocol(pin number-11,12,13,10.Although the default CS/SS pin is 10,this shield uses pin number 8.pin number 10 must be defined as a o/p in the setup. P.s I am currently working on a project with involves xbee and data logging(using sd card shield).I have hooked up couple of sensors around my apartment and I am collecting the data through a xbee mesh network..Please hit me back ,if u have a great idea (especially related to xbee).

  • I have ordered a micro SD shield,will receive it in a day or two Will the SD card work by making following changes?? .changing chip select pin from 4 to 8. < 2>.pinMode(10,OUTPUT)… Is it necessary to make changes in Sd2PinMap.h file?(changing SS_PIN = 10 to SS_PIN=8)?

  • (First post)I spent a day trying to get this card to work. First problem, I hadn’t pressed the shield down far enough to connect all of the pins. I figured that out after I had given up on the Sparkfun linked libraries and examples. Arduino has an SD library and example code that just gives you your SD card info. I used that example to get my shield and card working.

    With the Arduino SD library, be sure to make the following two changes: —- const int chipSelect = 8; —- pinMode(10, OUTPUT);

    After that, everything should work fine. Also, I’m using a 16GB microSD HC Kingston card.

  • After some fiddling it’s perfectly for me. The only problem I was having: when the shield was pushed down the whole way the height of the usb connector on the uno caused it to cock at an angle. This was causing it to lose connection on a couple pins.

    Easy solution was just to not push it down the whole way. However some cutouts on the board would be appreciated. If your having problems with the SD working intermittently try shifting the shield around / bending the pins a little.

  • Suggestion: A microSD breakout (and other breakouts) that can connect to SPI via the ICSP header. This would allow use over several Arduinos including the Fio. :)

  • It’s really frustrating that I’ve bought this shield and I can’t get it to work reliably.

    There are many different sets of directions between these comments, the downloaded examples in the library, the product “quickstart” and the product forum. I feel like I’m doing a massive research project.

    As it stands the quickstart doesn’t work. I downloaded the two libraries Fat16 and SdFat, downloaded the example, and it wouldn’t compile. Plus, the quickstart code is very hard to follow. The disconnected code snippits are very hard to understand out of context, especially when they wouldn’t even work if they were in context.

    Then I downloaded the SdFat library from code.google.com/p/StFatLib This seemed to work much better (after I figured out that I needed to extract the SdFat folder from the download to the library, not the whole download)… but then I still get an error when running one of the examples: SD errorCode 0X4

    I have no idea where to go to find out what’s causing the error.

    I’ve had very good experience with SparkFun’s customer service, but what happened here? Why is this product so complicated? I wouldn’t mind reading 20 pages of literature to understand this product, if it got everything working… but following link to links to links is very frustrating, especially when it doesn’t even work out.

  • I need to download and upload files on the sd card while its inserted in the shield. Is it possible to solder on a usb cable direct to the shield so its pops up in windows like a regular sd card?

    Martin

  • This little board just works once you solder it properly. I am gathering GPS and other data readings just fine. thanks for adding the voltage level compensation. My Uno and I thank you.

  • Hi, I am trying to make a data logger using this and the bmp085 pressure sensor. When I output the variables on a serial port it comes up with the correct data but when I write it to a sd card, it always prints: Temperature = 12.80 *C Pressure = 99977 Pa Altitude = 70.78 meters

    every single minute it will print this even though on a serial port it will work. Can someone help me please?
    btw this is my code:

    /* BMP085 Extended Example Code by: Jim Lindblom SparkFun Electronics date: 1/18/11 license: CC BY-SA v3.0 - http://creativecommons.org/licenses/by-sa/3.0/

    Get pressure and temperature from the BMP085 and calculate altitude. Serial.print it out at 9600 baud to serial monitor.

    Update (7/19/11): I’ve heard folks may be encountering issues with this code, who’re running an Arduino at 8MHz. If you’re using an Arduino Pro 3.3V/8MHz, or the like, you may need to increase some of the delays in the bmp085ReadUP and bmp085ReadUT functions. */

    include

    include

    include

    include

    Sd2Card card; SdVolume volume; SdFile root; SdFile file;

    define BMP085_ADDRESS 0x77 // I2C address of BMP085

    const float p0 = 101325; // Pressure at sea level (Pa) float altitude; const unsigned char OSS = 0; // Oversampling Setting char name[] = “data.txt”; //Create an array that contains the name of our file. char contents[256]; //This will be a data buffer for writing contents to the file. char in_char=0; int index=0; //Index will keep track of our position within the contents buffer. // Calibration values int ac1; int ac2; int ac3; unsigned int ac4; unsigned int ac5; unsigned int ac6; int b1; int b2; int mb; int mc; int md; int time=0; int oldtime = 0;

    // b5 is calculated in bmp085GetTemperature(…), this variable is also used in bmp085GetPressure(…) // so …Temperature(…) must be called before …Pressure(…). long b5;

    short temperature; long pressure;

    void setup() { Serial.begin(9600); Wire.begin(); bmp085Calibration(); pinMode(10, OUTPUT); card.init(); //Initialize the SD card and configure the //I/O pins. volume.init(card); //Initialize a volume on the SD card. root.openRoot(volume); //Open the root directory in the volume. file.open(root, name, O_CREAT | O_APPEND | O_WRITE); file.println(); file.println(); file.println(“———-NEW SESSION———-”); file.println(); file.println(); file.close(); }

    void loop() { temperature = bmp085GetTemperature(bmp085ReadUT()); pressure = bmp085GetPressure(bmp085ReadUP());

    Serial.print(temperature, DEC); file.open(root, name, O_CREAT | O_APPEND | O_WRITE); //Open or create the file ‘name’ in ‘root’ for writing to the end of the file. file.print(“Time:”); file.print(time); file.print(“ mins”); file.println(); file.print(“Temperature = ”); file.print(temperature, DEC); file.println(“ *C”);

    file.print("Pressure = ");
    file.print(pressure, DEC);
    file.println(" Pa");
    

    altitude = (float)44330 * (1 - pow(((float) pressure/p0), 0.190295)); // Calculate altitude assuming ‘standard’ barometric // pressure of 1013.25 millibar = 101325 Pascal file.print(“Altitude = ”); file.print(altitude, 2); file.println(“ meters”);

    file.println();
    
    
    file.close();            //Close the file.
    

    int oldtime = ++time; delay(60000);

    }

    // Stores all of the bmp085’s calibration values into global variables // Calibration values are required to calculate temp and pressure // This function should be called at the beginning of the program void bmp085Calibration() { ac1 = bmp085ReadInt(0xAA); ac2 = bmp085ReadInt(0xAC); ac3 = bmp085ReadInt(0xAE); ac4 = bmp085ReadInt(0xB0); ac5 = bmp085ReadInt(0xB2); ac6 = bmp085ReadInt(0xB4); b1 = bmp085ReadInt(0xB6); b2 = bmp085ReadInt(0xB8); mb = bmp085ReadInt(0xBA); mc = bmp085ReadInt(0xBC); md = bmp085ReadInt(0xBE); }

    // Calculate temperature given ut. // Value returned will be in units of 0.1 deg C short bmp085GetTemperature(unsigned int ut) { long x1, x2;

    x1 = (((long)ut - (long)ac6)*(long)ac5) >> 15; x2 = ((long)mc >4);
    }

    // Calculate pressure given up // calibration values must be known // b5 is also required so bmp085GetTemperature(…) must be called first. // Value returned will be pressure in units of Pa. long bmp085GetPressure(unsigned long up) { long x1, x2, x3, b3, b6, p; unsigned long b4, b7;

    b6 = b5 - 4000; // Calculate B3 x1 = (b2 * (b6 * b6)>>12)>>11; x2 = (ac2 * b6)>>11; x3 = x1 + x2; b3 = (((((long)ac1)*4 + x3)2;

    // Calculate B4 x1 = (ac3 * b6)>>13; x2 = (b1 * ((b6 * b6)>>12))>>16; x3 = ((x1 + x2) + 2)>>2; b4 = (ac4 * (unsigned long)(x3 + 32768))>>15;

    b7 = ((unsigned long)(up - b3) * (50000>>OSS)); if (b7 < 0x80000000) p = (b78); x1 = (x1 * 3038)>>16; x2 = (-7357 * p)>>16; p += (x1 + x2 + 3791)>>4;

    return p; }

    // Read 1 byte from the BMP085 at ‘address’ char bmp085Read(unsigned char address) { unsigned char data;

    Wire.beginTransmission(BMP085_ADDRESS); Wire.write(address); Wire.endTransmission();

    Wire.requestFrom(BMP085_ADDRESS, 1); while(!Wire.available()) ;

    return Wire.read(); }

    // Read 2 bytes from the BMP085 // First byte will be from ‘address’ // Second byte will be from ‘address’+1 int bmp085ReadInt(unsigned char address) { unsigned char msb, lsb;

    Wire.beginTransmission(BMP085_ADDRESS); Wire.write(address); Wire.endTransmission();

    Wire.requestFrom(BMP085_ADDRESS, 2); while(Wire.available()

    • 4 spaces in front of code will render in a somewhat more readable fixed-width font, like so:

      print "Hello world\n";
      

      You might also want to use pastebin or a Gist.

  • Does anyone know how quickly information can be written to the microSD. I was hoping to write data points like “51,346,357,897” - these are comma separated values - every 25ms, but that may not be feasible?

    • It depends on the speed of the card and how fast you run the SPI interface. Each number in your card’s “speed class” is 1MB per second. The maximum SPI speed on a 16MHz Arduino is also 1MB per second, but there will be processing overhead that reduces this (wild guess: 10X less, for 100,000 bytes per second).

      Next you can figure out your own data rate: if you’re writing four bytes (for a 3 digit number plus comma) every 25ms, that’s 160 bytes per second. So you should be well within the speed limit of the system.

  • so can any one help me get this to work with my Mega 2560? code or how to integrate them would be great.

  • I am having trouble compiling the example code on the new (improved?!?!) Arduino IDE 1.0. I’m getting the following error: pins_arduino.h:43:22: error: expected unqualified-id before numeric constant

    This appears to be definition of the SPI pins, but I don’t understand what the problem is…

  • Which voltage converter particularly used here? It is important since level translators are speed dependent.

  • I’ve had great luck with this board on several different Arduinos (including the Mega, which is now quite easy with the updated SdFat library (just change one line of code - easy!). A few suggestions:

    1. The SD card is hard to get to when in an enclosure - if it was all the way up to the edge of the USB plug, it could be accessed much more easily.

    2. As I’ve found with a few other SparkFun boards, the solder pads are a bit weird and hard to get a good soldering connection.

  • Works great using standard SD library.

  • I’ve got this board recently and it work well logging data. One problem: it consumes a lot of power. Wat is the proper way to shut down SPI bus so it will consume now energy till the next time it is fired up?

  • What, no part number for the hex converter?? It’s not even in SFE’s library, other than just the footprint.

  • Isn’t there a typo in the descr? It says D10 needs to be set as an output right after it says CS is D8 on this board. It should read D8 needs to be set as an output, no?

    • ahh, I just answered my own question. I did not realize that if you don’t set it to output it can cause the SPI to go into slave mode.

      • So, I changed to chipSelect = 8 and set Pin 8 to OUTPUT (from looking at the schematic). Do I need leave pin 10 as an output also, just to keep the software happy?

        I commented out the Pin 10 assignment to Output, and so far the example program works. Are you implying that this will cause a problem at some point?

  • This shield would be awesome if the work space was one or two holes longer to allow for building an Arduino right onto it. I could have used exactly that for a data logger I built. Instead I went to a microSD breakout with a 3.3v level shifter and built the Arduino on a DIP PCB from Radio Shack. Wish I could have done both on one board!

  • Hi everyone,
    I have an arduino Mega 2560 and I need to connect both the SD card and a GSM shield. The problem is that Sparkfun SD shield uses pins 8,11,12 and 13. GSM shield needs 4,5,8 and 9. How can I do for pin 8? Is it possible to modify the library and move to another pin?
    Thank you!
    Gegio

    • Yes, you can modify the library to move CS to another pin (look at the .h and .c files in the library, it should be commented where it’s defined), but you’ll have to modify the hardware to move the pin as well. One way to do this is to cut traces and add wires to the board itself. It’s also possible to take a few stackable headers and make an adapter to go between the boards to rearrange the pins. Good luck!

  • UPDATE: So I initially had issues getting the MicroCenter MicroSD cards to work…but it turns out the MicroCenter MicroSD cards work fine with the Arduino libaraies; my Ethernet PRO Arduino had issues. These are a GREAT value!

    I picked one of these up at Micro Center this weekend! (Very nice partnership by the way!) Micro Center 2GB Micro SD Media Card )
    Oh and I had to use an extra set of stackable headers for this to clear the magjack on my EthernetPro…Kinda sucky but Im pretty much over it already.

    I have had no issues with the MicroSD shield! Works great!

    • Oh I too love that Microcenter has all this stuff… I am a software dev and work like 1 mile away. I am going to pick up one of these after work tonight. I am writing a web server with the Ethernet shield (official one), but figured out that you cant access both the SD and the ethernet at the same time. Thats a deal breaker as I need to stream the file off the sd card to the ethernet reply stream. This shield will save the day I think. I might pick up a Microcenter 2gb card just to validate your statement… sounds odd. If I find different results I will reply.

      • Yeah…It might not be the microcenter SD after all. I am at my parents and tested a couple of cards which wouldnt work on my EthernetPro and work fine with my Dad’s UNO. So I have no idea what is going on.

  • Hi,
    how does this shield perform with SDHC cards?
    - gaute

  • Can multiple instances of SDFile be created and used simultaneously? For example, if i wanted to parse some atmospheric data into one file and gps data into another, could I use
    SDFile data;
    SDFile location;
    char readings[] = “readings.txt”;
    char nmea[] = “nmea.txt”;
    and then subsequently
    data.open(root, readings, blah blah blah);
    location.open(root, nmea, blah blah blah);
    data.println(blah bloo blah);
    location.println(ni!);
    data.close();
    location.close();
    Or would I have to open/close one file, write to it, close it, then open/write/close the next?

  • I have this shield, and the MISO pin does not go trough the HEX converter.
    I need to use 1 arduino mega(5v) as master 1 sd shield(3.3V) and 2 arduino pro(5v) all connected on SPI
    the problem is that when all connected the MISO pin of arduino pro has 5V and the card Miso pin is 3.3V.
    individually both work.
    How can I make these work together?

  • If I were to use this with a breadboard Arduino, how the heck would I do it?

  • Forgive me, but I am new to the Arduino. Is this whole “Sheild” business simply another word for daughter card? In my mind the core Arduino (Mega in my case) is like the motherboard. Any thing else you add is a daughter board (or Shield?) Correct?
    If that is true, then what are the limitations of how many shields you can add? Simply physical limitations? Or if you have the space, or wire you can add more?
    Thanks for your time.

    • Yeah, it’s kinda like a daughterboard or something like that. You are only limited by the amount of pins you have. ie - you can’t use 2 shields that are trying to share the same pins. So in theory if you have 10 pins available, and each shield uses only 1 pin, you can stack up 10 boards.

  • Well here is the problem:
    (the program does compile and upload to the Arduino)
    nothing happens data isn’t even being sent to the Serial Monitor when I look at on the SD no file is created and no data is written to a file.
    here is what I have done:
    I have changed the Library’s Arduinopins header file to have

    define SS_PIN 8

    because the SS pin is on digital pin 8
    I have formatted the SD card to both Fat16 and Fat32 still doesn’t work
    as you can see from the code I use pinMODE(10, OUTPUT); otherwise the program wouldn’t work.
    I made sure the headers I soldered on where not faulty. they are not.
    I am using a Arduino Duemilanove 328
    also, for what ever reason the header files do not turn into the green color they normally do for header files. (don’t know if this is a problem because the code does compile and upload to the arduino it just doesn’t do anything)
    so far I get nothing no file written to the sd card and no data on the serial monitor

  • I just got this shield and the SFE Inventors Kit UNO and the 2 DONT work together. I cant even get the program to compile right.
    I really wish these files were kept up to date. So now i will go digging and see if i can find the information to make this work.

  • I soldered the microSD shield like the one in the photo above, i.e. I did not use the stackable header. I was planning to use the protype area to add a device requiring 5V power and GND. The issue I have is that the microSD shield does not connect the ground to the protype area. I don’t know why this is so. Nevertheless can anyone tell me the best way to pass GND to the prototype area?
    Thanks

  • Can anyone tell me why the ground pins from the Arduino to the microSD are not connected to the prototype area.

  • I also had trouble with poor contact on this shield – the power light would illuminate only in very specific positions of insertion. I added stackable headers from Sparkfun’s kit. I did check for shorts between all pin combinations and found connections only between the three ground pins. Also checked that there was a good connection between the +3.3V header pin and the hole next to it.
    I believe (but time will tell) I have solved the problem by making slight bends in the pins of the headers so they make better contact with the headers on the Uno. Using a small pliers, I bent the pins outward very slightly about 5mm from their tips and then back into position about 2mm from their tips.
    (Or possibly the fact that I had also plugged my soldering iron back in made it feel threatened enough to start working…)

  • If this is a truly new board ie. it works, It needs a new page because going through the comments to see if anyone has had any luck getting it to work is too much.

  • For the next rev. it would be nice if this board allowed a pin other than 8 to be used as CS for the SD card. I like the arrangement on the GPS shield, by default the DLINEs are pins 2 and 3 via solder bridges with thru-holes for hooking RX/TX to alternate pins.
    I’d like to use this board as is with the Color LCD shield but can’t as PIN 8 is LCD RESET on the LCD Shield. I’m planning on cutting the CS trace on this board and soldering a lead to an alternate pin. I believe that all shields that use the SPI should allow an alternate pin with soldering bridges, but that’s just me.
    Also the next rev. should break all of the pins an SD card to thru-holes.
    I wish that someone would come out with a “pin re-mapping” shield. Basically it would be shield have four rows of thru-holes (two rows for input from below with male headers, and two
    rows output to above with female headers). Each of the input and output pins would have soldering jumpers with thru-holes to allow remapping of the pins. It most likely would put a slight offset in the shield stack but would allow any two shields to be used together.

    • I like the ideas presented. Someone cold easily wire any of the Arduino’s outputs to a thu-hole going to pin 3 of the Hex converter for the CSN. If Sparkfun concerned about having a board that works out-of-the-box, then maybe have a surface mount jumper/resistor that can be removed to disconnect it from pin8.
      Another big advantage of having the SD pins broken out to thru-holes is that other 3.3v SPI devices could use the converted SCLK and MOSI pins. It would also be nice to have the unused lines on the hex-converter broken out to thru-holes too. We could use those for other 3.3v devices…. although, someone with a decent soldering iron could probably wire straight the pins.

  • In the schematic, what is the purpose of the hex converter, and is it required to use the micro-SD socket? If it is required, why is it not included on your other uSD breakout boards?

    • The Uno is a 5v part, and microSD cards are 3.3 v. The hex converter handles this for you, to keep the magic smoke in! ;)

  • I need help to connect MP3 Shield with microSD Shield, any example?

  • I am using this shield with a GHI Panda (erased so I can use my own development environment.) I have ported FatFs and an SPI SD driver. The card is working fine with 1G, 2G and even 4G cards, but I haven’t done extensive testing on it yet.
    I have noticed that every time I insert an SD card my controller resets. Does anyone know if the socket is connected to the reset line by chance? I don’t see anything on the schematic that indicates this. Just wondering if there is an easy answer to this before I pull out the scope.

    • It’s definitely not connected to the reset line, but mine does this too. It even does this on a custom pcb I built using the same pins so I’m not really sure what causes it. I’d like to avoid the reset if possible, but at least in my situation it’s not critical… Report back if you find anything useful, would you? Anyone else that can shed some insight on this, I’m curious. I’m using this with an Arduino Mega and software SPI.

  • Using this with the MEGA 2560, without changing the pinout.
    Using SDFATLib20101010
    Line 42 of Sd2Card.h
    Change to: #define MEGA_SOFT_SPI 1
    Line 74 of Sd2Card.h
    Change to: uint8_t const SD_CHIP_SELECT_PIN = 8;
    This will enable software SPI and be somewhat slower, but still plenty fast for most applications.

  • I am having a lot of trouble with the microSD shield. I am still relatively new to physical computing but did most of the inventor’s kit.
    I have an Arduino Uno and microSD shield from SparkFun. I just bought a Kingston 4 GB microSD HC class 4 card. I don’t know if it matters, but I am using a MacBook computer. I formatted the SD card to FAT16 using the instructions here: http://forums.adafruit.com/viewtopic.php?f=31&t=7108#p34846
    After putting on the shield with the stackable header pins and putting in the SD card, I tried the library at
    http://www.sparkfun.com/tutorial/microSD_Shield/SdFat.zip
    and code at
    http://www.sparkfun.com/tutorial/microSD_Shield/SD_SimpleExample.pde
    But this did not write anything to the card.
    I also changed
    pinMode(10, OUTPUT)
    to
    pinMode(8, OUTPUT)
    but this didn’t do anything. I don’t understand why the pinMode of pin 10 should since the shield routes from pin 8. This was unclear in the tutorial.
    Finally, I tried the library at
    http://www.sparkfun.com/Code/FAT16.zip
    And there are examples in there. These did not work either.
    Something that seems strange to me is that in SdFat.zip, ArduinoPins.h is only set for the Mega and not the Uno. Could this be the source of my problems? Any other possibilities?

    • My best guess, not having played with this board, is that it won’t support any SD HC card.
      FAT16 can’t address 4G of space
      try again with a really cheap smaller capacity card if you haven’t already. curious to hear if it works then.

  • Here’s my experience in using this with an Arduino 328 and the sdfat library:
    - Just using sdfat and setting pin 10 to OUTPUT works for 0-5 seconds (can sometimes init, sometimes write, sometimes even get to the first sync)
    - Using sdfat and setting pin 10 to OUTPUT and importing the SPI library: always able to init & write up until the first sync, then the sync fails
    - Using sdfat and manually setting pins 8, 11, 13 to OUTPUT and pin 12 to INPUT works perfectly (in addition to setting pin 10 to OUTPUT like normal)
    It’s my understanding that when you import SPI it’s supposed to setup those pins for you… But it looks like it doesn’t (or maybe it does but then breaks something else) :)

    • Your last bullet just saved me from a huge headache I was having. Thank you so much.

    • Seems OK for me using arduino 0022 and the built in SD library. I just need to change the CS pin from 4 to 8. For example in the ReadWrite example I changed:
      if (!SD.begin(8)) {
      to…
      if (!SD.begin(8)) {
      Nick

  • Somehow my microSD Shield had a connection problem on port D3 and the 3.3V port. <br />
    <br />
    After getting card.init errors I did much research and thought it might be a pin (SS_PIN 8 vs 10) or SD card problem (2GB card). After much digging I fortunately then realized that the power led wasn’t on! Soldering on the 3.3V header pin looked good but no connection and even after re-soldering the connection between the header and the board was still not there. So I had to create an extra bridge between the header pin and the board.<br />
    <br />
    Hope this was due of some user error or was a one time production error.<br />
    <br />
    Just make sure the power led on the board is ON before digging into any other troubleshooting.

  • Somehow my microSD Shield had a connection problem on port D3 and the 3.3V port. <br />
    <br />
    After getting card.init errors I did much research and thought it might be a pin (SS_PIN 8 vs 10) or SD card problem (2GB card). After much digging I fortunately then realized that the power led wasn’t on! Soldering on the 3.3V header pin looked good but no connection and even after re-soldering the connection between the header and the board was still not there. So I had to create an extra bridge between the header pin and the board.<br />
    <br />
    Hope this was due of some user error or was a one time production error.<br />
    <br />
    Just make sure the power led on the board is ON before digging into any other troubleshooting.

  • Can I use this with a WiFly shield or do they use most of the same pins? I need a way to make a small WiFi Web server to host files bigger then what would fit on the Arduino alone…

  • Anybody else notice the photo of this shield mounted on the Arduino?
    What kind of pins did you guys use instead of the stackable headers you recommend?
    I’ve used 16 pin dip wire-wrap sockets and then cut the socket off the top of the board; quick touch-up with the soldering iron and it looks great.
    Nice way to keep the stack thin.

    • In the picture, we are using breakaway headers (PRT-00116), a suitable replacement for the stackable headers if you’re trying to keep your project slimmer.

  • I got the shield last week. FAT16 Library was unzipped to my arduino folder. When I tried FAT16_WriteExample, using Arduino 0018, it gave me error messages it could not find sd-reader_config.h. Would it be possibly related to the hyphen ‘-’ and underscore ‘_’ problem?

  • Hello,
    I got to try this shield with SDFat Lib
    Prior to soldering the shield, I was able to get it to run.
    After soldering to headers, suddenly I just keep on getting the
    type any character to start
    card.init failed
    SD error
    errorCode: 1
    errorData: 3F
    type any character to start
    error when running SDFatInfo.
    Please help.
    I can?t seem to get the board to work.
    Best regards,
    Martin

  • What is the reason for using pin 8 instead of pin 10? Is there some advantage to doing it that way?

    • My best guess is that since 10 is the standard CS/SS pin, this shield is less likely to conflict with others, eg, the Ethernet Shield…which already has microSD, hahaha, bad example.

  • Hi,
    We have buy this shield, it work very well with the Arduino Duemilanove, but it dont work with the Mega !
    Some one have the same problem?

    • I think the Mega uses different pins for SPI. You’ll need to make a different shield for that. There’s a protoshield for the Mega that has plenty of space on it.

  • This board is easy to use and works well. However I feel it should have included the stackable headers. I have written an introductory guide on how to get one of these working at http://wp.me/pQmjR-lB.

  • Well, since I bought a non-working board a few months back; making me fix it is not acceptable.
    How do I return mine for a working unit?

  • Used it in concert with a APRS Radio shield from Argent Data to create a data recorder. This is a Ham Radio specific application.
    The radio shield has a proto area. So I picked up the parts to put the SD shield on the proto area of the radio shield. A project that requires 2 shields and a LCD is pretty tall. Removing almost ½ inch of high makes packaging easier.

  • The documentation has now been updated.

  • I would like the updated schematic as well. I bought the old version of the shield and I would prefer to get the IC that you used and put it in the prototype area rather than buy a new shield.

  • The link to the PDF schematic under “Documents” is still V1.0, should be V2.0 now.

  • i have the old verson of the sd shield and i havent used it yet. what mods would i need to get it working?

  • so why would this awesome shield be listed under the new products heading? has something about it been changed?

    • They’ve redesigned the board. They’ve added a voltage level shifter (the original version interfaced with MicroSD cards at 5V, while the spec says they should be operated at 3.3V - which, I guess, worked in some circumstances but not others), a reset button, and an extra row of I/O pins to be used by the protoboard area. Basically, they listened to all the complaints and suggestions and apparently made the board a lot better.

  • Also, since SS for this device (arduino pin 8) is not the default atmel SS pin (arduino pin 10) be sure to set pin 10 as an output or hold it high. If pin 10 is an input and low the master spi operation of the atmel is stopped and it switches to slave mode. This might be why some people have only been able to get soft spi methods to work.
    -Mike

  • I’m glad you’re updating the voltage conversion.
    I got it working with voltage dividers and the sdfat library, see: http://www.holdentechnology.com/micros2/arduinos/60-sdshield
    -Mike

  • It does appear that the source voltage has been recently changed. I just picked one of these up and the voltage was sourced from the 3.3V pin. This is also referenced in the current schematics.
    I was not able to get it working on an Arduino Duemilanove using the FAT16 library with a Kingston 512MB card. It is working using the SdFat library after changing the Sd2Card.h to #define SOFTWARE_SPI and changing the 3 SOFT_SPI_SS_DDR/PORT/BIN pins from PIN10* to PIN8*.
    Its also worth noting that the minimum sketch to open a file and write a string is 2K smaller with the SdFat lib.

  • I thought this shield would be all I needed to get a microSD datalogger going… alas, I was wrong because of the 3.3V required by the SD card! The level converter IC should be included on the board. Also, I find it strange that the SS line comes off pin 8 instead of pin 10.
    Quick reminder for anyone using the 4050 IC - the MISO pin needs to be hooked up opposite the 3 other SPI pins. I made this stupid mistake and spent hours trying find it.

  • Can anyone point me to specifics of what I need to rewire to make this work? I tried the diode method, and verified that it’s at ~3.3V, but it still isn’t working. I managed to blow one microSD card just trying to get this thing to work… Still have one more that I haven’t ruined, and would prefer to just go with a known-good configuration. Thanks.

  • Really disappointed that this board didn’t include proper level shifter circuitry (e.g. 74HC4050). I had a to hack in a level shifter to the board to get it to work with a Sparkfun purchased 1GB sandisk microSD card. Running a part out of spec is just bad design practice. Sparkfun, I expected better.
    Hacking up the board what the day after you get it working is for. :)
    Also, highly recommend using sdfatlib over the library linked from this page. I found it was much easier to get up and running and has lots of nice pre-written examples to explore:
    http://code.google.com/p/sdfatlib/

  • Well not knowing what I was getting myself into I bought this shield. Now waiting to receive it I started reading the comments realizing that it was a poor choice. So whats the deal with this thing? is it junk and should I have it sent back and get something like, http://www.sparkfun.com/commerce/product_info.php?products_id=9530
    or does the diode method work? Does anyone have this shield working and if so whats your setup?
    Jon

  • According to the picture shown, the microSD card is fed from the 3.3v pin. Perhaps I don’t understand what the problem is?

    • The issue is with the communication between the Arduino (5v logic) and the sd card (3v3 logic). There are a couple of options for level shifting - you can use simple resistor-based voltage dividers for the connections that need to be shifted, or better yet a level shifter IC. I’ve read that the resistor-based approach can cause timing issues for newer SD cards, but I’ve used that method with no problems so far. Maybe I’m just lucky.
      You can find a schematic for a resistor-based level shifting SD card interface here: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1206874649/0
      There’s also excellent info on Arduino->SD card communication in the SdFat lib documentation: http://code.google.com/p/sdfatlib/
      If this shield had an integrated level shifter, I’d buy a few of ‘em.

  • I’m wondering if the SFE logic converter would solve the 5V 3.3V issue. They’re small and would be easy enough to place on the proto-board.

  • Is there a download link for the corrected FAT16.CPP and sample code for the DEV-09520 yet? Thanks.

  • Tried this with my sandisk 1gb micro sd card. Got really hot in seconds and now is dead?
    RIP poor memory card :(
    5 v too much??
    maybe only works with arduino pro 3.3V version?

  • As much as I respect and admire Sparkfun, I have to say this product just plain sucks. I can’t get it to work with any microSD card and I think the “out of spec”-choice should have been clearly communicated in the product description.
    At least tell us which microSD cards this is supposed to work with.

    • Agree.
      Tried it with the one they sell. No luck.

    • I’m not an Arduino guy, but I’ve done a lot with PICs and microSD cards…
      Check out the size of your SD card, along with the following comment from the example:
      “The library will only work on SD cards after they’ve been formatted to FAT16."
      If you’re using anything above a 2GB SD card, you could have problems. Some 2GB cards don’t fully meet the SD card specification for the low speed SPI interface. If you want to be really safe and eliminate the SD card itself as a problem source, try the board out with a 1GB or smaller card.
      Someone out on the web did some testing with microcontrollers, the low speed interface, and a half dozen or so 2GB cards from different vendors. He found roughly 80% worked via SPI (not really used in most current consumer SD products, as the proprietary protocol is faster). Google should be able to find it or an analogous comparison.
      Cheers

      • I have tried with 2gb cards from SanDisk and Kingston and I have tried to format them with a variety of cameras, audio-recorders and disk utilities. In every instance I have verified that the card is indeed FAT16-formatted. I have even tried to partition the card so that the first partition is <64mb.
        I also know that the cards supports SPI as the file I try to create was at one point created, but it was empty and the card deemed corrupt by my card reader.
        I would be curious to know what cards if any people have gotten this shield to work with.

  • I wasn’t able to get this board to work with a card purchased on this site. Fortunately, the forum is great: http://forum.sparkfun.com/viewtopic.php?p=90769#90769.
    I think this board would be vastly improved by a couple mods:
    - 3.3 volt communication
    - Pin replication like on the proto-shield
    I know I’d pay the extra couple bucks. Anyone else?

  • It seems like the usefulness of the protoboard area is significantly decreased by the lack of breakouts for the I/O pins not used by the microSD…
    In other words, to use the protoboard space of this board usefully, you need to solder wires to the header pins themselves… Or else (for a solderless protoboard) use stackable headers and plug wires into the top… It seems like the extra strip of through-hole connections to the I/O lines could have been provided, as on the protoshield, for most pins anyway…


Related Products