Wednesday, February 8, 2023
Google search engine
HometelecomESP32 – MicroSD

ESP32 – MicroSD

1. Introduction

With little data, we can store them in flash memory or eeprom of microcontrollers. But in the process of working with applications and projects that require storing large amounts of data, they must have memory expansion modules. A microSD card is one of the easiest ways to expand memory with a large capacity, at an affordable price. In this article, I will guide you to connect as well as write and read microSD card data with ESP32 using visual studio code included with IO IDE platform.

2. Prepare

2.1. Hardware

In this project, they will need to use the esp32 module, specifically I chose esp32 wroom devkit v1. Picture below
The choice of the microSD card module is also very important, there are many forms of communication between the microSD card module and the microcontroller such as SDIO or SPI. We’re using the microSD card module shown in the following figure – it communicates using SPI communication protocol. You can use any other microSD card module with an SPI interface.

The microSD card is the smallest consumer-focused flash memory card in use today. It’s a variation of the standard SD card (short for Secure Digital) and uses a similar set of electrical connections. That makes it possible to use microSD cards in standard SD card slots with the use of an adapter. MicroSD was introduced as a smaller alternative for portable electronics (picture below).

As you might expect, the microSD card is used to hold large volumes of data in devices that benefit from its miniature design. Larger devices still rely on regular SD cards when practical because they support much larger capacities, but in particular, devices like smartphones, dash cams, and small cameras (like action cameras) rely on the microSD card for its tiny shape.


3.1. Hardware

3.1.1. ESP32

ESP32-WROOM-32 is a powerful, generic Wi-Fi+BT+BLE MCU module that targets a wide variety of applications, ranging from low-power sensor networks to the most demanding tasks, such as voice encoding, music streaming and MP3 decoding.

 At the core of this module is the ESP32-D0WDQ6 chip*. The chip embedded is designed to be scalable and adaptive. There are two CPU cores that can be individually controlled, and the CPU clock frequency is adjustable from 80 MHz to 240 MHz. The chip also has a low-power co-processor that can be used instead of the CPU to save power while performing tasks that do not require much computing power, such as monitoring of peripherals. ESP32 integrates a rich set of peripherals, ranging from capacitive touch sensors, Hall sensors, SD card interface, Ethernet, high-speed SPI, UART, I²S and I²C.

3.1.2. Module microSD card

The micro- SD Card Module is a simple solution for transferring data to and from a standard SD card. The pin out is directly compatible with Arduino, but can also be used with other microcontrollers. It allows you to add mass storage and data logging to your project.

This module has SPI interface which is compatible with any sd card and it use 5V or 3.3V power supply which is compatible with Arduino UNO/Mega, ESP8266, ESP32.

SD module has various applications such as data logger, audio, video, graphics. This module will greatly expand the capability an Arduino can do with their poor limited memory.


+ Working Voltage: 5V/3.3V

+ Size:20x28mm

+ Interface: SPI

+ Compatible: MicroSD

3.2. Software tool

Instead of choosing to work with the Arduino IDE project, in this project I chose the visual studio code with the PlatformIO IDE extension.It offers convenience as well as accompanying support.

4. Progress

Connection between ESP32 and microSD card module

The microSD card module communicates using SPI communication protocol. You can connect it to the ESP32 using the default SPI pins.

+ VCC pin supplies power for the module and should be connected to 5V pin on the Arduino.

+ GND should be connected to the ground of Arduino.

+ MISO (Master In Slave Out) is SPI output from the Micro SD Card Module.

+ MOSI (Master Out Slave In) is SPI input to the Micro SD Card Module.

+ SCK (Serial Clock) pin accepts clock pulses which synchronize data transmission generated by Arduino

+ SS (Slave Select) pin is used by Arduino(Master) to enable and disable specific devices on SPI bus.

Wiring Diagram

Source code

+ Copy folder SD in library previously downloaded into folder lib of project
+ Choose example do you want in forder example to play with microSD card

Program output
SD- card Data rate(read/write) like sending file over ftp or something.



Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments