Circuit

microSD Card Pin Mapping for SPI Mode

We'll focus only on the microSD card since that's what we're using. The microSD has 8 pins, but we only need 6 for SPI mode. You may have noticed that the SD card reader module we have also has only 6 pins, with markings for the SPI functions. The table below shows the microSD card pins and their corresponding SPI functions.

microSD Card Pin Diagram
microSD Card Pin SPI Function
1 -
2 Chip Select (CS); also referred as Card Select
3 Data Input (DI) - corresponds to MOSI. To receive data from the microcontroller.
4 VDD - Power supply (3.3V)
5 Serial Clock (SCK)
6 Ground (GND)
7 Data Output (DO) - corresponds to MISO. To send data from the microSD card to the microcontroller.
8 -

Connecting the ESP32 to the SD Card Reader

The microSD card operates at 3.3V, so using 5V to power it could damage the card. However, the reader module comes with an onboard voltage regulator and logic shifter, allowing it to safely be connected to the 5V power supply of the ESP32.

ESP32 Pin Wire SD Card Pin
GPIO 5
CS
GPIO 18
SCK
GPIO 23
MOSI
GPIO 19
MISO
Vin
VCC
GND
GND

SD Card reader pico connection