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 article we’re going to show how to easily upload files to the ESP32 filesystem using a plugin for Arduino IDE.
Using Arduino IDE 2.0? Follow this tutorial instead: Arduino IDE 2: Install ESP32 LittleFS Uploader (Upload Files to the Filesystem)
Note: if you have an ESP8266 board, read: Install ESP8266 NodeMCU LittleFS Filesystem Uploader in Arduino IDE.
If you’re using VS Code with the PlatformIO extension, read the following tutorial instead:
Table of Contents
- Introducing SPIFFS
- Installing the Arduino ESP32 Filesystem Uploader
- Uploading Files using the Filesystem Uploader
- Testing the Uploader
Introducing SPIFFS
SPIFFS lets you access the flash memory like you would do in a normal filesystem in your computer, but simpler and more limited. You can read, write, close, and delete files. At the time of writing this post, SPIFFS doesn’t support directories, so everything is saved on a flat structure.
Using SPIFFS with the ESP32 board 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 and CSS files to build a web server;
- Save images, figures, and icons;
- And much more.
With SPIFFS, you can write the HTML and CSS in separate files and save them on the ESP32 filesystem. Check the following tutorial to learn how to build a web server with files stored on the ESP32 file system:
Installing the Arduino ESP32 Filesystem Uploader
You can create, save and write files to the ESP32 filesystem by writing the code yourself on the Arduino IDE. This is not very 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 allows you to upload files directly to the ESP32 filesystem from a folder on your computer. This makes it really easy and simple to work with files. Let’s install it.
Note: at the time of writing this post, the ESP32 Filesystem Uploader plugin is not supported on Arduino 2.0.
First, make sure you have the ESP32 add-on for the Arduino IDE. If you don’t, follow the next tutorial:
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 ESP32FS-1.0.zip file to download.
2) 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.
3) Go to the sketchbook location, and create a tools folder.
4) Unzip the downloaded .zip folder. Open it and copy the ESP32FS folder to the tools folder you created in the previous step. You should have a similar folder structure:
<Sketchbook-location>/tools/ESP32FS/tool/esp32fs.jar
5) Finally, restart your Arduino IDE.
To check if the plugin was successfully installed, open your Arduino IDE. Select your ESP32 board, go to Tools and check that you have the option “ESP32 Sketch Data Upload“.
MacOS X
Follow the next instructions if you’re using MacOS X.
1) Go to the releases page and click the ESP32FS-1.0.zip file to download.
2) Unpack the files.
3) Create a folder called tools in /Documents/Arduino/.
4) Copy the unpacked ESP32FS folder to the tools directory. You should have a similar folder structure.
~Documents/Arduino/tools/ESP32FS/tool/esp32fs.jar
5) Finally, restart your Arduino IDE.
To check if the plugin was successfully installed, open your Arduino IDE. Select your ESP32 board, go to Tools and check that you have the option “ESP32 Sketch Data Upload“.
Uploading Files using the Filesystem Uploader
To upload files to the ESP32 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.
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 when you see the “Connecting …….____……” message.
The files were successfully uploaded to the ESP32 filesystem when you see the message “SPIFFS Image Uploaded“.
Testing the Uploader
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
*********/
#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 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
Using the filesystem uploader plugin is one of the easiest ways to upload files to the ESP32 filesystem. Check the following project to see how to build a web server using HTML and CSS files stored on the filesystem: ESP32 Web Server using SPIFFS (SPI Flash File System).
Another way to save data permanently is using the ESP32 Preferences library. It is especially useful to save data as key:value pairs in the flash memory. Check the following tutorial:
For more projects with ESP32, check the following resources:
You stated that “After uploading, open the Serial Monitor at a baud rate of 115200. Press the ESP32 “ENABLE” button.”
Just where is this ESP32 “ENABLE” button located?
My sketch does not show any of the test data from the text file. It does print out “File Content:”. But nothing elese.
And even when I deliberately rename the file in the sketch to something else, it does not tell me that “Failed to open file for reading” but still displays “File Content:” with nothing else.
I am using Arduino 1.8.5 on Windows 10
Hi Mark.
The following image shows where the EN button is located: https://i0.wp.com/randomnerdtutorials.com/wp-content/uploads/2018/10/esp32-EN-enable-button.jpg?w=608&ssl=1
Have you successfully uploaded the text file to the ESP32 by going to Tools > ESP32 Sketch Data Upload ? Did you get the “SPIFFS Image Uploaded” message?
Try this sketch that deals with files and see if everything is working well with files on your ESP32: https://github.com/espressif/arduino-esp32/blob/master/libraries/SD/examples/SD_Test/SD_Test.ino
It should create a file, read its content and then delete it.
for me, show this mensage:”SPIFFS Error: esptool not found!”
[ My Ide arduino : 1.8.7]
Hi Sandro.
To be honest, I don’t know why you are getting that error.
That situation was already pointed out on Github yesterday.
Let’s way and see if someone has the answer
https://github.com/espressif/arduino-esp32/issues/2339
Regards,
Sara
Version 0.1 had this problem in me too. Version 1.0 (ESP32FS-1.0.zip) worked great 🙂
instale la actualización para la tarjeta esp32 y ya debe funcionar
You must name the file same as it is displayed in the code, for example, in this code there is written:
File file = SPIFFS.open(“/test_example.txt”);
So you need to call the file as test_example or change the code to the name you want, of course adding .txt .
PD. Do not add the .txt on the file name, just create the file as a text file and name it as you want. The program will understand you are talking about a .txt file.
At first, why can’t I try it? thank you for answer.
Boa tarde!
Será possível através dos SPIFFS controlar os GPIO do ESP32? Ou seja, eu quero gravar um ficheiro de configuração (formato json) onde indico que pinos desejo ler os dados de sensores do meu ESP32, quando ele arrancar vai ler esse ficheiro.
Cumprimentos,
Francisco Pinheiro
Ola Francisco.
Sim, é possível guardar ficheiros no SPIFFS.
Depois de a ESP32 arrancar tem de adicionar todo co código que lê os ficheiros e decide o que fazer.
Só para orientação, temos um tutorial que faz uma página web a partir de ficheiros no SPIFFs (não é relacionado com o que quer fazer, mas pode ajudar a perceber como funciona): https://randomnerdtutorials.com/esp32-web-server-spiffs-spi-flash-file-system/
Também pode ver este tutorial para ver como trabalhar com JSON em arduino IDE: https://randomnerdtutorials.com/decoding-and-encoding-json-with-arduino-or-esp8266/
Cumprimentos,
Sara
So far I haven’t been successful uploading additional files.
SPIFFS.open(“[FilePath]”) always returns true whether or not the file was uploaded.
SPIFFS.exists(“[FilePath]”) return false whether or not the file was included in the /data directory.
Specs
Mac OS 10.14.5
Arduino IDE 1.8.9
On an ESP32
Using Arduino IDE > Tools > Board > ESP32 Dev Module
Hi Carl.
I’ve never faced that issue.
Unfortunately, without further information, it is very difficult to understand what might be wrong.
If anyone knows a solution for this, please help.
Regards,
Sara
Hi Sarah,
I have the same error that Carl describes on July 4, 2019. I am also using the Arduino IDE 1.8.9.
It turned out that adding #include “FS.h” in the example solves the problem.
Greeting,
Dick
This comment is not correct, forget it.
Greeting,
Dick
ok, the information is correct, that it does not work…
Hi: I’m trying to install ESP32 filesystem uploader into the Arduino IDE 1.8.5. I have the esp32fs.jar in this path: Macintosh HD ▸ Users ▸ richardromig ▸ Dropbox ▸ Arduino IDE 1.8.5 ▸ Tools ▸ ESP32FS ▸ tool but the option “ESP32 Sketch Data Upload“ does not appear in the IDE. I am running MacOS 10.14.6 Any suggestions?
yes, I copied-pasted the file esp32fs.jar in creating some folders like this : Macintosh HD ▸ Utilisateurs ▸ MyName ▸ Documents ▸ Arduino ▸ tools ▸ ESP32FS ▸ tool ▸ esp32fs.jar and the option “ESP32 Sketch Data Upload“ appear in the IDE.
macOS Mojave 10.14.6
Very important for linux users! I create in data folder text file. Then I do same, but I dont see file content (nothing wrong, just dont see characters). Then I try to rename file to like this “test_example.txt”. And it works! In linux, mostly txt file is not txt file.
Thank you for sharing that info.
Regards,
Sara
Hi.
Richard , I had the same problem. But creating a Tools folder under the Sketch folder and placing the ESP32FS there did the trick.-Not the first time something like this comes up.
Hi,
great THX from Austria. Solved my problem 🙂
Thanks, I tried all of the other options mentioned and they didn’t work. Yours, however, did work. Many thanks. I’m migrating from Windows to Mac and things are a bit different. I also had to move by library folder into the sketches folder.
I had a problem when I installed the ESP32 filesystem uploader in a new tools folder where all my arduino archives are kept. It didn’t install properly.
However, it worked when I installed the uploader to Local Disk(c:), Program Files(x86), Arduino, tools folder.
Excellent.
Just make sure a data folder is in the same folder as your arduino code.
It works for txt files but do you have a tutorial on reading and displaying a jpg file?
I’ve solved this last problem. I can now read and display jpg file on web browser.
For those who had problem when uploading and got error code :
serial.serialutil.SerialException: could not open port ‘COM3’: WindowsError(5, ‘Access is denied.’)
Turn your serial monitor or plotter off. I hope it helps…
Source : Stupid mistake I made.
This is explained very well, thank you for the tutorial.
Will this work with an ESP8266 as well?
Hi.
Yes. Here’s the tutorial for ESP8266: https://randomnerdtutorials.com/install-esp8266-filesystem-uploader-arduino-ide/
Regards,
Sara
I am having zero luck with this.
I can upload the SPIFFS file the first time and then thereafter I get:
[SPIFFS] data : /Users/davidh/Documents/Arduino/spiffs-check/data
[SPIFFS] start : 2686976
[SPIFFS] size : 1472
[SPIFFS] page : 256
[SPIFFS] block : 4096
/test_example.txt
[SPIFFS] upload : /var/folders/n1/59y24n0j2z128fchsgxh1f5w0000gn/T/arduino_build_804785/spiffs-check.spiffs.bin
[SPIFFS] address: 2686976
[SPIFFS] port : /dev/cu.SLAB_USBtoUART
[SPIFFS] speed : 921600
[SPIFFS] mode : dio
[SPIFFS] freq : 80m
esptool.py v2.6
Serial port /dev/cu.SLAB_USBtoUART
Traceback (most recent call last):
File “esptool.py”, line 2959, in
File “esptool.py”, line 2952, in _main
File “esptool.py”, line 2652, in main
File “esptool.py”, line 222, in init
File “serial/init.py”, line 88, in serial_for_url
File “serial/serialposix.py”, line 268, in open
serial.serialutil.SerialException: [Errno 16] could not open port /dev/cu.SLAB_USBtoUART: [Errno 16] Resource busy: ‘/dev/cu.SLAB_USBtoUART’
Failed to execute script esptool
SPIFFS Upload failed!
If I restart the Arduino application it uploads. However running the SPIFFS read test program always comes up with failed to open file for reading.
So issues with upload and with reading.
Hi David.
Can you take a look at this discussion and see if it helps: https://rntlab.com/question/spiffs-error-esptool-not-found/
See Stéphane answer.
Regards,
Sara
I am not having much luck with the web servers using the SPIFF. I am using Arduino V1.8.13. When I try to include the .zip library ESP32FS-1.0 I always get the error message: “TTGO LoRa32-OLED V1, 80MHz, 921600, None”
“Specified folder/zip file does not contain a valid library”
I am wondering if the LoraESP32 board supports ESP32FS.
Thanks
Hi Brian.
Where are you trying to include the filesystem uploader?
It shouldn’t be in the project folder.
The data folder should be in the project folder.
You’re probably not installing the uploader plugin properly.
Regards,
Sara
1.) I download ESP32FS-1.0.zip
2.) In Arduino IDE, I go to: Sketch -> Include Library-> Add .zip Library
3.) I choose ESP32FS1.0.zip from my download folder.
4.) I get the following error message at the bottom of the IDE:
“Specified folder/zip file does not contain a valid library” with an orange background.
The newer versions of Arduino IDE do not have a Tool folder like the previous versions.
Should I maybe just unzip the ESP32FS-1.0.zip outside of the Arduino IDE and place the .jar file in a Tool folder that I create myself?
Many thanks for your help!
Hi Brian.
I don’t think it should be installed in that way. But you can try it.
I think you may need to install the Arduino version that comes with a .zip file: https://downloads.arduino.cc/arduino-1.8.13-windows.zip
And then, follow our instructions to install the filesystem.
Regards,
sara
Hello Sara,
Thank you very much for this tutorial and it worked well for me, but when I opened the serial monitor, after the sketch had been down loaded, it was blank. However, I realized that the text had been and gone before I opened the monitor and I just pressed the reset button on the ESP32 board and up came the text as you specified. I wonder is this would be of help to the gentleman who seemed to have similar problems.
I was so pleased that this worked for me as yesterday evening I had been trying for hours to try and get LittleFS working without success and I spotted your tutorial, like a life belt to a drowning man.
Kindest regards
Adrian
Hi.
Yes, that’s normal because the text is printed in the setup().
So, you need to press the RST button to be able to see it.
We have a tutorial about LittleFS with the ESP8266 with VSCode + PlatformIO: https://randomnerdtutorials.com/esp8266-nodemcu-vs-code-platformio-littlefs/
Regards,
Sara
Hi Rui and Sara,
A slight word of warning/note: The uploader will overwrite anything you had already saved in the filesystem. For me, not a big deal since it was just some test files for an ESP32-based shell/file editor I’ve been working on. But in a production environment where I might be saving config files and runtime data, this would be an issue.
You might wish to note this in the text of the tutorial (unless I missed it!!).
Steve
Yes, you are right.
Thanks for the warning.
I’ve added a note about that.
Regards,
Sara
For those who struggling on Mac.
Make a folder, “tools” inside Arduino directory.
Then, move downloaded folder to “tools” folder
Finally, you should change the the name of the folder from “ESP32FS 2” to “ESP32Fs”.
Now, you may find “ESP32 Sketch Data Upload” at the tools bar.
sorry the folder name should be changed to “ESP32FS”, not “ESP32Fs”.
saved my day, thank you
Hi Rui et al,
Great project!
I’m quite new in the field, please help me out:
I’m getting the “expected unqualified-id before ‘<‘ token
” error while trying to compile the code, line 23 ().
Where should I dig?
Regards,
Th.
Hi.
that is a syntax error.
Double-check that you have copied the complete code and that you haven’t inserted any character by mistake.
Regards,
Sara
Thank you. I looked at many sites for instructions for installing “Sketch Data Upload” plugins. This is the only site that gave the correct folder location for Windows 10. Thanks again. You are always the best source for information about ESP devices.
Thanks 🙂
Hi Rui and Sara,
Very good your tutorial on ElegantOTA library. Congratulations!
I wonder if there is any way or library to do a remote update, that is, I am in one place and ESP32 is in another.
Hi.
You can check IoTAppStory: https://iotappstory.com/
Regards,
Sara
Hello Sara,
I appreciate your prompt reply.
I will check carefully,
Regards,
Rubens
Am getting this error on esp32
“SPIFFS Not Supported on avr
Hi.
Make sure you have an ESP32 board selected in Tools > Board.
Regards,
Sara
Thanks. solved
I have a SPIFFS based webserver (based in your post on that).
I want to and a settings file to store wifi crefentials etc. But if I do that next time I upload the SPIFFS image I loose all settings stored on my settings file. Is there a way to keep the settings?
Hi.
Yes.
I recommend using the Preferences library.
We even have a tutorial showing how to save and read Wi-Fi credentials.
I think this post is exactly what you are looking for: https://randomnerdtutorials.com/esp32-save-data-permanently-preferences/
Regards,
Sara
I was able to do this to get SPIFFS working, but I was hoping that it could show how to log a temperature and light (LDR) reading or some couple of sensors.
if you are going to do a follow-up, the next step would be data logging to SPIFFS
Hi Dave.
Thanks for the suggestion.
We have these data logging tutorials for the SD card (not SPIFFS), but it is similar:
– https://randomnerdtutorials.com/esp32-data-logging-temperature-to-microsd-card/
– https://randomnerdtutorials.com/esp32-microsd-card-arduino/
Regards,
Sara
I’m stuck ar this step:
“3) Unzip the downloaded .zip folder to the Tools folder. You should have a similar folder structure:
/Arduino-/tools/ESP32FS/tool/esp32fs.jar”
There’s no “tools” folder in Arduino for Mac.
Where should it be placed then?
Hi.
On the OS X create the tools directory in ~/Documents/Arduino/ and unpack the files there.
Regards,
Sara
Thank you Sara.
But it didn’t work.
In fact, I’ve found only one file within this zip: “/ESP32FS/tool/esp32fs.jar”.
I’ve placed it in “~Documents/Arduino//ESP32FS/tool/esp32fs.jar”.
I’ve restarted Arduino IDE and no “ESP32 Sketch Data Upload” appears in Tools menu.
Is it suitable for Arduino IDE 2.0?
Thank you.
Regards
Hi.
Unfortunately, this doesn’t work with Arduino 2.0.
Regards,
Sara
Thank you, Sara.
It seems that there won’t be any support to that in Arduino IDE 2.0.
https://forum.arduino.cc/t/tool-to-upload-data-to-spiffs-is-missing/699986
Regards
Hi,
I have installed Arduino 1.8.15. Then installed the ESP32FS downloaded from https://github.com/me-no-dev/arduino-esp32fs-plugin/releases/ website and placed under C:\Program Files (x86)\Arduino\tools folder. After that I was able to see “ESP32 Sketch Data Upload” in my tools menu of IDE. But when I click there I get “SPIFFS Error: esptool not found!”
My sketch folder is “C:\Users\jinda\OneDrive\Documents\Arduino\hardware\heltec\IRserver3” As I was reading the comments I tried putting the ESP32FS under the tools folder under IRserver3 but it still didn’t work. Any help please?
Hi.
I’m not sure what is causing that error.
See this discussion, it might help: https://github.com/me-no-dev/arduino-esp32fs-plugin/issues/15
Regards,
Sara
Thanks a lot Sara. My esptool.exe was in the esptool folder, I took it out to the same location as esptool.py then it worked.
Great!
I’m glad you solved the issue.
Regards,
Sara
I have Arduino IDE 1.8.16 from the Windows Store, not the version from Arduino website. I cannot locate the “Tools” folder anywhere to copy the plugin into. I am running latest update of Windows 10.
Have checked /AppData/Local (no Arduino folders at all here), same for AppData/Roaming
Have checked the Sketchbook location and the ArduinoData folder that sits next to that. Nowhere do I have a Tools folder!
Has anyone else encountered this or have a solution as to where to copy the plugin for this version of the Arduino IDE?
Hi.
That version of Arduino IDE, doesn’t have the Tools folder.
You need the .ZIP folder version of Arduino from the Arduino website: https://www.arduino.cc/en/software
Regards,
Sara
Perfect. Reinstalled from Arduino website and now I can have the tools folder, and the Data Uploader appears in the Tools menu in the IDE.
Unable to actually do the upload however, as I get “SPIFFS Error: serial port not defined!” popping up as an error. I am using an AiThinker ESP32Cam board, which of course does not have a direct USB connection, and I think this might be the cause of the issue.
Have you found a way to upload to SPIFFS on one of these ESP32Cam boards?
I’ve never been able to get serial monitor to work with one of these ESP32Cam boards (but have with other ESP32 boards that have direct USB), so I’m wondering if there is a clever way to get Arduino IDE to recognise serial connection that would also enable upload to SPIFFS on an ESP32Cam?
Progress – managed to get SPIFFS upload to start but, it only gets as far as “Connecting…..___…..” then “A fatal error occured: Failed to connect to ESP32: Timed out waiting for packet header” then “SPIFFS Upload Failed”
I discovered that other ESP32 boards have way more options in the tools menu than the AIThinker ESP32Cam has (like partition scheme for example). So as a test, I swapped from ESP32Cam to Wrover, then back again, and for some reason that allowed the serial port error to go away.
Hi.
When you see the dots on the debugging window ….___….____ press the on-board RST button and it will upload the spiffs image.
To be able to see the Serial Monitor, you must disconnect GPIO 0 from GND after uploading the code.
Regards,
Sara
Thanks Sara – that has been an awesome help. Fixed two issues at once! When my project is complete I’ll send through the details. Have really enjoyed the tutorials, e-books and courses that you and Rui have made available.
That’s great!
I’m glad you enjoy our tutorials.
Regards,
Sara
Hi,
Thank you for the tutorial. I has been many learning from your tutorial.
I have problem related ESP32 Sketch Data Upload plugin. Is it available for ubuntu 20.04 arduino ide?
Thank you very much.
Hendry
Hi.
I think you can install it in Ubuntu (but I never tried it).
https://github.com/me-no-dev/arduino-esp32fs-plugin#installation
Regards,
Sara
Hi Sara
Thanks a lot for those tutos and help you provide for all of us, you website is a reference to me before starting anything with ESP chip.
I am under Win10 and Arduino 1.8.13
I follow your instructions and createa tools folder before uncompressing the uploader and it works but:
Now I am trying to upload on a ESP32-C3 dev module then got error message :
esptool.py v3.1
Serial port COM11
Connecting….
A fatal error occurred: This chip is ESP32-C3 not ESP32. Wrong –chip argument?
SPIFFS Upload failed!
Of course I check my setup to confirm I select the right chip in tools board selection
Do you know if there is an other way to specify chip argument ?
Hi.
I haven’t experimented with ESP32-C3. From that error, it seems it is not compatible with the current ESP32 board’s add-on.
You need a different installation for that board.
Go to File > Preferences and copy the following link to the “Additional Boards Manager URLs”:
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_dev_index.json
Then, click ok.
Then go to Tools > Board > Boards Manager
In the Boards Manager, search esp32 by Espressif Systems. Install the latest 2.0.0 version
Now, once the installation is complete, you can see the ESP32C3 Dev Module in Tools > Board. Select it and try to upload code again.
I don’t know if code for ESP32 is compatible with ESP32-C3.
Regardsm
Sara
Orginal data uploader didn’t work for ESP32-C3 you have to install a forked one for that you can find here : https://github.com/lorol/arduino-esp32fs-plugin/releases
On ESP32 dev kit V1 i made also this at start of sketch : #include “FS.h”
I have made a SPIFF manager where you can also transfer files from ESP32 to PC via Serial in binary mode, so your file/image is converted in Hex, copy this output on serial monitor and paste in a Notepad++, in Plugins/Converter of Notepad++ you see HEX to ASCII converter, use it and save result with original extension (so .bmp or .png ecc…), in this mode, if you save screenshots of ESP32 to SPIFF you can also transfer to PC (i am working for save display buffer, but various solutions online not work on my Ili9488 touch screen….need more work)
https://pastebin.com/BtCCj5Gg
Hello Sara.
Your are my ESP32-Hero’s !! For each project i take a look at your website for technical support and knowledge. Mostly I find the anwsers on your website. But now I have a question about this subject SPIFFS. In the example you show Serial.write(file.read()); But how can I read a couple characters or read a line from the file and bring this into a variable or string ? Or did I miss this little part of the story ? Greetings Abraham.
Hi.
At the moment, we don’t have any tutorials about different ways to handle files.
You can use a function like the following, for example, that returns the first line written in a file:
String readFile(fs::FS &fs, const char * path){
Serial.printf(“Reading file: %s\r\n”, path);
File file = fs.open(path);
if(!file || file.isDirectory()){
Serial.println(“- failed to open file for reading”);
return String();
}
String fileContent;
while(file.available()){
fileContent = file.readStringUntil(‘\n’);
break;
}
return fileContent;
}
Just pass SPIFFS as the first argument and the filepath as a second argument to that function.
Regards,
Sara
Hi,
Do you know of any way to upload data files to SPIFFS on ESP32-S2 based boards? “ESP32 Sketch Data Upload” in the Arduino IDE errors out when it finds the ESP32-S2 is being used.
Any thoughts or suggestions would be appreciated.
Thanks,
Bill
You need close serial monitor
Hello, thanks for the great tutorial.
I need to use SPIFFS on an external FLASH chip on a custom board based on an ESP32 pico. How could I do it?
And if the uploader mentioned above to put under “Tools” doesn’t support external FLASH (only internal I guess), how should I upload the files? Do I have to create a custom partition? I don’t know how to tell SPIFFS to search from the extended memory.
Thank you
You mean SD ?
is many example and also some external library for manage em
No I mean a second FLASH chip that I add to a custom PCB where the ESP32 is mounted on. So I would like to upload with the tool my files to the second FLASH memory in SPIFFS, not the internal one on the ESP32.
Hi Fab,
I Hope this message will find you well.
I’ve been looking for hours(days!) for an answer of the question you have asked with no success.
So i take the chance, since january you have found a way to do that(upload data to external chip) and maybe you will receive a notification from this website… Fred.
SPIFFS doesn’t seem to be supported anymore. I am new to this so figuring it out with littleffs is a bit over my head 🙁
Hi.
Why do you say that? You can install it and use it.
You just need to follow the steps.
Regards,
Sara
there is no tools folder in my arduino folder please help me
Hi.
Try to unzip the esp32fs.jar file containing the plugin in Sketchbook location > tools > ESP32FS > tool folder.
The Sketchbook location folder is defined in the Arduino IDE, by selecting File > Preferences.
If the Arduino IDE is open, then Arduino IDE must be closed and restarted, and the Tools menu will then include the SP32 Sketch Data Upload option.
Regards,
Sara
When uploading the sketch data, the serial monitor window should NOT be open.
Otherwise, there will be an error message stating that the upload failed. I spent some time googling for the info.
Perhaps this post should be amended with such a warning for newbies.
Not sure if anyone else encountered the same problem. Thought I just share the info.
Otherwise, this was an enjoyable project.
Hi Sara,
As always, the tutorials on your site are the best!
When I first saw Rui’s newsletter email I thought it was going to be for an html based files system. No worries, I found what I needed. However I do want to mention I use a file upload function on my website. It really makes it handy to upload specific files via Wi-Fi, only one at a time, when making small changes to a webpage or a saved variable. Or as in my case, a JSON data file.
Hi.
Is there a stand alone way tooad files on to the spiff drive and retrieve them without using the IDE or a Web interface.
I am looking at how to have someone load their own data on to the SPIFF after I have programmed it for them.
Hi.
I’m sorry, but I’m not familiar with something that does that.
Regards,
Sara
If you want upload and download from SPIFFS is more simple use a FTP server and a external FTP on PC (for example Total Commander with Local IP set and username/password same of Esp32) how show this example:
#include <WiFi.h>
#include “SPIFFS.h”
#include <SimpleFTPServer.h>/* https://www.mischianti.org/it/2020/02/08/server-ftp-su-esp8266-ed-esp32/ */
const char* ssid = “WIFI SSID”;
const char* password =”WIFI Password”;
FtpServer ftpSrv; //set #define FTP_DEBUG in ESP8266FtpServer.h to see ftp verbose on serial
void setup(void){
Serial.begin(115200);
WiFi.begin(ssid, password);
Serial.println(“”);
// Wait for connection
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(“.”);
}
Serial.println(“”);
Serial.print(“Connected to “);
Serial.println(ssid);
Serial.print(“IP address: “);
Serial.println(WiFi.localIP());
/////FTP Setup, ensure SPIFFS is started before ftp; /////////
if (SPIFFS.begin(true)) {
Serial.println(“SPIFFS opened!”);
ftpSrv.begin(“Esp32″,”Esp32”); //username, password for ftp. set ports in ESP8266FtpServer.h (default 21, 50009 for PASV)
}
}
void loop(void){
ftpSrv.handleFTP(); //make sure in loop you call handleFTP()!!
}
HI and thanks.
The people I am targetting are very non-computer.. So Telling them to set up their ESP32 for their Wifi is going to be beyond them.
Think of it this way. An analogy..
I am making a Photo shower using an ESP32 I want the end users to be able to add their own photos. I want to save costs on not having an SD card so the SPIFFS or the LITLTEFS would be ideal as an SD reader and an SD Card could add about $5 to the values.
But an application that can talk to the ESP32 via a serial port would be much easier.
Many thanks for replying
Dave
Dave, if you setup a webserver you can create a webpage to upload files. Search out littlefs file manager and fine tune to your needs. There is limited space so they might need to remove files to make room for new files.
On the SPIFFS you can fit only 3-5 Jpg images…you need use a SD for more
Great!
Thanks for sharing.
Regards,
Sara
SPIFFS is deprecated
Replaced by LittleFS. That’s what you should be talking up, not SPIFFS.
Hi.
SPIFFS is only deprecated for the ESP8266.
Regards,
Sara
i am useing esp-12s board
showing error
SPIFFS Not Supported on esp8266
For ESP8266, follow this tutorial instead: https://randomnerdtutorials.com/install-esp8266-nodemcu-littlefs-arduino/
Im desperately trying to adopt v2.0 of the arduino ide but have been running into the issue of no spiffs upload tool support yet. Is there any possible way to invoke the spiffs upload tool from the command line such as how you can invoke the espytool uploader from the command line really easily?
Hi.
This feature is not yet supported on Arduino 2.0.
For more information, you can check this discussion: https://rntlab.com/question/esp32-data-files-upload-need-to-see-the-command/
Regards,
Sara
After upgrading to the 2.0 Ide and losing the ability to upload to SPIFFS, I just use the 1.8.13 version I have in a different directory. You can have both on your computer at the same time.
I just make a directory structure in the older version with the correct format:
arduino-1.8.13/sketchbook/this_sketch_name/data/files_to_upload
Be sure to have the board you are using installed in the 1.8.13 version, and the addon ESP32FS tool explained in this post.
Use this to upload the files to SPIFFS, then go back to the 2.0 ide to upload your sketch.
It’s a hack, but works until there is a better solution.
Thank you for the great tutorials.
Is there any alternative library to ESP32FS that can be used with IDE 2.0?
ESP32FS has not be updated in 4 years.
At the moment, there isn’t.
Regards,
Sara
i used this tool on ESP32 a few years ago – i was hugely impressed.
I went to load it on again, but the tutorial using SPIFFS is well out of date and misleading.
Any chance of updating it to include littleFS or FTP or whatever the current solution is ?
I just put a bunch of thermometers around my hot water cylinder – this app would have been perfect !!
Thanks in advance.
Hi.
What do you mean by “misleading”? Which step of the tutorial did not work?
SPIFFS still works on the ESP32. At least the last time I tried it, it was still working just fine.
If you’re using an ESP8266, we have a tutorial for the ESP8266 with SPIFFS: https://randomnerdtutorials.com/install-esp8266-nodemcu-littlefs-arduino/
Regards,
Sara
Hi Sara,
Thanks for the instructions, unfortunately it fails for me (ESP32 WROOM):
[SPIFFS] data : /home/iot/Cloud/Arduino/Basic/SPIFFS/data
[SPIFFS] start : 2686976
[SPIFFS] size : 1472
[SPIFFS] page : 256
[SPIFFS] block : 4096
/Example.txt
[SPIFFS] upload : /tmp/arduino_build_122560/SPIFFS.spiffs.bin
[SPIFFS] address: 2686976
[SPIFFS] port : /dev/ttyUSB0
[SPIFFS] speed : 921600
[SPIFFS] mode : dio
[SPIFFS] freq : 80m
SPIFFS Upload failed!
I am using the Ubuntu OS, do you know if I have to anything different for Linux?
Thanks
Hi.
Try selecting another board “ESP32 Dev Module”.
Let me know if that solves the issue.
Regards,
Sara
Hi, can you please advise
I uploaded Data the sketch
Everything appeared to be correct
However the ESP32 failed to reconnect as server and did not appear on the connected WiFi
Com5 message:
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1216
ho 0 tail 12 room 4
load:0x40078000,len:10944
load:0x40080400,len:6388
entry 0x400806b4
ets Jun 8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1216
ho 0 tail 12 room 4
load:0x40078000,len:10944
load:0x40080400,len:6388
entry 0x400806b4
E (65) psram: PSRAM ID read error: 0xffffffff
SPIFFS mounted successfully
Reading file: /ssid.txt
Reading file: /pass.txt
Reading file: /ip.txt
Reading file: /gateway.txt
Wilsons
i9a1n123
192.168.1.200
192.168.0.1
Connecting to WiFi…
192.168.1.200
Settings:
Flash frequency “80 Mhz”, Flash mode “QIO”, Flash size “4Mb”,
Partition scheme “Default 4 Mb with spiffss (1.2 mb APP/ 1.5 mb spiffs)”, PSRAM “Enabled”
Is the spiffs only incompatible with version 2.0 or 2.0 and all thereafter?
All 2 versions.
Regards,
Sara
Is it possible to access the file in ESP-32 SPIFFS from same network? Thinking to write file from ESP-32 and read from outside ESP-32. Possible? Thanks
If you are facing problem of getting just “File Content:” words on Serial, try given code placed on my GitHub, I did nothing just modified the inbuild example code named by “SPIFFS”.
https://github.com/my-dudhwala/Read_SPIFFS/tree/main
I’m trying to test this and others examples but the Arduino IDE take almost 20min to Compile the Sketch. It’s happen with somebody here?
I just came here for a possible next project.
My (first) problem is that I can not have the IDE (v.2.2.1) to detect the tools.
I hopefully followed step-by-step your instructions and the file is located at:
D:\Arduino\Sketches\tools\ESP32FS\tool\esp32fs.jar
Restarting IDE the option ‘“ESP32 Sketch Data Upload“.’ never appears.
I’m using an ESP32 Mini D1
Hi.
As mentioned at the beginning of the tutorial, this is not compatible with Arduino IDE version 2.
Regards,
Sara
As the ESP32 Filesystem Uploader plugin is not supported on Arduino 2.0, temperature cannot update to data file. Is this maybe fixed in between? Maybe with Arduino 2.2?
Hi.
Unfortunately, there isn’t yet a way to upload via Arduino 2.
You can use Arduino 1.8.x, VS Code or the command line.
Check this discussion: forum.arduino.cc/t/using-the-filesystem-spiffs-with-arduino-ide-2-0-x-is-problematic/1162671/3
Regards,
Sara
is there away to use IDE 2.3
Hi.
Yes-.
Check this tutorial: https://randomnerdtutorials.com/arduino-ide-2-install-esp32-littlefs/
Regards,
Sara
Thank you, from different places and at different times who made the same stupid mistakes
Is there any reliable software for the ESP8266 or ESP32 that can flash the ESP using FTDI with a .bin file, control the DTR, CTS, and RTS pins, easily upload files to the ESP, and view the serial monitor?