Serial to SD card

I will ask because I cannot imagine it hasn’t been done many times however I cannot find one. I need an arduino to sit and wait for a serial input of a 5K text file and when it appears on the software serial port it needs to be written to the SD card. Nothing else, nothing fancy just dirt simple. Anyone seen one of these elusive bits code? Larry.

This
Then see print examples included SD section of the IDE

The Sparkfun OpenLog does that for a living. Cheap, too!

Yes I see lots to write sensor data to sd but nothing from serial to sd. I don’t need to read just write to it from a serial input.

trotterlg:
I don’t need to read

Really? Think again.

Haha. I read it from another arduino that shares it. That arduino sends the file via radio. The arduino that needs write to the card gets serial data from a raspberry.

You will need to implement some form of protocol that both sides adhere to.

E.g.
Sender

step 1  send 512 data bytes
step 2  wait for ack

Receiver

step 1  wait for 512 data bytes
step 2  write to SD
step 3  send ack

You will need this as writing to SD is slow and if you don't tell the sender to wait, you will loose data

You can use Robin's serial input basics as a wrapper around the data.

+1 for the Sparkfun OpenLog.

This is it's one and only job and it does it well!

The source is freely available too, if you want to put your own together.