Book Image

Internet of Things Projects with ESP32

By : Agus Kurniawan
Book Image

Internet of Things Projects with ESP32

By: Agus Kurniawan

Overview of this book

ESP32 is a low-cost MCU with integrated Wi-Fi and BLE. Various modules and development boards-based on ESP32 are available for building IoT applications easily. Wi-Fi and BLE are a common network stack in the Internet of Things application. These network modules can leverage your business and projects needs for cost-effective benefits. This book will serve as a fundamental guide for developing an ESP32 program. We will start with GPIO programming involving some sensor devices. Then we will study ESP32 development by building a number of IoT projects, such as weather stations, sensor loggers, smart homes, Wi-Fi cams and Wi-Fi wardriving. Lastly, we will enable ESP32 boards to execute interactions with mobile applications and cloud servers such as AWS. By the end of this book, you will be up and running with various IoT project-based ESP32 chip.
Table of Contents (12 chapters)

Demo – accessing microSD cards from the ESP32

In this section, we develop a simple program to access a microSD card from the ESP32. For the demo, I use the ESP-WROVER-KIT v4 board. Fortunately, the ESP-WROVER-KIT v4 board has a built-in microSD card breakout that is connected to SDMMC pins.

Your ESP32 board should be connected to the microSD card breakout to perform this demo. You also need a microSD storage card with a small size, such as 1 GB, 2 GB or 4 GB. Your microSD card storage should be formatted as FAT.

Our demo scenario is aimed at creating a file named test.txt on a microSD card. Then, we read the content of the test.txt file and print this to the serial Terminal.

Now, you can create an ESP32 project called sdcard. Our main project file is sdcard.c and is located in the main folder. Firstly, we declare all required header files, including sdmmc and sdspi: