Arduino Ethernet as small file downloader

Hello together,

I would like to use the Arduino in combination with the ethernet shield as a small downloader. The board shall check if a certain file (PDF 30 MB) is available and shall download it to the SD card or an available NAS. Does anybody know if this idear can be realized? I read that the ethernet functionality and the usage of the SD card can not be used at the same time, because of the usage of the same pin.

Thanks for your help.

Daniel

Ethernet and the SD card can be used at the same time. They both use the SPI interface, but that is not a problem at all.

Downloading a file and storing it could be 4kbyte per second. So 30MB could take 2 hours.
The Arduino Ethernet shield is not ment for large files or high upload/download speeds.

Hello Krodal,

thank you for your quick answer.

Do you know where I can get a small example? I just saw an example for a google search request.

THX

Daniel

Do you know where I can get a small example?

Of what? Running a servo? Making a stepper motor move? Blinking an LED? Tying up the Arduino for two hours downloading a file that the PC could download in 30 seconds?

I just saw an example for a google search request.

Which shows how to get data from a server, like the one that has the pdf file you want.

There are examples with the SD library showing how to write to the SD card. It's not rocket science to combine them. The ethernet as client example does not care what you do with the data. The SD example doesn't care where the data comes from.

I am looking for a short example to dowload for example a textfile from a certain address (HTTP).

You can start with the WebClient example: http://arduino.cc/en/Tutorial/WebClient

Molke:
I am looking for a short example to dowload for example a textfile from a certain address (HTTP).

Client test code that downloads a small text file.

//zoomkat 9-22-12
//simple client test
//for use with IDE 1.0.1
//with DNS, DHCP, and Host
//open serial monitor and send an e to test
//for use with W5100 based ethernet shields

#include <SPI.h>
#include <Ethernet.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address

char serverName[] = "web.comporium.net"; // zoomkat's test web page server
EthernetClient client;

//////////////////////

void setup(){

  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
    while(true);
  }

  Serial.begin(9600); 
  Serial.println("Better client test 9/22/12"); // so I can keep track of what is loaded
  Serial.println("Send an e in serial monitor to test"); // what to do to test
}

void loop(){
  // check for serial input
  if (Serial.available() > 0) //if something in serial buffer
  {
    byte inChar; // sets inChar as a byte
    inChar = Serial.read(); //gets byte from buffer
    if(inChar == 'e') // checks to see byte is an e
    {
      sendGET(); // call sendGET function below when byte is an e
    }
  }  
} 

//////////////////////////

void sendGET() //client function to send/receive GET request data.
{
  if (client.connect(serverName, 80)) {  //starts client connection, checks for connection
    Serial.println("connected");
    client.println("GET /~shb/arduino.txt HTTP/1.0"); //download text
    client.println("Host: web.comporium.net");
    client.println(); //end of get request
  } 
  else {
    Serial.println("connection failed"); //error message if no client connect
    Serial.println();
  }

  while(client.connected() && !client.available()) delay(1); //waits for data
  while (client.connected() || client.available()) { //connected or data available
    char c = client.read(); //gets byte from ethernet buffer
    Serial.print(c); //prints byte to serial monitor 
  }

  Serial.println();
  Serial.println("disconnecting.");
  Serial.println("==================");
  Serial.println();
  client.stop(); //stop client

}