Transfer data from the arduino to the PC

Hello,

I am very new in the programming world and I am working in a project with an arduino UNO and an ADS1298 from Texas Instruments. I have most of the code ready and the only thing that i am missing is to transfer the data to the PC because I want to create an interface using MATLAB in order to plot some signals.

I have read that in order to transfer the data I need to use Serial.write or Serial.print but i do not understand how does that make or where does the data is transferred to in the PC. In other words, after using Serial.write where exactly does my data go and how do i managed to use it in Matlab?

Thank you

Best Regards

Miguel

In other words, after using Serial.write where exactly does my data go and how do i managed to use it in Matlab?

The data is available at the (virtual) serial interface a connected Arduino opens in your PC. The question of how you manage that in Matlab should be asked on a Matlab forum as it’s completely unrelated to Arduino.

Hi Pylon,

I was not trying to ask a question about how to use it in matlab but rather how to access the data, you mentioned that the data is available in the virtual serial interface but is there a way to save it in a folder so I can use it with Matlab? I understand that the arduino is going to retrieve data continuously but I just want to save data recorded in the first minute or second.

Thank you

Miguel

cebrianmiguel:
Hi Pylon,

I was not trying to ask a question about how to use it in matlab but rather how to access the data, you mentioned that the data is available in the virtual serial interface but is there a way to save it in a folder so I can use it with Matlab? I understand that the arduino is going to retrieve data continuously but I just want to save data recorded in the first minute or second.

Thank you

Miguel

Most serial terminal programs will allow you to send all input received from the serial port to a log file.

srnet:
Most serial terminal programs will allow you to send all input received from the serial port to a log file.

That could help me, do you know any literature on how to do it?

Thank you

That could help me, do you know any literature on how to do it?

The simplest way is

cat /dev/ttyACM0 > /path/to/the/logfile

If you need a GUI, you can use GtkTerm, there you can select from the menu "Log" the entry "To File..." and select the location of the log file you want.

One way to retrieve data is by HTTP, by adding either an Ethernet or a Wifi shield to your UNO. All PC programming languages can talk to a web server, including JavaScript in a browser (using AJAX), so you can set one up on the shield then send regular GET/PUT/POST queries to the Arduino and have it return the current status, a block of data or whatever.

This technique is really only applicable for relatively small data volumes, but if you want to handle massive data streams maybe an Arduino is not the best choice to start with. If you're visualising a system there may be no need for continuous real-time updates; in many cases a batch every couple of seconds may be enough.

I'm currently setting up a SparkFun Wifi shield to do just this. The board is well supported with good documentation and plenty of examples; the only downside is the Wifi library takes about a third of the space available in a UNO.