Install ESP8266 LittleFS Filesystem Uploader in Arduino IDE

In this article, you'll learn how to use the Arduino IDE to install the ESP8266 LittleFS Filesystem Uploader Plugin and upload files to the ESP8266 NodeMCU filesystem.

Follow the next tutorial instead if you want to use LittleFS with VS Code and PlatformIO:

ESP8266 NodeMCU with VS Code and PlatformIO: Upload Files to Filesystem (LittleFS)

Introducing LittleFS

LittleFS is a lightweight filesystem designed for microcontrollers that allows you to access flash memory in the same way that you would on a computer's standard file system, although it is simpler and more constrained. Files may be viewed, written, closed, and deleted. Using LittleFS with ESP8266 boards is particularly useful for:

  • 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 LittleFS Filesystem Uploader Plugin

By writing your code in the Arduino IDE, you may create, save, and write files to the ESP8266 filesystem. This isn't useful since you'd have to type the contents of your files into the Arduino program.

Fortunately, there is an Arduino IDE plugin that enables you to upload files straight from a folder on your computer to the ESP8266 LittleFS filesystem. This makes working with files simple.

SPIFFS is presently deprecated and may be removed in future ESP8266 core releases. LittleFS is recommended in its place. LittleFS is actively developed, supports directories, and is quicker for the majority of tasks. Because the SPIFFS methods are compatible with LittleFS, we can simply use the term LittleFS in our code instead of SPIFFS.

Windows Instructions

Follow the next steps to install Install ESP8266 LittleFS Filesystem Uploader if you’re using Windows:

1) Go to the releases page and click the ESP8266LittleFS-X.zip file to download.

ESP8266 LittleFS Download

2) Find the location of your sketchbook. Check the location of your sketchbook in your Arduino IDE's File > Preferences menu. It follows the following path in my case:

C:\Users\sarin\Documents\Arduino.
Arduino sketchbook location

3) Go to the sketchbook location and create a tools folder.

creating tools folder sketchbook folder SPIFFS

4) Unzip the .zip folder that you downloaded. Copy the ESP8266LittleFS folder to the tools folder you created in the previous step. You should have a folder structure that is similar to mine.

<Sketchbook-location>/tools/ESP8266FS/tool/esp8266fs.jar
install LittleFS filesystem plugin ESP8266 folder structure

5) Finally, restart your Arduino IDE.

Open your Arduino IDE and select your ESP8266 board to check whether the plugin was installed successfully. Check that the “ESP8266 LittleFS Data Upload” option is there in the Tools menu.

ESP8266 Tools LittleFS Data Upload Arduino IDE

Mac OS X Instructions

If you're using Mac OS X, follow the next steps to install the filesystem uploader:

1) Go to the releases page and click the ESP8266LittleFS-X.zip file to download.

ESP8266 LittleFS Download

2) Unpack the files.

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

4) The unpacked ESP8266LitlteFS folder should be copied to the tools directory. You should have a folder structure that is similar to mine.

install ESP8266 LittleFS filesystem plugin folder structure mac os X
~Documents/Arduino/tools/ESP8266FS/tool/esp8266fs.jar

5) Finally, restart your Arduino IDE.

Open your Arduino IDE to check whether the plugin was installed successfully. Select your ESP32 board, then go to Tools and make sure you have the option “ESP8266 LittleFS Data Upload” checked.

ESP8266 LittleFS Data Upload Mac OS X

Uploading files to the ESP8266 using the Filesystem Uploader

To upload files to the ESP8266 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.

Arduino Sketch Data Folder

4) Put the files you want to save to the ESP8266 file system within the data folder. Create a .txt file with some text named “test_example” as an example.

Example txt file ESP8266

5) Select the desired flash size in the Arduino IDE's Tools menu (this will depend on the size of your files).

ESP8266 Select Flash Size Arduino IDE

6) You just need to go to Tools > ESP8266 LittleFS Data Upload in the Arduino IDE to upload the files.

Important: ensure the Serial Monitor is closed. Otherwise, the upload will fail.

ESP8266 Tools LittleFS Data Upload Arduino IDE

You should see the message “LittleFS Image Uploaded” within a few seconds. The files were successfully uploaded to the filesystem of the ESP8266.

ESP8266 LittleFS Image Uploaded Success

Testing the ESP8266 LittleFS Uploader

Now check to see whether the file was saved to the ESP8266 filesystem on your ESP8266 board and upload the following code:

#include "LittleFS.h"
 
void setup() {
  Serial.begin(115200);
  
  if(!LittleFS.begin()){
    Serial.println("An Error has occurred while mounting LittleFS");
    return;
  }
  
  File file = LittleFS.open("/test_example.txt", "r");
  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 115200 baud rate. On the ESP8266, press the “RST” button. The contents of your.txt file should be printed on the Serial Monitor.

Testing ESP8266 LittleFS Serial Monitor

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

Conclusion

One of the simplest ways to upload files to the ESP8266 filesystem is to use the filesystem uploader plugin. We've shown you how to upload a .txt file in this tutorial, but you may also upload HTML, CSS, and Javascript files to construct a web server, photos or tiny icons, save configuration files, and so on.

We have a project example where we create a web server using HTML and CSS files stored on the file system (simply replace SPIFFS with LittleFS).

We hope you find this tutorial useful. Thanks for reading.

Oh hi there It’s nice to meet you.

Sign up to receive awesome content in your inbox, every month.

We don’t spam! Read our privacy policy for more info.

Leave a Reply

Your email address will not be published. Required fields are marked *

ESP8266 Home Automation Projects

Leverage the power of this tiny WiFi chip to build exciting smart home projects