In this guide, you’ll learn how to upload files to the ESP32 Filesystem (LittleFS) by using a plugin for Arduino IDE (1.8.X). LittleFS is a lightweight filesystem created for microcontrollers that lets you access the flash memory like you would do in a standard file system on your computer, but simpler and more limited. The plugin we’ll install lets you use three different filesystems: LittleFS, SPIFFS, or FatFS.
Using Arduino IDE 2? Follow this tutorial instead: Arduino IDE 2: Install ESP32 LittleFS Uploader (Upload Files to the Filesystem)
If you want to use LittleFS with the ESP8266, read: Install ESP8266 NodeMCU LittleFS Filesystem Uploader in Arduino IDE.
Table of Contents
- Introducing LittleFS
- Installing the Arduino ESP32 filesystem uploader
- Uploading Files to ESP32 LittleFS using the Filesystem Uploader
- Testing the ESP32 Filesystem Uploader
Introducing LittleFS
LittleFS is a lightweight filesystem created for microcontrollers that lets you access the flash memory like you would do in a standard file system on your computer, but it’s simpler and more limited. You can read, write, close, and delete files. Using a filesystem with the ESP32 boards is especially useful to:
- Create configuration files with settings;
- Save data permanently;
- Create files to save small amounts of data instead of using a microSD card;
- Save HTML, CSS, and JavaScript files to build a web server;
- Save images, figures, and icons;
- And much more.
Installing the Arduino ESP32 filesystem uploader
Currently, there is a plugin for the Arduino IDE (version 1.8.X) that allows you to pack and upload files to the SPIFFS, LittleFS, or FatFS filesystem image in the ESP32 filesystem.
Note: in most of our projects we use SPIFFS for the ESP32 filesystem. It’s still compatible with the ESP32, and you can use SPIFFS without any issues. However, currently, many libraries are moving to LittleFS.
The plugin we’ll install is both compatible with SPIFFS and LittleFS. So, it’s an advantage over the older plugin and you can still use SPIFFS.
There are a few advantages of using LittleFS over SPIFFS:
- 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
Follow the next steps to install the filesystem uploader if you’re using Windows:
1) Go to the releases page and click the latest esp32fs.zip file to download.
2) Unzip the downloaded file. You should have a folder called esp32fs with a file called esp32fs.jar inside.
3) Find your Sketchbook location. In your Arduino IDE, go to File > Preferences and check your Sketchbook location. In my case, it’s in the following path: C:\Users\sarin\Documents\Arduino.
4) Go to the sketchbook location, and create a tools folder if you don’t have it already (make sure that the Arduino IDE application is closed).
5) Inside the tools folder, create another folder called ESP32FS if you haven’t already.
6) Inside the ESP32FS folder, create a folder called tool.
7) Copy the esp32fs.jar file to the tool folder (if you already have an esp32fs.jar file from a previous plugin, delete it and replace it with the new one). So, the directory structure will look like this:
<home_dir>/Arduino/tools/ESP32FS/tool/esp32fs.jar
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.
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 releases page and click the latest esp32fs.zip file to download.
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.
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“.
Click on that option. A window will pop up for you to choose the filesystem you want to use.
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.
3) Inside that folder, create a new folder called data.
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.
5) Then, to upload the files, in the Arduino IDE, you just need to go to Tools > ESP32 Sketch Data Upload.
6. Select the LittleFS option and click OK.
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“.
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 & Sara Santos - Random Nerd Tutorials
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.
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 SPIFFS plugin 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:
hi may i know is that possibility esp32 connect to TFT DISPLAY LCD ?
what is the pinout ? library code ?
Como fazo para substitur os
SPIFFS por LittleFS?
Obrigado!
Olá.
É só preciso substituir no código a palavra “SPIFFS” por “LittleFS”.
Cumprimentos,
Sara
Obrigado, Sara!
Thank You!
Obrigado!
Gracias!
I get the error “LittleFS Not Supported on esp32”. Any fix?
Hi.
What ESP32 board model are you using?
Check the version of the ESP32 core you have installed. Go to Tools > Board > Boards Manager, search for ESP32 and check the version you have installed. You may need to upgrade.
Regards,
Sara
Hi Rui
I tried your HOWTO to set up the littlefs-Fileuploader in Arduino IDE 1.X. I can follow it easily (thank you very much!), but as soon as I click on LITTLEFS in the step 6 for Mac, I get an error:
Arduino: 1.8.16 (Mac OS X), Board: “LOLIN D32, Default, 80MHz, 921600, None, Disabled”
Chip : esp32
Using partition scheme from Arduino IDE.
Start: 0x290000
Size : 0x160000
mklittlefs : /Users/toddd/Library/Arduino15/packages/esp32/tools/mklittlefs/3.0.0-gnu12-dc7f933/mklittlefs
Error: esptool not found!
Can you please point out to me where I would have to get this esptool? I used to be able to upload to SPIFFS, but now, no upload at all seems to be working.
Tank you very much, Dani
Hi.
What’s the version of the ESP32 board you have installed? Tools > Board > Boards Manager, Search for ESP32 and check the version. Update to the newest version and see if it fixes the issue.
Regards,
Sara
Hi,
Thanks for the tutorial!
For some reason I’m not getting “Filesystem” selection popup when I click “ESP32 Sketch Data Upload”, it just uploads right away (and I think SPIFFS is used by default).
Tried latest (1.1) and previous version of the plugin.
board – eps32
arduino – 1.8.19
Hi.
Make sure you don’t have the old SPIFFS file.
Only this new one https://github.com/lorol/arduino-esp32fs-plugin/releases
Regards,
Sara
Hi!
Do you mean “partition csv” file? If so – I don’t have one in sketch folder.
BR,
ked
No. I mean the .jar file.
Regards,
Sara
Hi,
I have read this manual. Thanks for it. Is it possible that it will not work with the latest OSX from Apple (Ventura). When I loop trough your instructions no fs is visual iin my ide. I use the ESP32 touchdown (Dutch vendor) with and esp32 dev on board.
Cheers,
Jan (NL)
Arduino IDE 2.2.1 now supports LittleFS data uploads
https://github.com/earlephilhower/arduino-littlefs-upload
Steve (UK)
Great.
Thanks for sharing.
I need to test this new feature.
Regards,
Sara
Done a bit more with this LittleFS for IDE 2.2.1
It does NOT work with ESP 32
To get it to work with ESP8266 seems a “faf” and needs updating maybe waiting for 2.3?
How to use this sir? thankyou
Hi,
is it possible to use this “esp32fs.jar” on Raspberry Pi?
Where in the file system should I upload it?
Hi.
What do you mean?
Are you running Arduino IDE on a Raspberry Pi?
regards,
Sara
Hi and thanks for this solution.
I installed the .jar file, i have the option into the Tools> menu but, when I select to upload the files, i have no “Select the LittleFS” option!
ArduinoIDE 1.8.x and everything else is OK…
Hi.
Maybe you installed a different jar file.
Make sure it is the one from the link we provide in the tutorial:
https://github.com/lorol/arduino-esp32fs-plugin/releases
Regards,
Sara
Hello
As there is no partition scheme to select 16mb littlefs for my esp32 s3 dev module, I wonder how I can use 16mb to upload files? I tried uploading some png files which have max 2mb in total but I always get message that there is not enough space. I tried different available schemes but no success.
Thanks a lot for an helpful hint.
Boris
Hi.
Try selecting ESP32 dev module and then the partition scheme. I’m not sure if it will compile because you have an s3, but try it out.
Regards,
Sara
I’m sorry, this does not work for me.
Last year I installed littleFS for the ESP8266 and it worked. (With IDE 1.8) Now I have followed the instructions and created the folder structure for ESP32fs and copied the ESP32fs.jar into it and the IDE does not see it as an option. I have tried everything from restarting the computer after every change to opening Tools while a sketch is selected that has a data folder in the sketch folder.
It goes without saying that the ESP8266LittleFS is not available in IDE 2.3.3 so the Tools/”Partition scheme…” choices are sometimes greyed out.
I’m using IDE 2.3.3 and 1.8 to program an ESP-WROOM-32 -it uploads sketches when selected as “ESP32 Dev Kit” OR “ESP32-WROOM-DA Module”.
I am having lots of problems and while I have plenty of time being retired, it is all wasted time and very frustrating. Any suggestions on how to force the IDE to do what it should?
Hi.
There is LittleFS support for ESP8266. See it here:https://randomnerdtutorials.com/arduino-ide-2-install-esp8266-littlefs/
Double-check your folder structure.
It is working just fine for me.
Regards,
Sara