Op werkdagen vóór 14:00 uur besteld = dezelfde dag verzonden en in 98% van de gevallen de volgende dag in huis. Gratis retourneren 30 dagen bedenktijd 1 jaar garantie

Aansluitschema en codevoorbeeld

Zo sluit je de Micro SD Kaartlezer voor Arduino aan op een Arduino UNO of ESP32, met een voorbeeldsketch die je direct kunt uploaden.

Lezen en schrijven met Micro-SD-kaartlezer

Dit project laat zien hoe je een 5V Micro-SD-kaartlezer aansluit op een Arduino Uno met SPI-communicatie. De sketch initialiseert de SD-kaart, schrijft een regel tekst naar een bestand met de naam test.txt en leest het bestand vervolgens terug in de Seriële Monitor. Open de Seriële Monitor op 115200 baud om de uitvoer te bekijken.

Aansluitschema: Micro SD Kaartlezer voor Arduino op een Arduino UNO
Aansluitschema · Klik om te vergroten
Aansluittabel: Micro SD Kaartlezer voor Arduino op een Arduino UNO
Aansluittabel · Klik om te vergroten
Read_and_Write_with_Micro_SD_Card_Reader.ino · gecompileerd en getest
/*
 * ==================================================================
 *  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-kaart Lees- en Schrijfdemo

Sluit de 5V MicroSD-kaartmodule aan op de ESP32 met behulp van een 4-kanaals logic level shifter om veilige 3.3V SPI-communicatie te garanderen. De sketch initialiseert de SD-kaart op de VSPI-bus, maakt een testbestand aan en schrijft erin, en leest de inhoud daarna terug via de Serial Monitor op 115200 baud.

Aansluitschema: Micro SD Kaartlezer voor Arduino op een ESP32 DevKit V1
Aansluitschema · Klik om te vergroten
Aansluittabel: Micro SD Kaartlezer voor Arduino op een ESP32 DevKit V1
Aansluittabel · Klik om te vergroten
ESP32_MicroSD_Card_Read_and_Write_Demo.ino · gecompileerd en getest
/*
 * ==================================================================
 *  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 Kaartlezer voor Arduino


Deze micro SD kaartlezer is geschikt voor de Arudino, ESP8266, ESP32, Wemos etc. Is reeds onderdeel van de standaard Arduino library.


Ideaal om bestanden te lezen en te schrijven. De opslagcapaciteit wordt bepaald door de micro SD kaart die geplaatst wordt.

Kaarttype: Micro SD tot max. 2GB en Micro SDHC tot max 32GB
Circuitstroom: 3.3V en 5V
Aanlsuitingen: VCC, GND, MISO, MOSI, SCK/SPI en CS

 

  • Micro SD kaart
  • 3.3V en 5V
  • VCC, GND, MISO
  • SPI-aansluiting

Waarom kiezen voor dit product?

  • Geschikt voor meerdere boards – Te gebruiken met Arduino, ESP8266, ESP32 en Wemos.
  • Lezen en schrijven – Ideaal om bestanden te lezen en schrijven.
  • Onderdeel van library – Reeds onderdeel van de standaard Arduino library.
  • Tot 32GB ondersteuning – Ondersteunt micro SDHC-kaarten tot 32GB.
Specificaties
Voeding3.3V en 5V
AansluitingVCC, GND, MISO, MOSI, SCK/SPI en CS
Geschikt voorArduino, ESP8266, ESP32, Wemos
Capaciteittot 2 GB
KaarttypeMicro SD

Vaak samen gekocht

Totaal: € 13,34

Beoordelingen

★★★★★ 5,0/5 1 beoordeling
  • ★★★★★Paul liekensGeverifieerde koop

    Werkt correct, doet wat het beloofd te doen.

Schrijf een beoordeling
Jouw beoordeling

Verzenden & retourneren

Verzending

Op basis van je locatie; klopt dit niet, kies dan je land.

We leveren helaas niet in dit land (US).

Alles over verzenden

Retourneren

Niet tevreden? Je hebt 30 dagen bedenktijd na ontvangst om het product terug te sturen.

Alles over retourneren