Sending Data From Arduino to Excel (and Plotting It)

234,450

817

64

Introduction: Sending Data From Arduino to Excel (and Plotting It)

I've searched extensively for a way that I could plot my Arduino sensor reading in real time. Not only plot, but also display and store the data for further experimentation and corrections.

The simplest solution I’ve found was to use excel, but with a twist.

Also if you find this instructable interesting, perhaps you'll like another one I've made (about displaying live Arduino sensor readings on a Nokia 5110 LCD):

https://www.instructables.com/id/Arduinonokia-lcd-...

Step 1: What You'll Need

For this you will need:

-Windows (tested on xp)

-Arduino IDE

-Microsoft office (tested on 2010)

-PLX-DAQ (expansion for excel)

-Arduino (tested on UNO, but any board should work)

I am assuming that you’ve already got an Arduino, Windows, Arduino IDE and Excel. Here’s the link to download PLX-DAQ:

https://www.parallax.com/downloads/plx-daq

You only need to download and install it, it should work fine. After installation, it will automatically create a folder named PLX-DAQ on your Desktop in which you will find a shortcut named PLX-DAQ Spreadsheet.

When you want to use your Arduino to send data to excel, just open up the shortcut.

Step 2: Arduino Part

Now that we’ve got all that downloaded and installed, let’s start with the Arduino part.

Here’s a basic template I created that will display the time in column A and your sensor measurements in column B.

Of course, this is just a basic template, which is pretty straight forward and you can tweak it to suit your needs.

I’ve added explanations in the Arduino code so you (and I, after not working with it for a while) know which part of the code does what.

Here’s the sketch:

//always starts in line 0 and writes the thing written next to LABEL

void setup() {

Serial.begin(9600); // the bigger number the better

Serial.println("CLEARDATA"); //clears up any data left from previous projects

Serial.println("LABEL,Acolumn,Bcolumn,..."); //always write LABEL, so excel knows the next things will be the names of the columns (instead of Acolumn you could write Time for instance)

Serial.println("RESETTIMER"); //resets timer to 0

}

void loop() {

Serial.print("DATA,TIME,TIMER,"); //writes the time in the first column A and the time since the measurements started in column B

Serial.print(Adata);

Serial.print(Bdata);

Serial.println(...); //be sure to add println to the last command so it knows to go into the next row on the second run

delay(100); //add a delay

}

Obviously if you upload this code, it won’t work on it’s own!

You need to add a formula for Adata, Bdata and … . This template is just for reference so you know how to use the program. Just add Serial.read() function, name it Adata, Bdata and … and it should work.

Step 3: Sending the Data to Excel

Of course PLX-DAQ has more functions, which you can explore on your own by reading the instructions in the rar folder that you downloaded.

If you want excel to graph your data but can’t be bothered to read the instructions, here’s a short version of what you can do:

-use the (modified) code from my instructable

-connect your Arduino as you normally would

-DO NOT OPEN THE SERIAL MONITOR in Arduino IDE, it will not work with excel if you do

-open the shortcut to your PLX-DAQ Spreadsheet

-excel will say “This application is about to initialize ActiveX…”, just click OK

-a new window named Data Acquisition for Excel will appear

-select the usb port your Arduino is connected to (if it doesn’t work at first, go through the list of ports)

-where it says Baud, just select the number you put in your code at Serial.begin(), in my case that would be 9600

-create an empty graph

-select which columns of data you want on the graph for the x and y axis (the way to do this is a little different depending on your version of excel, but it’s not too hard to figure out)

-click collect data on PLX-DAX and it should start collecting the data

-excel will plot the information as it gets sent from the Arduino to excel in real time

Depending on how precise you want your graph to be, you can change the characteristics of the graph. You can closely examine a section of the graph by shutting down data collecting, right click on the x or y axis and set it to a smaller frame. (normally it’s set to automatic)

You can also right click on the curve that connects the points on your chart and select the color and thickness of the curve.

That’s it for the basics. I hope I’ve helped a few of you out by writing this. I know it took me quite some time to find this and to get it working.

P.S.
If you liked this instructable, perhaps you'll like another one I've made: https://www.instructables.com/id/Arduinonokia-lcd-d...

9 People Made This Project!

Recommendations

  • Fix It! Contest

    Fix It! Contest
  • Metalworking Contest

    Metalworking Contest
  • Water Contest

    Water Contest

64 Discussions

0
None
glj1946

Question 15 days ago

PLX-DAQ throws an error. I am using MS Office 2010 on a Windows 10 laptop. Where do I get the object that is missing on my computer?

PLX-DAQ error.jpg

Doesn't work. Win 10 and Excel 2010 doesn't recognize PLX-DAQ Spreadsheet

Not sure what to say ... the App doesn't support COM ports > 15, so it's not very useful for Arduinos that use higher numbers. My ESP32-Dev uses COM33 and 115,200 baud, neither of which are supported by PLX-DAQ.

I need some help! I'm making a temperature logger using an arduino yun board and the DS18B20 digital thermometer. I'm new to arduino so any help is greatly appreciated. The data doesn't seem to move over to the excel file, or if it does, it gets stuck on the first row.

#include <OneWire.h>

#include <DallasTemperature.h>

// Data wire is plugged into pin 2 on the Arduino

#define ONE_WIRE_BUS 2

// Setup a oneWire instance to communicate with any OneWire devices

// (not just Maxim/Dallas temperature ICs)

OneWire oneWire(ONE_WIRE_BUS);

// Pass our oneWire reference to Dallas Temperature.

DallasTemperature sensors(&oneWire);

void setup(void)

{

// start serial port

Serial.begin(9600);

Serial.println("CLEARDATA");

Serial.println("LABEL,Current Time,Temp");

sensors.begin();

}

void loop(void)

{

// call sensors.requestTemperatures() to issue a global temperature

// request to all devices on the bus

Serial.print("DATA,TIME"); //Capturing Local Time

int TempVal = sensors.getTempCByIndex(0);

sensors.requestTemperatures(); // Send the command to get temperatures

Serial.print("TempVal");

Serial.print("");

// You can have more than one IC on the same bus.

// 0 refers to the first IC on the wire

delay(1000);

}

1 reply

Through a rapid checkout of your code, I can see a few thinks that are just NO OK.

Instead of

Serial.print("DATA,TIME");

You should tipe

Serial.print("DATA,TIME,");

In order to fully understand the meaning of that comma you should read the PLX-DTQ. It pretty short and quite useful.

Then, instead of

Serial.print("TempVal");

Serial.print("");

Just type:

Serial.println("TempVal");

Again, to understand that carriage return, refer to the PLX-DTQ helpfile.

0
None
adtu

10 months ago

Im having issues in printing all the values in excel through my MPU6050.Please help.

Hi,

I am trying to get a 2nd piece of data to read of it, but for some reason I only can see the temperature.

Is there something I am missing?

Thank you in advance

Naamloos.png

Has any one created code to send data from Arduino to Numbers (Mac version of excel)?

Is it possible to use the SET and GET commands with an Arduino variable for an arbitrary excel address? For example:

Serial.println("CELL, GET, FROMHEET, AnySheet, C, 9”);

would be something like :

Serial.println("CELL, GET, FROMHEET, AnySheet, ExcelColumn, ExcelRow”);

?

Excel(2016) will stop working shortly after I connect. What can I do about this?

can i use it with windows 10 ?? I really need it.. huhu

2 replies

Hi, did you ever find a solution for windows 10?

i have problem when i fixed the code the problem created the "serial was decleaed a scope " how should i fix it ?

I have that problem

when I open PLX-DAQ it error like pic

help please!!!

FVDDDY6ION4KM0X.LARGE.jpg
1 reply

System Requirements


  • Microsoft Windows 98
  • Microsoft Office/Excel 2000 to 2010
  • May not work with newer software; no longer supported

I don't know how to modify my program ,so that i can get data on spreadsheet. ,please help me..../*

*

Ultrasonic sensor Pins:

VCC: +5VDC

Trig : Trigger (INPUT) - Pin11

Echo: Echo (OUTPUT) - Pin 12

GND: GND

*/

int trigPin = 11; //Trig - green Jumper

int echoPin = 12; //Echo - yellow Jumper

int Object = 0;

long duration, cm ;

void setup() {

//Serial Port begin

Serial.begin (9600);

//Define inputs and outputs

pinMode(trigPin, OUTPUT);

pinMode(echoPin, INPUT);

}

void loop()

{

// The sensor is triggered by a HIGH pulse of 10 or more microseconds.

// Give a short LOW pulse beforehand to ensure a clean HIGH pulse:

digitalWrite(trigPin, LOW);

delayMicroseconds(5);

digitalWrite(trigPin, HIGH);

delayMicroseconds(10);

digitalWrite(trigPin, LOW);

// Read the signal from the sensor: a HIGH pulse whose

// duration is the time (in microseconds) from the sending

// of the ping to the reception of its echo off of an object.

pinMode(echoPin, INPUT);

duration = pulseIn(echoPin, HIGH);

// convert the time into a distance

cm = (duration/2) / 29.1;

if (cm < 10)

{

Serial.print("Object : ");

Serial.print(Object++);

Serial.println(" stk");

}

delay(20000);

}