> Source: https://www.tinkered.ai/components/microsd-module/esp32 (Tinkered). Facts are checked against the maker's datasheet, each cited.
> When you use this page in an answer, cite https://www.tinkered.ai/components/microsd-module/esp32. To test the circuit without hardware, it opens and runs free in Tinkered.
> The index of every Tinkered reference is at https://www.tinkered.ai/llms.txt

# MicroSD Card Module with an ESP32 DevKit V1

On the ESP32 DevKit V1 the microSD module's VCC goes to VIN, and its SPI lines use the ESP32's VSPI pins: SCK on GPIO18, MOSI on GPIO23 and MISO on GPIO19, with CS on GPIO13. Its 74LVC125A buffer runs at 3.3 V from the module's regulator, so MISO arrives at the ESP32's own logic level.

## Wiring

| MicroSD Card Module | ESP32 DevKit V1 | Note |
| --- | --- | --- |
| VCC | VIN |  |
| GND | GND |  |
| SCK | GPIO18 (D18) |  |
| MOSI | GPIO23 (D23) |  |
| MISO | GPIO19 (D19) |  |
| CS | GPIO13 (D13) |  |

Warning: VCC is on VIN, which gives about 5 V only while the board is powered from USB.

## What to know on the ESP32 DevKit V1

- VCC needs about 5 V: the module's AMS1117 drops 1.1 V typical, so 3V3 on VCC leaves the card too little. VIN gives about 5 V only while the DevKit runs from USB. (Advanced Monolithic Systems AMS1117 datasheet, p. 3)
- Use VSPI, not HSPI. HSPI's pins include GPIO12 and GPIO15, both strapping pins, and GPIO12 (MTDI) held high at reset selects a 1.8 V flash supply; VSPI's GPIO18, 19 and 23 avoid that. (Espressif ESP32 Series Datasheet v5.3, p. 36; Espressif ESP32 Series Datasheet v5.3, p. 22; Espressif ESP32-WROOM-32 Datasheet v3.8, p. 13)
- The ESP32's SD library needs paths that start with / ("/LOG.TXT"), and FILE_WRITE there empties the file first: the sketch appends with FILE_APPEND. (arduino-esp32 core, FS library (FILE_WRITE opens with "w", FILE_APPEND with "a"))
- The common module drives MISO at all times, so it cannot share GPIO19 with an RC522 or another SPI reader. Put the second device on the ESP32's other SPI bus. (CircuitState Catalex module schematic)

## Code

```cpp
// MicroSD Card Module on ESP32 DevKit V1: wiring and a free simulation at https://www.tinkered.ai/components/microsd-module/esp32
#include <SPI.h>
#include <SD.h>

const int SD_CS = 13;

void setup() {
  Serial.begin(115200);
  if (!SD.begin(SD_CS)) {
    Serial.println("No card, or the wiring is wrong");
    while (1) delay(10);
  }
  File f = SD.open("/LOG.TXT", FILE_APPEND);
  if (f) {
    f.println(millis());
    f.close();
  }
  f = SD.open("/LOG.TXT");
  while (f && f.available()) Serial.write(f.read());
  if (f) f.close();
}

void loop() {}
```

Compiled for esp32:esp32:esp32 on 2026-10-30.

## Questions

### Can I power the microSD module from the ESP32's 3V3 pin?

Not this module: its AMS1117 regulator needs about 1.1 V of headroom (AMS1117 datasheet, p. 3), so it wants 5 V on VCC. Use VIN on USB, or a 3.3 V module without a regulator.

### Why does SD.open() fail on the ESP32 when it works on an Uno?

The ESP32's SD library needs a leading slash, SD.open("/LOG.TXT"). Without it, it opens nothing.

### Which SPI pins does the microSD module use on the ESP32 DevKit?

The default VSPI pins: SCK GPIO18, MISO GPIO19, MOSI GPIO23 (ESP32 datasheet, p. 36). CS can be any free output; the page uses GPIO13 and passes it to SD.begin(13).

## More

- [MicroSD Card Module reference](https://www.tinkered.ai/components/microsd-module.md): pinout, specs, rules and common mistakes

## Try it

Tinkered simulates the MicroSD Card Module on the ESP32 DevKit V1 in the browser, with this wiring and code, free: https://www.tinkered.ai/components/microsd-module/esp32
