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

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published.