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.
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. SENSOR-MODULE/EXPANSION BOARD PINOUT DIAGRAM
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
+ 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.
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.
+ 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
SD- card Data rate(read/write) like sending file over ftp or something.