Getting sensor data from arduino to excel

Hi,

I need to send data from my temperature sensor (MLX90614 IF) which is connected to arduino uno, to excel.
I have been reading about PLX-DAQ, the problem is I do not know how to write the code to do this. Below I have the code for the sensor:

#include <i2cmaster.h>

void setup(){
Serial.begin(9600);
Serial.println(“Initializing…”);

i2c_init(); //Initialise the i2c bus
PORTC = (1 << PORTC4) | (1 << PORTC5);//enable pullups
// Set up serial communication. Start Excel.
}

void loop(){
int dev = 0x5A<<1;
int data_low = 0;
int data_high = 0;
int pec = 0;

i2c_start_wait(dev+I2C_WRITE);
i2c_write(0x07);

// read
i2c_rep_start(dev+I2C_READ);
data_low = i2c_readAck(); //Read 1 byte and then send ack
data_high = i2c_readAck(); //Read 1 byte and then send ack
pec = i2c_readNak();
i2c_stop();

//This converts high and low bytes together and processes temperature, MSB is a error bit and is ignored for temps
double tempFactor = 0.02; // 0.02 degrees per LSB (measurement resolution of the MLX90614)
double tempData = 0x0000; // zero out the data
int frac; // data past the decimal point

// This masks off the error bit of the high byte, then moves it left 8 bits and adds the low byte.
tempData = (double)(((data_high & 0x007F) << 8 ) + data_low);
tempData = (tempData * tempFactor)-0.01;

float celcius = tempData - 273.15;
float fahrenheit = (celcius*1.8 ) + 32;

Serial.print("Celcius: ");
Serial.println(celcius);

delay(1000); // wait a second before printing again

}

I have a fairly good understanding of C/C++ language.

I need to send data from my temperature sensor (MLX90614 IF) which is connected to arduino uno, to excel.

Well, excel does not have a mechanism to read data from the serial port, so you can't send data directly to excel.

Now, the question is whether you need to send data to excel or to store data in a file that excel can read?

Creating an application on the PC that reads the serial data and writes it to a csv file that excel can read would be fairly easy.

As far as I know PLX-DAQ (Parallax software) does just that. http://www.parallax.com/ProductInfo/Microcontrollers/PLXDAQDataAcquisitiontool/tabid/393/Default.aspx

I just need to figure how to make it communicate with the arduino.

The help file gets installed with that appears fairly adequate to figure out how to use it. IE: Sending the following string out the Arduino to the PC:

DATA,123,456,789

will place those 3 values in the next 3 cells of the spreadsheet.
Download, install, rtfm.

I am not familiar with arduino code, although I'm trying. Would it be possible to show me an example? Thank you.

I did not rtfm and just going off the comment from jraskell.
Basically something like this.

 Serial.print("DATA,");
    Serial.println(celcius);
#include <i2cmaster.h>

void setup(){
    Serial.begin(9600);
 //   Serial.println("Initializing...");
    
    i2c_init(); //Initialise the i2c bus
    PORTC = (1 << PORTC4) | (1 << PORTC5);//enable pullups
    // Set up serial communication. Start Excel.
}

void loop(){
    int dev = 0x5A<<1;
    int data_low = 0;
    int data_high = 0;
    int pec = 0;
    
    i2c_start_wait(dev+I2C_WRITE);
    i2c_write(0x07);
    
    // read
    i2c_rep_start(dev+I2C_READ);
    data_low = i2c_readAck(); //Read 1 byte and then send ack
    data_high = i2c_readAck(); //Read 1 byte and then send ack
    pec = i2c_readNak();
    i2c_stop();
    
    //This converts high and low bytes together and processes temperature, MSB is a error bit and is ignored for temps
    double tempFactor = 0.02; // 0.02 degrees per LSB (measurement resolution of the MLX90614)
    double tempData = 0x0000; // zero out the data
    int frac; // data past the decimal point
    
    // This masks off the error bit of the high byte, then moves it left 8 bits and adds the low byte.
    tempData = (double)(((data_high & 0x007F) << 8 ) + data_low);
    tempData = (tempData * tempFactor)-0.01;
    
    float celcius = tempData - 273.15;
    float fahrenheit = (celcius*1.8 ) + 32;

 //   Serial.print("Celcius: ");
 //   Serial.println(celcius);
    
    delay(1000); // wait a second before printing again
    Serial.print("DATA,");
    Serial.println(celcius);
}

I wouldn’t think it would be as easy as to just write Serial.print(“Data,”);
Thank you a lot!

I also had wrong port connected before, and a few other errors, finally everything works now!

I am now having trouble sending multiple data to the macro. I am trying to send pressure and altitude, but they are sent together in a cell.

Serial.print(altitude); Serial.print(pressure); Serial.println(); Serial.print("DATA,,");

not sure how to go about it..

I have never used the parallax software, so this is guesswork, but based on the code posted earlier in the thread, you need to send DATA,Altitude,Pressure

This will do that:

Serial.print("DATA,");
Serial.print(altitude);
Serial.print(",");
Serial.println(pressure);

Another option is gobetwino - http://www.arduino.cc/playground/Interfacing/GoBetwino

I've also come across gobetwino, but PLX-DAQ is better for my application. Thanks for the tip!