We are working on a project that requires transferring files between an Arduino Ethernet Shield and an FTP server.
We have 3 Ardunio Mega microcontrollers each with an Ethernet Shield and a microSD card. We bought a product called Web server in a Box that has a PIC microcontroller that supports HTTP and FTP. We thought of creating a web page so we can upload files easily from any device but that won't work because the server doesn't support PHP. FTP seems to be easier so we installed an FTP server on Linux for the purpose of testing and setting up the Arduino.
The problem we're facing now is that there is no FTP-client library for Arduino. We looked up the internet and found nothing. We thought about writing our own library which would contain the main commands like "ls", "cd", "get", "delete", ... etc. but that would take a long time and there are many things to consider.
Our hope is that we find a library or a way to use the Arduino as an FTP-client that checks a directory on the FTP server for new files, lists files and downloads certain files into its microSD card. Again, the microSD is on the Ethernet Shield and we'll be using Ethernet to connect to through a router to the FTP server.
Thanks a lot buddy. I was reading your post on another thread and found your sketch. So I copied it and came back here to post it and let people know that I'll be trying it to find that you've already replied to my post. XD
This is the code written by SurferTim that I'll be testing:
I tried your program. I keep getting this no matter what I put as a username and password:
Ready. Press f << I press f here
Command connection failed
FTP failed
I've also tried playing with the server configuration. It could be a firewall issue since I'm using the dorm network but I doubt it because I tried an example (ChatServer example) and it worked just fine.
I'm using vsftpd and here is my configuration file:
I tried commenting out "anonymous_enable=YES" then tried using null username and pass but it didn't work so I tried using my unix username and pass and it didn't work either.
from the output message, it seems to be failing the conditions of these two if statements:
if(inChar == 'f')
{
if(sendFTP()) // then failing this
Serial.println("FTP OK");
else Serial.println("FTP failed");
}
}
byte sendFTP()
{
if (client.connect(server,21)) { //failing this first
Serial.println("Command connected");
}
else {
Serial.println("Command connection failed");
return 0;
}
Yeah I found that anonymous is the username .. but when not in anonymous FTP I should use existing UNIX account details (usernames, passwords) right? At least that's what I read.
You're right about not using it on another machine. I guess I can make another limited unix account to test this instead of using my main unix account details.
but when not in anonymous FTP I should use existing UNIX account details
You should use whatever username/password has been set up for that machine. If you're logging into your own FTP server, set up a username and password for it and use those.