Ordered on weekdays before 14:00 = shipped the same day and delivered the next day in 98% of cases. Free returns 30-day reflection period 1-year warranty

Wiring diagram and code example

How to connect the Micro SD Card Reader for Arduino to an Arduino UNO or ESP32, with an example sketch you can upload straight away.

Read and Write with Micro-SD Card Reader

This project demonstrates how to connect a 5V Micro-SD card reader to an Arduino Uno using SPI communication. The sketch initializes the SD card, writes a line of text to a file named test.txt, and reads the file back to the Serial Monitor. Open the Serial Monitor at 115200 baud to view the output.

Wiring diagram: Micro SD Card Reader for Arduino on an Arduino UNO
Wiring diagram · Click to enlarge
Connection table: Micro SD Card Reader for Arduino on an Arduino UNO
Connection table · Click to enlarge
Read_and_Write_with_Micro_SD_Card_Reader.ino · compiled and verified
/*
 * ==================================================================
 *  Generated by Codey.online  —  https://www.codey.online
 * ==================================================================
 *  Project   : Read and Write with Micro-SD Card Reader
 *  Board     : Arduino UNO (arduino:avr:uno)
 *  Parts     : Micro-SD Card Reader 5V
 *  Libraries : none (built-in)
 *
 *  Codey Online is an AI-powered browser IDE for Arduino and ESP32.
 *  Describe your project and Codey writes the code, draws the wiring
 *  diagram and uploads it to your board, straight from the browser.
 *  This code is free to use, modify and share, without warranty.
 * ==================================================================
 */

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

const int chipSelect = 10;

void setup() {
  Serial.begin(115200);
  while (!Serial) {
    ; // Wait for serial port to connect
  }

  Serial.println(F("Initializing SD card..."));

  if (!SD.begin(chipSelect)) {
    Serial.println(F("Initialization failed! Check wiring and FAT16/FAT32 format."));
    return;
  }
  Serial.println(F("Initialization done."));

  // Write data to the card
  File myFile = SD.open("test.txt", FILE_WRITE);
  if (myFile) {
    Serial.print(F("Writing to test.txt..."));
    myFile.println(F("Hello from Arduino UNO!"));
    myFile.close();
    Serial.println(F(" done."));
  } else {
    Serial.println(F("Error opening test.txt for writing."));
  }

  // Read data back from the card
  myFile = SD.open("test.txt");
  if (myFile) {
    Serial.println(F("--- Content of test.txt ---"));
    while (myFile.available()) {
      Serial.write(myFile.read());
    }
    myFile.close();
    Serial.println(F("--- End of file ---"));
  } else {
    Serial.println(F("Error opening test.txt for reading."));
  }
}

void loop() {
  // Demo runs once in setup
}

Wiring diagram and example code generated by Codey.online — https://www.codey.online

ESP32 MicroSD Card Read and Write Demo

Connect the 5V MicroSD card module to the ESP32 using a 4-channel logic level shifter to ensure safe 3.3V SPI communication. The sketch initializes the SD card on the VSPI bus, creates and writes a test file, and reads its contents back over the Serial Monitor at 115200 baud.

Wiring diagram: Micro SD Card Reader for Arduino on an ESP32 DevKit V1
Wiring diagram · Click to enlarge
Connection table: Micro SD Card Reader for Arduino on an ESP32 DevKit V1
Connection table · Click to enlarge
ESP32_MicroSD_Card_Read_and_Write_Demo.ino · compiled and verified
/*
 * ==================================================================
 *  Generated by Codey.online  —  https://www.codey.online
 * ==================================================================
 *  Project   : ESP32 MicroSD Card Read and Write Demo
 *  Board     : ESP32 DEVKIT V1 (esp32:esp32:esp32doit-devkit-v1)
 *  Parts     : Micro-SD Card Reader 5V
 *  Libraries : none (built-in)
 *
 *  Codey Online is an AI-powered browser IDE for Arduino and ESP32.
 *  Describe your project and Codey writes the code, draws the wiring
 *  diagram and uploads it to your board, straight from the browser.
 *  This code is free to use, modify and share, without warranty.
 * ==================================================================
 */

#include "FS.h"
#include "SD.h"
#include "SPI.h"

const int chipSelect = 5;

void setup() {
  Serial.begin(115200);
  while (!Serial) { delay(10); }

  Serial.println("Initializing SD card...");

  if (!SD.begin(chipSelect)) {
    Serial.println("Card Mount Failed! Check wiring and ensure a FAT32 card is inserted.");
    return;
  }

  uint8_t cardType = SD.cardType();
  if (cardType == CARD_NONE) {
    Serial.println("No SD card attached.");
    return;
  }

  Serial.print("SD Card Type: ");
  if (cardType == CARD_MMC) Serial.println("MMC");
  else if (cardType == CARD_SD) Serial.println("SDSC");
  else if (cardType == CARD_SDHC) Serial.println("SDHC");
  else Serial.println("UNKNOWN");

  uint64_t cardSize = SD.cardSize() / (1024 * 1024);
  Serial.printf("SD Card Size: %lluMB\n", cardSize);

  // Write to a test file
  Serial.println("Writing to test.txt...");
  File file = SD.open("/test.txt", FILE_WRITE);
  if (file) {
    file.println("Hello from ESP32 and MicroSD Card!");
    file.close();
    Serial.println("Write complete.");
  } else {
    Serial.println("Error opening file for writing.");
  }

  // Read the test file back
  Serial.println("Reading test.txt:");
  file = SD.open("/test.txt");
  if (file) {
    while (file.available()) {
      Serial.write(file.read());
    }
    file.close();
  } else {
    Serial.println("Error opening file for reading.");
  }
}

void loop() {
  // Idle
}

Wiring diagram and example code generated by Codey.online — https://www.codey.online

Micro SD Card Reader for Arduino


This micro SD card reader is suitable for the Arduino, ESP8266, ESP32, Wemos, etc. It is already part of the standard Arduino library.


Ideal for reading and writing files. The storage capacity is determined by the micro SD card that is inserted.

Card type: Micro SD up to max. 2GB and Micro SDHC up to max. 32GB
Circuit voltage: 3.3V and 5V
Connections: VCC, GND, MISO, MOSI, SCK/SPI and CS

 

  • Micro SD card
  • 3.3V and 5V
  • VCC, GND, MISO
  • SPI connection

Why choose this product?

  • Suitable for multiple boards – Compatible with Arduino, ESP8266, ESP32 and Wemos.
  • Read and write – Ideal for reading and writing files.
  • Part of the library – Already included in the standard Arduino library.
  • Supports up to 32GB – Supports micro SDHC cards up to 32GB.
Specifications
Power supply3.3V and 5V
ConnectionVCC, GND, MISO, MOSI, SCK/SPI and CS
Suitable forArduino, ESP8266, ESP32, Wemos
Capacityup to 2 GB
Card typeMicro SD

Frequently bought together

Total: € 29,29

Reviews

★★★★★ 5,0/5 1 review
  • ★★★★★Paul liekensVerified purchase

    Works correctly, does what it promises to do.

Write a review
Your rating

Shipping & returns

Shipping

  • Parcel with track & trace€ 7,70Within 24 hours
  • Pick up at PostNL location€ 7,40Within 24 hours
  • Letterbox parcel€ 3,70Within 2 business days
  • Letterbox parcel 24 hours€ 4,55Within 24 hours
  • Pick up in storeFree
All about shipping

Returns

Not satisfied? You have 30 days after delivery to return the product.

All about returns

Recently viewed