Copying file from Raspberry Pi to Arduino SD card

Hello!

I am doing a project in which I need to copy a file from a Raspberry Pi to a SD card located on my Arduino. I'm unsure how to go about doing this. Any advice or pointers to send me in the right direction would be greatly appreciated.

Thank you!

Use serial to send the bytes one at a time and receive them on the arduino. Then put them one byte at a time into the SD card.

Hi,

So how would I go about doing this? I've been looking around but am a bit stuck.

Thanks

Skywolf: Hi,

So how would I go about doing this? I've been looking around but am a bit stuck.

Thanks

Use the SD library included in arduino IDE. Read and try the data logger sample code. This is the gut of it:

 File dataFile = SD.open("datalog.txt", FILE_WRITE);

  // if the file is available, write to it:
  if (dataFile) {
    dataFile.println(dataString);
    dataFile.close();
    // print to the serial port too:
    Serial.println(dataString);
  }

You open a file to write, read things from the serial port (content of RPI file), then write to the SD card and close the file. There won't be a correct time stamp on the sd card due to no real time clock chip so all dates are 2000/1/1

If you want to do a more generic thing, such as RPI sends a file name and then content, I recommend you think about a simple protocol to do this. HTML is a good protocol to send files over the internet. It's just a bit complicated to implement on arduino but nothing you can't do.

I understand that concept, my issue lies more with the implementation of it. I'm simply unsure which commands to use so that I can copy it as such.

Skywolf: I understand that concept, my issue lies more with the implementation of it. I'm simply unsure which commands to use so that I can copy it as such.

What have you done so far? Nothing I guess? Copy it as what?

You have to break it down into steps. We can help you do the things you don't understand but this is not a code writing service.

I suggest you start at the RPi end. Write your code to open a file and send the bytes down the serial port. Do that first then, post what you have done and ask about the next phase or for help with that.

Are there any linux command to send files to comm port? That could save time from programming.

It depends on the language but using Python with the serial port is very easy.