SD Card Module suddenly stopped working on Arduino Uno

Hi everyone,

I'm working on a project that uses an Arduino Uno with:

  • A flow meter (YF-S201)
  • An I2C LCD (20x4)
  • An RTC DS3231
  • An SD card module (with AMS1117 voltage regulator)

Everything was working perfectly yesterday — I was logging data to the SD card multiple times. But today, the SD card module refuses to initialize. I get the usual "SD card initialization failed!" message, even with the same code that worked before.

What I've tried so far:

  • Changed the SD card (2GB and 8GB, both FAT32 formatted)
  • Switched CS pin from D10 to D4 (and updated code)
  • Tried two different SD card modules: one 3.3V and one with 5V AMS1117 regulator
  • Used minimal test sketch with SD.begin() and file write
  • Checked and swapped jumper wires
  • Tested with a different Arduino Uno
  • Set pinMode(CS, OUTPUT) before SD.begin()

Wiring (current setup with Arduino Uno):

:small_blue_diamond: Flow Meter YF-S201

  • VCC (Red) → 5V
  • GND (Black) → GND
  • Signal (Yellow) → D2 (interrupt)

:small_blue_diamond: I2C LCD (20x4)

  • VCC → 5V
  • GND → GND
  • SDA → A4
  • SCL → A5

:small_blue_diamond: RTC DS3231

  • VCC → 5V
  • GND → GND
  • SDA → A4
  • SCL → A5

:small_blue_diamond: SD Card Module (AMS1117 version, 5V)

  • VCC → 5V
  • GND → GND
  • CS → D10 (or D4 when testing)
  • MOSI → D11
  • MISO → D12
  • SCK → D13

Here’s the test sketch I’m using:

#include <SD.h>
#include <SPI.h>

#define SD_CS 10  // or 4 when testing alternative CS

void setup() {
  Serial.begin(9600);
  pinMode(SD_CS, OUTPUT);
  Serial.println("Initializing SD card...");

  if (!SD.begin(SD_CS)) {
    Serial.println("SD card initialization failed!");
    return;
  }

  Serial.println("SD card initialized.");
  File testFile = SD.open("test.txt", FILE_WRITE);
  if (testFile) {
    testFile.println("SD card test successful.");
    testFile.close();
    Serial.println("Write successful.");
  } else {
    Serial.println("Failed to open file for writing.");
  }
}

void loop() {}

It was working fine yesterday, now nothing I try makes it work. Is it possible that the SD card module is damaged somehow? Or could it be SPI interference?

Test with one or two of the example sketches that come with the SD library.

If they fail, disconnect everything except the SD card adapter and test again.

You cannot connect I/O pins on a 5V Arduino to a 3.3V SD card without using a logic level shifter, as that can damage both the Uno and the SD card module.

Post a link to the product page for SD module, so forum members can determine whether it has a logic level shifter built in.

Tried two different SD card modules: one 3.3V

That may have damaged the Uno.