To successfully log data with an Arduino SD Karte (card) module, you must wire it to the hardware SPI pins (MOSI on 11, MISO on 12, SCK on 13) and use Pin 10 for Chip Select (CS). Crucially, the microSD card must be formatted to FAT32 (not exFAT), and if you are using a 5V board like the Uno R3, your module must have a built-in logic level shifter to prevent frying the card's controller.
While 'SD Karte' is the German term for SD card, it has become the universal search shorthand in the European maker community for the ubiquitous, low-cost blue and red microSD adapter modules found on Amazon and AliExpress. This guide cuts through the generic tutorials and gives you the bench-tested reality of making these modules work reliably in 2026.
The "Arduino SD Karte" Module: Hardware Variants & Specs
Not all SD Karte adapters are created equal. The two most common variants you will encounter are the 'Blue' Catalex-style module and the 'Red' Deek-Robot-style module. Plugging a 5V Arduino directly into a module lacking a level shifter will permanently destroy the microSD card's internal controller within seconds.
| Feature | Blue Module (Catalex-style) | Red Module (Deek-Robot-style) |
|---|---|---|
| Logic Level Shifter | Yes (typically 74LVC125A or discrete MOSFETs) | No (Direct 3.3V logic only) |
| Voltage Regulator (LDO) | Yes (AMS1117-3.3V on board) | Usually No (Requires external 3.3V) |
| Safe for 5V Boards (Uno R3) | Yes (Power via 5V pin) | No (Will fry card unless modified) |
| Safe for 3.3V Boards (ESP32) | Yes (Power via 3.3V pin, bypasses LDO) | Yes (Power via 3.3V pin) |
| Typical Price (2026) | $2.50 - $4.00 USD | $1.50 - $2.50 USD |
MicroSD cards draw up to 200mA during initialization and block writes. The AMS1117 LDO on the blue module can handle this, but your Arduino's onboard 5V regulator might overheat if you are also powering LEDs or sensors. Always power the SD module's VCC from a robust 5V rail, or add a 100µF decoupling capacitor directly across the module's VCC and GND pins to absorb transient spikes.
Wiring the SPI Bus: Pin Mapping & Power Decoupling
This guide targets the Arduino Uno R3 (and the pin-compatible Uno R4 Minima). We are using the hardware SPI bus, which is vastly faster and more reliable than software SPI (bit-banging).
Required Parts List
- MCU: Arduino Uno R3 (ATmega328P)
- Module: Catalex MicroSD Card Adapter (Blue, with level shifter)
- Media: SanDisk Ultra 16GB microSDHC (Class 10)
- Passives: 100µF electrolytic capacitor (for power decoupling)
- Wiring: 6x Female-to-Male Dupont jumper wires
Pin Mapping Table
| SD Karte Module Pin | Arduino Uno R3 Pin | Function / Notes |
|---|---|---|
| VCC | 5V | Powers the onboard LDO and level shifter IC. |
| GND | GND | Common ground reference. |
| MOSI | 11 | Master Out Slave In (Data to SD card). |
| MISO | 12 | Master In Slave Out (Data from SD card). |
| SCK | 13 | Serial Clock (SPI timing signal). |
| CS | 10 | Chip Select. Must be LOW to talk to the SD card. |
Step-by-Step Wiring Procedure
- De-energize the board: Unplug the Arduino USB cable before making connections.
- Solder the decoupling capacitor: Solder the 100µF capacitor across the VCC and GND pins on the SD module header. Observe polarity (stripe to GND). This prevents brownouts during write operations.
- Connect Power: Wire Module VCC to Arduino 5V, and Module GND to Arduino GND.
- Connect SPI Data Lines: Wire MOSI to 11, MISO to 12, and SCK to 13.
- Connect Chip Select: Wire Module CS to Arduino Pin 10.
- Verify: Use a multimeter in continuity mode to ensure no adjacent header pins are shorted by stray solder or stray wire strands.
Complete Data Logging Code (Arduino Uno R3)
Below is a complete, compilable sketch using the standard Arduino `
#include <SPI.h>
#include <SD.h>
// --- PIN DEFINITIONS ---
// Hardware SPI pins (11, 12, 13) are handled automatically by the SPI library.
// We only need to define the Chip Select (CS) pin.
#define SD_CS_PIN 10
#define LED_STATUS_PIN 8 // Optional: LED to indicate write success
File dataFile;
unsigned long logCount = 0;
void setup() {
Serial.begin(115200);
while (!Serial) { ; } // Wait for serial port to connect (needed for native USB)
pinMode(LED_STATUS_PIN, OUTPUT);
digitalWrite(LED_STATUS_PIN, LOW);
Serial.print("Initializing SD Karte module on CS pin ");
Serial.print(SD_CS_PIN);
Serial.println("...");
// SD.begin() initializes the SPI bus and the card.
if (!SD.begin(SD_CS_PIN)) {
Serial.println("initialization failed. Things to check:");
Serial.println("* Is a card inserted?");
Serial.println("* Is the card formatted to FAT16 or FAT32?");
Serial.println("* Is the wiring correct (MOSI/MISO/SCK/CS)?");
Serial.println("* Is the CS pin correctly defined and not shared?");
// Halt execution to prevent endless serial spam
while (1);
}
Serial.println("Initialization done.");
// Open the file. Note: only one file can be open at a time.
// FILE_WRITE appends to the end of the file if it exists.
dataFile = SD.open("datalog.txt", FILE_WRITE);
if (!dataFile) {
Serial.println("Error opening datalog.txt for writing!");
while (1);
}
// Write header if file is empty (position 0)
if (dataFile.position() == 0) {
dataFile.println("LogID, Timestamp_ms, Simulated_Sensor_Value");
dataFile.flush();
}
}
void loop() {
// Simulate reading a sensor (e.g., analogRead(A0))
int sensorValue = analogRead(A0);
unsigned long currentTime = millis();
// Format and write data
dataFile.print(logCount);
dataFile.print(", ");
dataFile.print(currentTime);
dataFile.print(", ");
dataFile.println(sensorValue);
// CRITICAL: Flush the buffer to physically write to the card.
// If you don't flush, data is lost if power is cut.
dataFile.flush();
// Visual feedback
digitalWrite(LED_STATUS_PIN, HIGH);
delay(50);
digitalWrite(LED_STATUS_PIN, LOW);
logCount++;
// Log every 2 seconds
delay(1950);
}
Debugging: "initialization failed. Things to check:"
If your serial monitor outputs the exact string initialization failed. Things to check:, the SD.begin() function has returned false. This is the most common stumbling block for embedded developers. Here are the ranked causes and how to fix them.
The First Three Things to Check
- Card Formatting (The 90% Fix): The standard Arduino SD library only supports FAT16 and FAT32 file systems. Modern 64GB+ cards come pre-formatted as exFAT. You must reformat the card to FAT32 using a tool like SD Memory Card Formatter (official SD Association tool) or Rufus. Windows 11 native formatter often hides the FAT32 option for cards larger than 32GB.
- SPI Bus Contention: If you have another SPI device on the bus (like an NRF24L01 radio or an SPI display), its Chip Select pin must be set to HIGH (deselected) in your
setup()before you callSD.begin(). If another device is pulling MISO low, the SD card initialization will fail. - Power Brownout: Measure the 3.3V rail on the SD module with a multimeter while the code is running. If it dips below 3.0V during
SD.begin(), the card's internal controller resets. Add the 100µF capacitor mentioned in the wiring section, or power the Arduino via the barrel jack (7-9V) to give the onboard regulator more headroom.
Advanced Edge Cases
- Fake Capacity Cards: Ultra-cheap unbranded cards often report 64GB to the host but physically contain only 4GB of NAND. The FAT32 table corrupts immediately upon writing past the physical limit. Stick to SanDisk, Samsung, or Kingston.
- Card Insertion Switch: Some modules have a physical 'card detect' switch wired to a pin. The standard Catalex modules do not break this pin out, so the library ignores it. Ensure the card clicks firmly into the spring-loaded tray.
Extending and Simplifying Your Build
Once you have basic logging working, you will likely want to improve the system. Here is how to adapt the build based on your project constraints.
How to Simplify: Switch to a 3.3V Native MCU
If you are tired of dealing with 5V-to-3.3V logic level shifting and LDO heat, switch to an ESP32 DevKit V1 or an Arduino Nano 33 IoT. Because these boards operate natively at 3.3V, you can wire the SD module directly to their 3.3V output and GPIO pins without worrying about frying the card. (Note: ESP32 requires defining custom SPI pins in code, as its default hardware SPI pins are often connected to internal flash memory).
How to Extend: Add Timestamping with an RTC
The millis() function resets every time the Arduino loses power. For real-world data logging, you need a Real Time Clock (RTC). Add a DS3231 I2C RTC module. Because I2C uses different pins (A4/SDA and A5/SCL on the Uno R3) than SPI, the RTC and the SD Karte module will not conflict on the bus. Use the RTCLib by Adafruit to fetch UNIX timestamps and write them to your CSV file.
FAQ: Arduino SD Karte Long-Tail Questions
Why does my Arduino SD Karte fail to initialize on a 4GB card?
A 4GB card sits on the boundary between SDHC and standard SD specifications. Some older or cloned SD controller ICs on cheap blue modules struggle with the 4GB cluster size. Furthermore, if the 4GB card was formatted as FAT16 instead of FAT32, the cluster allocation table may exceed the library's RAM buffer limits. Always format 4GB cards to FAT32 with a 32KB allocation unit size using the official SD Association formatter.
Can I share the SPI bus with an RF24L01 and an SD Karte?
Yes, SPI is designed to be shared, but you must manage the Chip Select (CS) lines perfectly. Wire the SD Karte CS to Pin 10, and the RF24L01 CSN to Pin 9. In your code, you must ensure that before calling any SD library function, the RF24 CSN pin is set HIGH (deselecting the radio). If both CS pins are LOW simultaneously, both chips will try to drive the MISO line, causing data corruption and potential hardware damage.
How do I format the SD Karte to FAT32 on Windows 11?
Windows 11 intentionally hides the FAT32 formatting option in the right-click menu for any drive larger than 32GB, forcing you to use exFAT (which the Arduino SD library cannot read). To bypass this, download the official SD Memory Card Formatter from the SD Association. It ignores Windows restrictions and will correctly format a 64GB or 128GB card to FAT32, making it instantly readable by your Arduino.






