top of page
Writer's pictureRamesh G

ESP8266 SPIFFS Uploader

NodeMCU ESP8266 contains a Serial Peripheral Interface Flash File System (SPIFFS). Here to shows how to easily upload files to the ESP8266 filesystem using a plugin for Arduino IDE.

SPIFFS lets you access the flash chip 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. SPIFFS doesn’t support directories, so everything is saved on a flat structure.

Using SPIFFS with the ESP8266 board is specially 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.

In most of our web server projects, we’ve written the HTML code for the web server as a String directly on the Arduino sketch. With SPIFFS, you can write the HTML and CSS in separated files and save them on the ESP8266 filesystem.


Installing the ESP8266FS-0.4.0.zip

ESP8266FS is a plugin for the Arduino IDE that allows you to upload files directly to the ESP8266 filesystem from a folder in your computer.



Go to the Arduino IDE directory, and open the Tools folder

Unzip the downloaded .zip folder to the Tools folder. You should have a similar folder structure:



Next, restart your Arduino IDE.

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


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


Inside the data folder is where you should put the files you want to be saved into the ESP8266 filesystem. As an example, create a .txt file with some text called test_spiff.

Inside text file, the following text for serial Monitor print. It should be print the content of your .txt file on the Serial Monitor.


arduino Code


In the Arduino IDE, in the Tools menu, select the desired SPIFFS size (this will depend on the size of your files)


Then, to upload the files, in the Arduino IDE, you just need to go to Tools > ESP8266 Sketch Data Upload


You should get a similar message on the debugging window. The files were successfully uploaded to the ESP8266 filesystem.



After uploading, open the Serial Monitor at a baud rate of 115200. Press the ESP8266 “RST” button. It should print the content of your .txt file on the Serial Monitor.

227 views0 comments

Comentários


bottom of page