Send a Text File from PC to Arduino

Hi,
I am attempting to read a text file from my PC to my Arduino module. I have not been able to locate any relevant tutorials or threads regarding this topic. How would I use the serial connection to read a text file into my module?
Thank you for any help!

Hello and welcome,

Edit: sorry I've misunderstood your question.. Let's try again:

You will have to make a custom program on your PC that can respond to the arduino request and send the file content to the arduino. All this can be done with Serial.

  • Arduino ask to PC: send content of file X.txt
  • PC open X.txt, read its content into a buffer, then send it to the Arduino.

I've made a few things like this and it's not that hard.

You don't give much info, so I would like to refer you to the Serial reference.

As it is text, you might be able to use Serial.readBytesUntil() or (possibly easier but possibly a memory waster) readStringUntil().

By the way, what do you mean by module? The Arduino? Or an SDcard shield? Or...

There are (or at least there where) a number of terminal programs that can send the content of a file over a serial port.

I am using nano Arduino. I somewhat understand how to program the Arduino to receive the text file, but I am unsure as to how to create a program (and what program to use) to send the text file form the PC to the Arduino.

Try to find a terminal program that can send files over the serial port. You probably can also use the command prompt. For DOS/Windows

type file.txt > comX

where X is the number of the port.

No idea of the parameters (baudrate, parity etc) that are used with the above approach.

And else indeed write your own code (for Windows, see the link provide by guix).

If you use Windows then I suggest to write your program with Visual Studio 2015 Express, it's free. I recommend the C# language which is easy to learn and to use.

  • Make your first "hello world" program if you have no experience creating computer programs

  • Learn how to use the Serial class to talk with your arduino.

  • Learn how to use the File class to open and read a file.

  • Combine what you've learned and with a bit of patience you will be able to create your own program that will do exactly what you want.

You can find many tutorials and examples about the Serial and File classes.

This Python - Arduino demo may give you some ideas.

The examples in Serial Input Basics (which I wrote more recently) are simple reliable ways to receive serial data.

...R

Are you still working on it?

Here i find a simplest way to do what you want to do. Below is the link.

https://arduinobasics.blogspot.com/2012/05/reading-from-text-file-and-sending-to.html

Because currently i am going to do the project exactly same with your.

There is no much information for this kind of work.

But i find this link have the most simplest way that i have been seen on the internet.

Hope this can help others who want to do this project.

JUNyoyoyo:
Are you still working on it?

After two years ? :wink: