Beginners Guide To PLX DAQ v2 (Rev1)
Beginners Guide To PLX DAQ v2 (Rev1)
(Revision 1)
Table of content
PLX DAQ v2 is a program used to establish an easy communication between Microsoft Excel
on a Windows Computer and any device that supports serial port protocol. It was
intentionally written to allow communication between Arduino and Excel.
You can, for example, measure temperature data with your Arduino, send the results to Excel
every 10 seconds, printed the data on a sheet and draw a graph with all information. All
communication will be done by Serial.println commands just like the commands you
use to send from Arduino to monitor in your Arduino IDE Serial Monitor.
The output of
void loop() {
Serial.println( (String) "DATA,DATE,TIME," + millis() );
delay(100);
}
2. How to use
The program uses two parts to work: the special Microsoft Excel Spreadsheet with the PLX
DAQ v2 UI and commands plus any Arduino device that sends special commands for
communication. The latest Excel Spreadsheet can be downloaded on the Arduino forum
(Link: http://forum.arduino.cc/index.php?topic=437398.msg3013761#msg3013761 ; please
always download the latest version!), the Arduino code can be written by everyone
themselves with below guideline.
After opening the Excel Spreadsheet please allow running the macro (yellow warning
message at the top). Afterwards you can see the PLX DAQ v2 UI. In case not please click the
button “Open PLX DAQ UI” on the “Simple Data” sheet.
For PLX DAQ v2 to work correctly your Arduino needs to send specially formatted commands.
All commands need to be send from Arduino to the PC using the Serial.println
commands. These commands can include parameters, variables and functions to send to as
well. These parameters need to be separated by commas. This can be done like this:
d. Miscellaneous commands:
Everything that is not really crucial or does not have any benefit (anymore)
a. CLEARSHEET:
This command clears all data the ActiveSheet (including labels!). It should be the first
command on every sketch.
Syntax: Serial.println(“CLEARSHEET”);
c. LABEL:
With this command you can set the labels for the top most row of the ActiveSheet
Syntax: Serial.println(“LABEL,1st Column,2nd Column,Third one!”);
d. DATA:
This is the most basic and crucial command of PLX DAQ v2. It is used to send data
from your Arduino to Excel and have it printed on the ActiveSheet. You can send
anything you want but you should make sure you split the data up by commas and
match the number of columns you defined with the LABEL command.
The reserved code words DATE, TIME and TIMER will be recognized by PLX DAQ and
will be replaced with values.
DATE will be switched to the current Windows computer’s date (e.g., 12.03.2017)
TIME will be switched to the current Windows computer’s time (e.g., 18:17:42)
TIMER will be switched to the time the logging is already active (e.g., 1,365 seconds)
You can add the keyword AUTOSCROLL_20 to your string. This information will make
PLX DAQ to automatically scroll your Excel window down with every new line of data
that is received. The number (e.g., 20) indicates how many lines should be shown
above the latest line that is scrolled to automatically.
i. Syntax 1 – this can be used to make you code more readable but works for
static info only:
Serial.println("DATA,DATE,TIME”);
ii. Syntax 2 – this can be used to include function calls or variables in the same
line:
Serial.println( (String) "DATA,DATE,TIME," + millis() );
iii. Syntax 3 – this is a way to present the code with rather more lines but with a
better readability if you use many variables in one line. Please note that only
the print command is used and println is only used at the end to send
the fully build up string:
Serial.print("DATA,DATE,TIME,”);
Serial.print(myVariableA);
Serial.print(",”);
Serial.print(millis());
Serial.print(",”);
Serial.println(myVariableB);
a. CELL,SET
By this command you can set the value of any cell in the Excel workbook with any
value you want. This can either be done on the ActiveSheet or on any other sheet.
Beginners Guide to PLX DAQ v2 by Net^Devil (rev1) Page 5 of 12
Syntax to set a value on the ActiveSheet:
Serial.println("CELL,SET,C9,MyValue”);
Syntax to set a value on a named sheet somewhere in the workbook:
Serial.println("CELL,SET, ONSHEET,AnySheet,C,9,MyValue”);
PLEASE NOTE !! there might occur problems at higher baud rates with the
CELL,SET command. It might happen that values are not transferred correctly –
instead “0” might be transmitted. In these cases please either decrease your baud
rate or insert small delay before to your CELL,SET command (e.g., delay(3);).
Typically values between 3 and 100 should do the trick. In case you make excessive
use of CELL,SET or CELL,GET please increase the delay value even further in case you
continue receiving wrong values.
b. CELL,GET
With this command values from the Excel sheet (either ActiveSheet or named sheet)
can be queried and read by Arduino. For example you could put a value for the delay
duration in cell J9, query it every loop iteration and control how long your Arduino
should pause between each loop. The value in J9 can be changed by you during
runtime at any time.
Please note: you need to read the value on your Arduino. This can be done by
Integer or String. You should take care to only send integers when you are reading
integers and vice versa.
Use Serial.readStringUntil(10);
or Serial.readStringUntil(10).toInt();
or Serial.readStringUntil(10).toFloat();
The number 10 is important as ASCII char 10 represents the end of a line to read.
With the following command you could read the value in J9 for the example above:
void loop() {
int myDelayValue;
Serial.println("CELL,GET,J9");
myDelayValue = Serial.readStringUntil(10).toInt();
Serial.println( (String) "Read value is: " + myDelayValue);
delay(myDelayValue);
}
To read a value from any other named sheet please use the following syntax:
Serial.println("CELL,GET,FROMHEET,AnySheet,C,9”);
PLEASE NOTE !! there might occur problems at higher baud rates with the
CELL,GET command. It might happen that values are not transferred correctly –
instead “0” might be transmitted. In these cases please either decrease your baud
rate or insert small delay before to your CELL,GET command (e.g., delay(3);).
Typically values between 3 and 100 should do the trick. In case you make excessive
use of CELL,SET or CELL,GET please increase the delay value even further in case you
c. ROW
You can set the row on which data should be logged to manually. Thus after e.g.,
having logged 20 data sets you can reset the row counter to “2” and start from the
beginning again. Or you can read the row that is currently logged to (please note you
need Serial.readStringUntil(10).toInt() command afterwards in Arduino)
Syntax:
Serial.println("ROW,SET,2”);
Syntax:
Serial.println("ROW,GET”);
myRow = Serial.readStringUntil(10).toInt();
e. CLEARRANGE
Other than Cleardata or Clearsheet this command will only clear a certain range on
the ActiveSheet. Data will be deleted in a rectangle from top left to bottom right.
Syntax: Serial.println(“CLEARRANGE,B,10,D,20”);
f. RESETTIMER
It will reset the timer that is used to count the time PLX DAQ is already logging
Syntax: Serial.println(“RESETTIMER”);
b. SAVEWORKBOOK
Will just save the workbook by its current name. This is useful if you are logging for a
long time and want to save your data every now and then.
c. SAVEWORKBOOKAS
Will save the workbook by any given name. The new workbook will be saved in the
same folder as the currently open workbook (except if you include subfolders in the
name to be saved).
Syntax: Serial.println(“SAVEWORKBOOKAS,MyNewWorkbookName”);
Syntax: Serial.println(“SAVEWORKBOOKAS,Subfolder\Workbookname”);
d. FORCEEXCELQUIT
This is a heavy command! It will force quit Excel.
!! PLEASE NOTE TO SAVE YOUR WORKBOOK FIRST !!
Syntax: Serial.println(“FORCEEXCELQUIT”);
a. BEEP
Will simply make a beep noise in Excel. Good if you want to be notified by your
Arduino e.g., after a certain threshold is past on a value you measure (room
temperature or other)
Syntax: Serial.println(“BEEP”);
b. MSG
Can be used to put a string on the Controller Message label on the PLX DAQ UI
Syntax: Serial.println(“MSG,Put your text here”);
c. DONE
Will flush the Serial port on Excel side. Can be used to send data which might be in
the buffer on Excel
Syntax: Serial.println(“DONE”);
d. GETRANDOM
Will return a random number from Excel to Arduino. This is useful because Arduino
can’t create true random numbers. Arduino’s random function requires prior
initialization by randomSeed(value). If value is not unique (e.g., user input) the
number sequence return by Arduino’s random will always be the same. To get a
unique value for randomSeed’s value you can therefore query Excel.
Syntax:
Serial.println("GETRANDOM,-31313,32323");
int rndseed = Serial.readStringUntil(10).toInt();
randomSeed(rndseed);
Serial.println( (String) “1st number: “ + random(0, 50));
Serial.println( (String) “2nd number: “ + random(0, 50));
Serial.println( (String) “3rd number: “ + random(0, 50));
Each and every one – including you (!!) – is allowed and should and can see the full source
code of PLX DAQ v2, read it, learn from it and adjust it in any way you want or need. The
source code can be viewed by pressing Alt+F11 in Excel. I deeply hope I managed to write the
code as clear as possible. Generally, all you need to know is that in the sub “DataReady” you
can add new commands. Simply copy & paste an old one, give it your name and go for it!
You could also use the CustomDevPoints that I included in the code. These functions are
called at different times during the run. E.g., every time a new line is read from PLX DAQ
(thus after each Serial.println();), after a new line with DATA is read (thus after each
Serial.println(“DATA,……”);) or after this data is added to the sheet.
If you want to use the new version of PLX DAQ v2 but want to keep all your configured sheets
in old Excel version of PLX DAQ try the following steps to copy all sheets, references and
formulas easily to the new version.
PLEASE NOTE !! it is NOT possible to copy the sheet “Simple Data” from the old version to
the new version. Excel would automatically copy the old version of PLX DAQ as well ….
a. Download new PLX DAQ Excel and open, open your Excel as well.
b. In your old Excel select first sheet, then hold shift key and select last sheet, right click
first sheet and select "Move or Copy"
c. Select new PLX DAQ Excel in the dropdown, select "move to end", select "Create a
copy" and press OK.
d. It should copy all selected sheets to the new version.
Last but not least here is a fully working demo sketch that is using most of the above
mentioned commands and should give you a fair overview on how to program your Arduino
to communicate with Excel using PLX DAQ v2.
Enjoy !!
Greetings
Jonathan Arndt (aka Net^Devil)
/*
* Demo sketch for new "PLX DAQ v2"
* including most all common commands to be used
*/
Beginners Guide to PLX DAQ v2 by Net^Devil (rev1) Page 9 of 12
int i = 0;
void setup() {
void loop() {
// and for forced quit of Excel with saving the file first
if(i==450)
{
Beginners Guide to PLX DAQ v2 by Net^Devil (rev1) Page 11 of 12
Serial.println("CUSTOMBOX3,GET");
if(Serial.readStringUntil(10).toInt()) {
Serial.println("SAVEWORKBOOKAS,450-Lines-File");
Serial.println("FORCEEXCELQUIT");
}
else
Serial.println("No forced Excel quit requested!");
}
}