Mount ESP32 Filesystem Uploader in Arduino IDE

The ESP32 contains a Serial Peripheral Interface Flash File System (SPIFFS). SPIFFS is a lightweight filesystem created for microcontrollers with a flash chip, which is connected by SPI bus, like the ESP32 flash memory. In this post we’re going to reveal exactly how to quickly post data to the ESP32 filesystem using a plugin for Arduino IDE.

Install ESP32 Filesystem Uploader in Arduino IDE

Note: if you have an ESP8266 board, read:.

At the moment, this is not compatible with Arduino 2.0.

If you’re making use of VS Code with the PlatformIO expansion, read the following tutorial rather:

Table of Contents

Introducing SPIFFS

SPIFFS lets you accessibility the flash memory like you would carry out in a typical filesystem in your computer, yet less complex and also a lot more limited. You can read, write, close, and also delete files. At the time of creating this post, SPIFFS doesn’t support directories, so whatever is conserved on a level structure.

Using SPIFFS with the is particularly valuable to:

  • Create configuration files with settings;
  • Save data permanently;
  • Create files to save small amounts of data instead of using a microSD card;
  • ;
  • ;
  • And much more.

With SPIFFS, you can create the HTML as well as CSS in different files and save them on the ESP32 filesystem. Inspect the complying with tutorial to find out just how to develop a web server with documents stored on the ESP32 data system:

Installing the Arduino ESP32 Filesystem Uploader

You can create, save as well as write data to the ESP32 filesystem by creating the code on your own on the Arduino IDE. This is not extremely useful, because you ‘d have to type the content of your files in the Arduino sketch.

Fortunately, there is a plugin for the Arduino IDE that permits you to post data directly to the ESP32 filesystem from a folder on your computer. This makes it basic as well as truly easy to collaborate with data. Let’s install it.

Note: at the time of composing this article, the ESP32 Filesystem Uploader plugin is not supported on Arduino 2.0.

First, ensure you have the ESP32 add-on for the Arduino IDE. If you do not, comply with the next tutorial:

Windows Instructions

Follow the next actions to install the filesystem uploader if you’re making use of Windows:

1) Go to the data to download and install.

Download ESP32 SPIFFS Filesystem fs for Arduino IDE

2) Find your Sketchbook place. In your Arduino IDE, most likely to File > > Preferences and also examine your Sketchbook location. In my case, it’s in the adhering to path: C:/ Users/sarin/Documents/ Arduino.

Arduino sketchbook location

3) Go to the sketchbook location, and develop a devices folder.

creating tools folder sketchbook folder SPIFFS

4) Unzip the downloaded.zip folder. Open it and duplicate the ESP32FS folder to the devices folder you developed in the previous step. You must have a comparable folder framework:

<Sketchbook-location>/tools/ESP32FS/tool/esp32fs.jar
install filesystem plugin folder structure

5) Finally, restart your Arduino IDE.

To inspect if the plugin was successfully mounted, open your Arduino IDE. Select your ESP32 board, go to Tools and examine that you have the alternative “ESP32 Sketch Data Upload”. If you’re making use of MacOS X.

ESP32 Sketch Data Upload Arduino IDE SPIFFS FS Filesystem

MacOS X

1) Go to the data to download, pendtag

Follow the following directions.

Download ESP32 SPIFFS Filesystem fs for Arduino IDE

2) Unpack the documents.

3) Create a folder called devices in/ Documents/Arduino/.

4) Copy the unpacked ESP32FS folder to the devices directory site. You need to have a comparable folder structure.

~Documents/Arduino/tools/ESP32FS/tool/esp32fs.jar
Install SPIFFS ESP32 Mac OS X folder structure

5) Finally, restart your Arduino IDE.

To inspect if the plugin was effectively set up, open your Arduino IDE. Select your ESP32 board, go to Tools as well as check that you have the option “ESP32 Sketch Data Upload”.

ESP32 Data Sketch Upload Menu Arduino IDE Mac OS

Uploading Files using the Filesystem Uploader

To publish data to the ESP32 filesystem adhere to the next guidelines.

1) Create an Arduino illustration and wait. For presentation functions, you can save an empty illustration.

2) Then, open the illustration folder. You can most likely to Sketch > > Show Sketch Folder. The folder where your sketch is saved ought to open.

Arduino IDE Show Sketch folder to create data folder

3) Inside that folder, develop a new folder called information.

ESP32 Arduino Sketch Example File Filesystem fs SPIFFS

4) Inside the information folder is where you must place the files you intend to save into the ESP32 filesystem. As an example, produce a.txt file with some text called test_example.

ESP32 Notepad Test Example File Filesystem fs SPIFFS

5) Then, to upload the data, in the Arduino IDE, you just require to visit Tools > > ESP32 Sketch Data Upload.

ESP32 Sketch Data Upload Arduino IDE SPIFFS FS Filesystem

The uploader will overwrite anything you had currently conserved in the filesystem.

Note: in some ESP32 advancement boards you need to press the on-board BOOT switch when you see the “Connecting ……………. ____ … … “message.

SPIFFS Image Connecting to ESP32 board

The documents were efficiently published to the ESP32 filesystem when you see the message “SPIFFS Image Uploaded”.

SPIFFS Image Uploaded to ESP32 board

Testing the Uploader

Now, let’s simply check if the file was really conserved into the ESP32 filesystem. Just post the complying with code to your ESP32 board.

/*********
  Rui Santos
  Complete project details at https://randomnerdtutorials.com  
*********/

#include "SPIFFS.h"
 
void setup() {
  Serial.begin(115200);
  
  if(!SPIFFS.begin(true)){
    Serial.println("An Error has occurred while mounting SPIFFS");
    return;
  }
  
  File file = SPIFFS.open("/test_example.txt");
  if(!file){
    Serial.println("Failed to open file for reading");
    return;
  }
  
  Serial.println("File Content:");
  while(file.available()){
    Serial.write(file.read());
  }
  file.close();
}
 
void loop() {

}

After submitting, open up the Serial Monitor at a baud price of 115200. Press the ESP32 “ENABLE/RST” button. It needs to print the material of your.txt file on the Serial Monitor.

ESP32 SPIFFS FS Filesystem Example Arduino IDE Serial Monitor

You’ve efficiently submitted data to the ESP32 filesystem making use of the plugin.

Wrapping Up

Using the filesystem uploader plugin is one of the most convenient methods to post documents to the ESP32 filesystem. Check the complying with task to see exactly how to develop an internet server utilizing HTML and CSS files kept on the filesystem:.

Another means to conserve data permanently is making use of the ESP32 Preferences library. It is particularly useful to conserve information as trick: value pairs in the flash memory. Inspect the adhering to tutorial,