ESP8266 (FTP server): exchanging files SPIFFS, rapid development Web server [Exclusive Guide]

2:30 pm March 10, 20178642

filesystem SPIFFS to ESP8266 (and Arduino) bit be used to store files to a Web server but also of data files (using the ESP8266 as a system for the acquisition of data for example). It is very easy to access file system SPIFFS from the Arduino code through the bookstore FS.h, but there is no provision for access from another computer in FTP. In this tutorial, we will test the library ESP8266FtpServer.h developed by David Paiva ( nailbuster on GitHub ) which allows to add a small FTP server to the ESP8266, enough to file and retrieve files.

the librairieESP8266FtpServer.h is still under development. It is an adaptation of the bookstore Arduino Gallegojm . It can make us many services in two situations.

first of all, if you developed your own HTML interface for your project ESP8266, to download to each change of entire system SPIFFS. On a D1 Mini Wemos which for 4MB Flash memory, it must download a 3MB file. Even at 921600 baud, the operation lasts 2 minutes and 35 seconds. It can happen for a small interface, but for a large project, it is quickly problematic.

second case, you use the ESP8266 to develop a stand-alone data acquisition system. You can enjoy the SPIFFS file system to save steps. Practice to continue a recording if restarted. This solution also avoids having to add and manage a SD card reader.

to use the library in your project, you have to manually add the two files (.cpp and .h) because it is not available from the Bookstore Manager. The easiest is to download the repository from GitHub. Open your project and drag the two files.

now that the library is added to your project, declare it at the beginning of the code

we then created an object

in the setup() function, set the credentials (user password).

Finally, we call monitors applications to connect to the server (function handleFTP ) in loop loop () .

other parameters can be configured directly in the library

  • define FTP_DEBUG: dé-commentez to enable the sending of messages of debug on the monitor series (convenient for the update)
  • FTP_CTRL_PORT: port of the FTP server. By default, it is the 21
  • FTP_TIME_OUT: before disconnecting automatic (I have a doubt about its operation)

it’s over, you can now access your files by FTP.

in the current version, there is only passive mode that is supported. The SFTP (secure FTP) is not supported. If you do not know Filezilla, you can start this tutorial by reading .

run FileZilla. Easy to connect to an ESP8266 on FTP and using the site manager. I met difficulties in using the quick connect bar. Open site from the file menu Manager and configure the access like this:

  • host : IP address of the ESP8266
  • Port: 21 (or one set up by the FTP_CTRL_PORT key)
  • Protocol : TFP – Protocol to transfer files
  • encryption : connection FTP simple (non-secure)
  • Authentication Type : Normal
  • ID and password

 filezilla esp8266 ftp connexion spiffs

start the connection by clicking login . The connection is now saved by FileZilla, it will be necessary to do it again. Once the connection is established, you have access to all the files in the Directory Data (that of the Arduino project). As you can see, the tree is not yet very well managed. Unless you fix the bookstore, must abandon the Organization of files in dedicated directories (js, img, css…), too bad!

filezilla fichiers spiffs esp8266 wemos d1 mini

by enabling debug messages, here’s what’s happening on the monitor series of the Arduino IDE.

that is, I hope you win a lot of time in the development of your Web Server on ESP8266 projects.