Arduino Forum upgrade scheduled for Monday, October 20th, 11am-4pm (CEST). Sorry for the inconvenience!
Pages: [1]   Go Down
Author Topic: Data acquisition using excel or matlab  (Read 2633 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hello

I am working on a project where I am doing PI control on a system. The system has large delays and I need to plot the data over 24 hrs to see how the system is responding to my control algorithm.

The only problem is that I am not familiar on how to save the data that is appearing on the serial monitor to excel or matlab. Is anyone familiar with this and could assist me. I would prefer the data be stored on matlab.
Logged

Offline Offline
Edison Member
*
Karma: 51
Posts: 1734
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Search for PLX-DAQ.

Pete
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

PLX-daq doesn't want to run on my system.
I keep getting a run time error '424'
Logged

Dee Why NSW
Offline Offline
Edison Member
*
Karma: 48
Posts: 2350
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

That's a worry......... PLX is just a macro for Excel. What version of Office and what operating system are you using?
Logged

HANOI, VN
Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

For excel, I simply ctrl+A and ctrl+C then ctrl+V all data from Serial monitor to a cell in excel. For matlab, i do the same but save in *.txt format. You may name the file "data.txt".

Then in matlab use these functions:
Code:
load ('data.txt');
[row, column] = data; %% to store your data in a matrix with dimesion = row x column

p/s: you better log the data separated by a "tab" rather than a semicolon, comma or a dot.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I've used Processing on the laptop side to be writing data into .csv files.  the downside of this is that you can't open the excel files while data logging is taking place over the serial port.

Hope this helps.

The arduino side code is:

Code:
float Temp;

void setup()
{
  Serial.begin(9600);
 
}

void loop()
{
  Temp = analogRead(A1);
  Temp = 5.0*Temp*100.0/1024;
  Serial.println(Temp);
  delay(1000);
}

The processing side of the code is as:
Code:
import processing.serial.*;

Serial myPort;
PrintWriter output;

void setup()
{
  String[] portList = Serial.list();
  myPort = new Serial(this, portList[0],9600);
  println(portList);
 
  output = createWriter("TempretureLog.csv");
  output.println("Time"+","+"Temp (in Deg. Cel.)");
}

void draw()
{
  if(myPort.available()>0)
  {
    String Temp = myPort.readStringUntil('\n');
    if(Temp!=null)
    {
    output.print(hour()+":"+minute()+":"+second()+":"+",");
    output.print(Temp);
    println(Temp);
    }
  }
  //else println("No Data");
}

void keyPressed()
{
  output.flush();
  output.close();
  exit();
}
Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 16
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Please, look here: http://www.aggsoft.com/asdl-rs232-to-excel.htm
The most simple way is to output the data from the device in the CSV format. In this case Advanced Serial Data Logger can capture it to an CSV file. You can open this file while the logger will write data to it. From my experience, it will be better to parse and write data to Access and read the captured data to Excel when you need it.
Logged

Atlanta, USA
Offline Offline
Edison Member
*
Karma: 56
Posts: 1907
AKA: Ray Burne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The Excel part is pretty easy...
Use a Leonardo, Pro Micro, or V-USB to simulate a keyboard.
Like my project here:
http://www.hackster.io/rayburne/arduino-to-excel-using-v-usb

If the PC needs to be away, just use the same concept, pass data to SD-Card, import the <file.prn> into Excel later.

Ray
Logged

Pages: [1]   Go Up
Arduino Forum upgrade scheduled for Monday, October 20th, 11am-4pm (CEST). Sorry for the inconvenience!
Jump to: