I was looking for a Arduino library which would allow me to access remote files on a Linux server. Unfortunately I did not find anything that I liked. So I came up with my own solution which is based on FTP.

The FTP protocol is one of oldest communication protocols: It is easy to implement and therefore rather efficient and you can find plenty of free server implementations on all platforms.

The library provides a Stream based API for the remote files which supports

  • The reading of Remote Files (File Download)
  • The writing to Remote Files (File Upload)
  • The listing of Remote Files and Directories
  • Creation and deletion of remote directories
  • Deletion of remote files

Reading a file is as simple as the following code:

    ArduinoFTPClient client;
    client.begin(IPAddress(192,168,1,10), "user", "password");
    FTPFile file = client.open("/test.txt");
    byte buffer[100];
    while (file.available()>0){
        int len = file.read(buffer, 100);
        Serial.write(buffer, len);
    }
    file.close();
    client.end();

The solution was tested with an ESP32 together with vsftpd running on a Ubuntu Server.

Further details can be found on Github

Categories: Arduino

1 Comment

Bert · 4. October 2023 at 9:03

Hi Phil,

I have the same issue, I like to list files from my remote FTP server. I have less experiance with programming, I have to learn by using examples.

I have tried with your library and examples but it seems not written for a arduino MEGA 2560.

Can you give me an example how to use it with a MEGA 2560 and a W5500 ethernet shield?

Thanks in advance,
Bert

Leave a Reply

Avatar placeholder

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