ESP32: Upload Files to LittleFS making use of Arduino IDE

Table of Contents

ESP32 Upload Files to LittleFS using Arduino IDE

LittleFS is a light-weight filesystem created for microcontrollers that allows you accessibility the flash memory like you would do in a common file system on your computer, yet it’s easier and also extra restricted.

There are a few advantages of using LittleFS over SPIFFS:

Follow the next actions to set up the filesystem uploader if you’re using Windows:

Introducing LittleFS

1) Go to the as well as click the most current esp32fs.zip documents to download.

  • 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.

Installing the Arduino ESP32 filesystem uploader

Follow the next directions if you’re making use of MacOS X.

1) Go to the as well as click the latest esp32fs.zip file to download and install.

Table of Contents

LittleFS is a light-weight filesystem created for microcontrollers that allows you gain access to the flash memory like you would do in a conventional data system on your computer, however it’s easier as well as more limited.

  • LittleFS is optimized for low resource usage and it employs a wear-leveling algorithm that evenly distributes writes across the flash memory, prolonging its lifespan.
  • LittleFS provides faster mount times and file access by utilizing a directory indexing structure.
  • LittleFS minimizes the risk of data corruption during power loss or system failures.
  • LittleFS is under active development.

Windows Instructions

There are a couple of advantages of making use of LittleFS over SPIFFS:

Follow the next steps to install the filesystem uploader if you’re using Windows:

Arduino ESP32 Download Filesystem Uploader Plugin

1) Go to the as well as click the newest esp32fs.zip documents to download and install.

esp32fs file downloaded

Follow the following guidelines if you’re utilizing MacOS X.

Arduino sketchbook location

1) Go to the as well as click the newest esp32fs.zip file to download.

creating tools folder sketchbook folder LittleFS

After publishing, open up the Serial Monitor at a baud price of 115200.

Learn even more concerning the ESP32 utilizing our sources:

<home_dir>/Arduino/tools/ESP32FS/tool/esp32fs.jar
esp32 filesystem tool arduino directory

8) Now, you can open Arduino IDE.

To check if the plugin was successfully installed, open your Arduino IDE and select your ESP32 board. In the Tools menu, check that you have the option “ESP32 Sketch Data Upload“. Click on that option. A window will pop up for you to choose the filesystem you want to use.

ESP32 Filesystem uploader Arduino IDE choose filesystem

As you can see, you have the option to choose from LittleFS, SPIFFS, or FatFS and you can even have the option to erase flash if needed.

Congratulations! You’ve successfully installed the Filesystem uploader plugin for the ESP32 on the Arduino IDE.

Mac OS X Instructions

Follow the next instructions if you’re using MacOS X.

1) Go to the and click the latest esp32fs.zip file to download.

Arduino ESP32 Download Filesystem Uploader Plugin

2) Unpack the files. You should have a folder called esp32fs with a file called esp32fs.jar inside.

3) Create a folder called tools in /Documents/Arduino/ if you haven’t already.

4) Inside the tools folder create another one called ESP32FS.

5) Inside the ESP32FS folder, create a folder called tool. So, the directory structure will look like this:

<home_dir>/Arduino/tools/ESP32FS/tool/

6) Copy the unpacked esp32fs.jar file to the tool directory (if you already have an esp32fs.jar file from a previous plugin, delete it and replace it with the new one). You should have a similar folder structure.

esp32 filesystem tool arduino directory

7) Now, you can open Arduino IDE.

To check if the plugin was successfully installed, open your Arduino IDE and select your ESP32 board. In the Tools menu, check that you have the option “ESP32 Sketch Data Upload“.

ESP32 Data Sketch Upload MACOS X

Click on that option. A window will pop up for you to choose the filesystem you want to use.

ESP32 Filesystem uploader Arduino IDE choose filesystem MAC OS

As you can see, you have the option to choose from LittleFS, SPIFFS, or FatFS and you can even have the option to erase flash if needed.

Congratulations! You’ve successfully installed the Filesystem uploader plugin for the ESP32 on the Arduino IDE.

Uploading Files using the Filesystem Uploader

To upload files to the ESP32 LittleFS filesystem follow the next instructions.

1) Create an Arduino sketch and save it. For demonstration purposes, you can save an empty sketch.

2) Then, open the sketch folder. You can go to Sketch > Show Sketch Folder. The folder where your sketch is saved should open.

Arduino IDE Show Sketch folder to create data folder

3) Inside that folder, create a new folder called data.

ESP32 Arduino Sketch Example File Filesystem fs LittleFS

4) Inside the data folder is where you should put the files you want to save into the ESP32 filesystem. As an example, create a .txt file with some text called test_example.

ESP32 Notepad Test Example File Filesystem fs LittleFS

5) Then, to upload the files, in the Arduino IDE, you just need to go to Tools > ESP32 Sketch Data Upload.

ESP32 Sketch Data Upload Arduino IDE FS Filesystem

6. Select the LittleFS option and click OK.

Filesystem Plugin ESP32 - Choose filesystem

Make sure the Serial Monitor is closed before uploading the files, otherwise, you’ll get an error related to the Serial communication, and the files won’t upload.

The uploader will overwrite anything you had already saved in the filesystem.

Note: in some ESP32 development boards you need to press the on-board BOOT button for around two seconds to upload the files.

The files were successfully uploaded to the ESP32 filesystem when you see the message “LittleFS Image Uploaded“.

Filesystem image Uploaded successfully arduino ide ESP32

Testing the Filesystem Uploader Plugin

Now, let’s just check if the file was actually saved into the ESP32 filesystem. Simply upload the following code to your ESP32 board.

/*********
  Rui Santos
  Complete project details at https://RandomNerdTutorials.com/esp32-littlefs-arduino-ide/
*********/

#include "LittleFS.h"
 
void setup() {
  Serial.begin(115200);
  
  if(!LittleFS.begin()){
    Serial.println("An Error has occurred while mounting SPIFFS");
    return;
  }
  
  File file = LittleFS.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 uploading, open the Serial Monitor at a baud rate of 115200. Press the ESP32 “ENABLE/RST” button. It should print the content of your .txt file on the Serial Monitor.

ESP32 LittleFS Filesystem Example Arduino IDE Serial Monitor

You’ve successfully uploaded files to the ESP32 filesystem using the plugin.

Wrapping Up

In this tutorial, you installed a plugin for the Arduino IDE that allows you to upload files to the ESP32 filesystem. This plugin supports three different filesystems: SPIFFS, LittleFS, and FatFS.

While many libraries and projects are moving to LittleFS, SPIFSS is still used and your previous projects that use SPIFFS should still be working.

Because this new plugin supports both SPIFFS and LittleFS, you should consider installing this one instead of the so that you have more flexibility with the choice of filesystem.

We hope you’ve found this tutorial useful.

Learn more about the ESP32 using our resources: