It’s important to mention that there are a couple of ways to connect the SD card to the microcontroller. One of the easiest is to use board with a S

ESP32: connecting to SD Card

submited by
Style Pass
2020-06-30 13:37:52

It’s important to mention that there are a couple of ways to connect the SD card to the microcontroller. One of the easiest is to use board with a SD card socket, where we can plug our card and start using it right away.

Other approach is to use a SD card adapter, which can also be found at eBay for very low prices. These modules have a socket for the card and then expose pins that we can connect to the ESP32.

In this introductory tutorial we are going to learn how to mount the card and obtain some simple information, such as the card type or its total capacity.

For that, we will use the Arduino core library that allows to interact with the SD card. Note that there are two libraries available: SD and SD_MMC. You can read the difference about them here. For more details, you can also consult the Espressif documentation about the lower level drivers.

In short, the SD library operates over SPI and the SD_MMC uses the SDMMC hardware bus  of the ESP32 [1]. So, depending on your hardware setup, you should choose the correct library. For the board I’m using, I need to use the SC_MMC one.

Leave a Comment