Multiple SD card modules?

Hello, Somewhere I read that one of Arduino libraries can support multiple Sd card modules. The ones I have is https://www.amazon.com/HiLetgo-Adater-Interface-Conversion-Arduino/dp/B07BJ2P6X6 They work great on Single module one at a time. But I would love to have a second module writing the same information as the first one. I can not find nothing on the subject of using two Sd card modules at the same time. My second problem is my first Sd card is 8GB and second Sd card is only 2 GB. These are just test sd cards.

My question is it possible to write to both Sd cards at the same time And my second question is it possible to write to both of the Sd cards even if they are at different storage capacity?

Joseph

P.s.s Maybe I'm phrasing it wrong in google to search I have no clue. I typed in Arduino Multiple Sd card modules Or Arduino two sd card modules. I know that is in correct.

Just an update. I just found this https://create.arduino.cc/projecthub/nmvrouwe/access-2-sd-cards-with-arduino-506415?ref=part&ref_id=10116&offset=2 And I'm trying it now. After so many websites searching this was on the 38 search page of google.

A quick search of the forum should have shown you this result: Two SD Cards on the same project? - Using Arduino / Programming Questions - Arduino Forum

Hello er_name_not_found. Yes you are right. I did not do that or Think of doing that to be honest. I did found the same link that they used and I'm trying it now. I'll post a update shortly.

Joseph

However, it's possible that the SD module you are using has a design flaw that prevents more than one being used in a circuit. If you find that both modules work fine as long as the other one isn't connected, that's probably the problem. Almost all microSD card modules have this problem. The exception is those make by Adafruit.

Edit: The Amazon listing actually has a schematic, and if the modules were built to that schematic, they do have the design flaw. The problem is that the MISO line goes through the level translator chip, and is therefore always active. It should be active only when this module's chip select is active (so the other module can use it at other times).

Hello, Just an update. I got everything wired up coding put in and this is the output.

Starting
SD.Begin() SD 1 Failed

SD1 Begin OK.
/r/n Files on SD2 are: 
SD.Begin() SD 2 Failed

SD2 Begin OK.
/r/n Files on SD2 are: 
/r/n Files on SD2 now are: 


Open ANYFILE.TXT on SD1 and copy to SD2
SD.Begin() SD 1 Failed
Opening of the sourcefile Failed
Opening of the sourcefile Failed
Opening of the sourcefile Failed

Now i'm not sure what is going on. This is my code only thing I have changed is where the CS pins are at.

// script to deminstrate 2 x 16 LCD and 2 x SD card.

#include <SPI.h>                        // required by SD
#include <SD.h>                         // required for SD card

#define SDSS1pin                        // on the UNO the Sparkfun SDSS pin is 8 !!!
#define SDSS2pin  13                      // on the UNO the Sparkfun SDSS pin is 8 !!!

File anyFile;                           // for logging day records
File entry;
File root;

String fileName  =  "anyFile.txt";

unsigned long readPosition;
unsigned long byteCount;

byte byteBuffer[4096];

void setup()
{
  pinMode(SDSS1pin, OUTPUT);                  // set SS pin to output (required they say)
  pinMode(SDSS2pin, OUTPUT);                  // set SS pin to output (required they say)
  digitalWrite(SDSS1pin, HIGH);
  digitalWrite(SDSS2pin, HIGH);

  Serial.begin(9600);                         // init seral for serialmonitor
  Serial.println("Starting");


  if (!SD.begin(SDSS1pin))                          // start the SD stuff with 53 as SS pin
  {
    Serial.println("SD.Begin() SD 1 Failed");
    delay(2000);
  }
  Serial.println("\r\nSD1 Begin OK.");
  Serial.println("/r/n Files on SD2 are: ");
  File root = SD.open("/");
  printDirectory(root);                             // list files on SD1
  root.close();
  digitalWrite(SDSS1pin, HIGH);                     // disable SD1

  if (!SD.begin(SDSS2pin))                          // start the SD stuff with 53 as SS pin
  {
    Serial.println("SD.Begin() SD 2 Failed");
    delay(2000);
  }
  Serial.println("\r\nSD2 Begin OK.");
  delay(1000);

  Serial.println("/r/n Files on SD2 are: ");
  root = SD.open("/");
  printDirectory(root);                             // list files on SD2
  SD.remove(fileName);                              // remove the file on SD2 in case it exists
  Serial.println("/r/n Files on SD2 now are: ");
  root = SD.open("/");
  printDirectory(root);                             // list files on SD2 again
  delay(2000);

  Serial.println("\r\n\r\nOpen ANYFILE.TXT on SD1 and copy to SD2");

  digitalWrite(SDSS1pin, HIGH);              //    disable SD1
  digitalWrite(SDSS2pin, HIGH);              //    disable SD2
  readPosition = 0;
};

// ============================================  MAIN LOOP  ====================================
void loop()
{
  if (!SD.begin(SDSS1pin))                          // start the SD stuff with 53 as SS pin
  {
    Serial.println("SD.Begin() SD 1 Failed");
    delay(2000);
  }

  anyFile = SD.open(fileName, FILE_READ);             // Open for read
  while (!anyFile)
  {
    Serial.println("Opening of the sourcefile Failed");
    delay(2000);
  }
  if (readPosition == anyFile.size())
  {
    Serial.print("Copied bytes:    ");
    Serial.println(anyFile.size());
    while (1) delay(10);
  }

  anyFile.seek(readPosition);
  byteCount = 0;
  while (anyFile.available() && byteCount < 4096)
  {
    byteBuffer[byteCount] = anyFile.read();
    byteCount++;
    readPosition++;
  }
  anyFile.close();
  digitalWrite(SDSS1pin, HIGH);              //    disable SD1


  if (!SD.begin(SDSS2pin))                          // start the SD stuff with 53 as SS pin
  {
    Serial.println("SD.Begin() SD 2 Failed");
    delay(2000);
  }

  anyFile = SD.open(fileName, FILE_WRITE);             // Open for write
  anyFile.write(byteBuffer, byteCount);
  anyFile.close();
  digitalWrite(SDSS2pin, HIGH);                     //    disable SD2
};



// ================================ List files and sizes on SD card ==========================
// -------------------------------------------------------------------------------------------
void printDirectory(File dir)               // lists the files and filesize on the SD card (only root)
{
  while (true)
  {
    File entry =  dir.openNextFile();
    if (! entry)                       // no more files
    {
      break;
    }
    Serial.print(entry.name());
    Serial.print("    ");
    Serial.println(entry.size(), DEC);
    entry.close();
  }
};

Is the Put the single use Sd card example sketch the first module write to it with no problem.

Which adafruit sd card module are they? I belive they have a few.

I think it's product #254. But just search for microSD card breakout board+.

By "at the same time" I thought your meaning was Simultaneously.

If you want to fix the Amazon modules, here's how:

I can not solder here. But my friends place He can. Thank you i will take it to him tomorrow and try this out.

Ok. You'll have to fix two of them. Then try each one separately to make sure they still work, then try them together.

My order came with 5 of them. Sense I'm only using two of them I still have three left.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.