SD-card initialization failed


I want to save data from my sensors to a sd-card. I haven’t worked with a sd-card before so I thought lets try some code from someone else. I found a code on How to mechatronics, so I used that code…

but I con’t get it to work. Most of the time it gives the error:“initialization failed” and if it doesn’t give that error it says: “error opening test.txt Read:”

I have tried several things: new kabels, different sd-cards, updating lyberies, checking if I wired it corretly different arduino’s but non of them have worked yet.

I have to sd card holders for a normal sd-card. I only have micro sd cards so I use a adapter for micro sd to normal sd. the sd I tried are all 32GB and have FAT32 on them.

I hope someone knows what I am doing wrong.

 *  Arduino SD Card Tutorial Example
 *  by Dejan Nedelkovski,
#include <SD.h>
#include <SPI.h>
File myFile;
int pinCS = 53; // Pin 10 on Arduino Uno
void setup() {
  pinMode(pinCS, OUTPUT);
  // SD Card Initialization
  if (SD.begin())
    Serial.println("SD card is ready to use.");
  } else
    Serial.println("SD card initialization failed");
  // Create/Open file 
  myFile ="test.txt", FILE_WRITE);
  // if the file opened okay, write to it:
  if (myFile) {
    Serial.println("Writing to file...");
    // Write to file
    myFile.println("Testing text 1, 2 ,3...");
    myFile.close(); // close the file
  // if the file didn't open, print an error:
  else {
    Serial.println("error opening test.txt");
  // Reading the file
  myFile ="test.txt");
  if (myFile) {
    // Reading the whole file
    while (myFile.available()) {
  else {
    Serial.println("error opening test.txt");
void loop() {
  // empty

the image shows the weird files it makes

the sd I tried are all 32GB and have FAT32 on them.

This post really belongs in Storage, since it is NOT a programming issue.

I mention the correct place, because you really need to go there and read the stickies. I’ll bet that a clue-by-four whacks you before you are done reading.