Quick Start to Simple DAQ System using PLX-DAQ Excel & Arduino

From about two days I’ve been asked to edit a graduation project that relies on two Arduinos that are used for the data acquisition purpose in two different areas and the communication channel was the XBee WiFi module.

It was a straight forward project but when I was checking it I found that they’re using a cool add-on for DAQ (Data Acquisition). They were using PLX-DAQ.

What’s PLX-DAQ?

PLX-DAQ is a simple add-on for Microsoft Excel that make it easy to simply create log excel sheets for laboratory purpose or other DAQ purposes. You simply install it and open the sample excel file then you access the VBA code (Visual Basic for Applications) -which is implementation of VB to be used inside Office Suite-.

So, How PLX-DAQ Is Useful?

Let’s say if you simply want to gather the data of sensors and then use Excel to draw charts or diagrams for experiment you want, so PLX-DAQ and Arduino are super easy to use and start.

1. Installing PLX-DAQ

First you need to download the ZIP file from the website here. After that un-Zip it and then enter the setup and follow along the installation process after that you’ll find that there’s a desktop folder called “PLX-DAQ”. Enter it and then open the Excel file.

2. Enabling the Macro and Active-X

As we know that Macro is a small program that automates steps you use in order to boost productivity, but beware! Don’t try to run any macro you don’t know the source of it, because it maybe a virus that will delete all your office files. So, Excel doesn’t allow macros to run by default. In order to enable it you will have to do the following:

  1. Show the hidden (Developer tab).
  2. Enable the Macros.

1. Show The Hidden “Developer Tab”

  1. Click the File tab.
  2. Click Options.
  3. Click Customize Ribbon.
  4. Under Customize the Ribbon and under Main Tabs, select the Developer check box.

2. Enable Macros

3. Arduino Code

PLX-DAQ relies on the UART serial communication thus you’ve to use the Serial.print() and other functions from the serial class.

Here’s a simple program that sends both:

  1. Time in milliseconds form the moment the Arduino resets
  2. Voltage on the analog input A0.
unsigned long int milli_time;    //variable to hold the time
float voltage;         //variable to hold the voltage form A0
void setup() {
Serial.begin(128000); //Fastest baudrate
Serial.println("CLEARDATA"); //This string is defined as a
// commmand for the Excel VBA
// to clear all the rows and columns
Serial.println("LABEL,Computer Time,Time (Milli Sec.),Volt");
//LABEL command creates label for
// columns in the first row with bold font
}
void loop() {
milli_time = millis();
voltage = 5.0 * analogRead(A0) / 1024.0;
Serial.print("DATA,TIME,");
Serial.print(milli_time);
Serial.print(",");
Serial.println(voltage);

delay(100); //Take samples every one second
}

Then upload this code to your Arduino.

4. Running the PLX-DAQ

In Excel you’ll have only to open the file “PLX-DAQ” then automatically it Excel notify you that there’s an Active-X macro wants to run, hit OK then a view like this should happen.

PLX-DAQ configuration

You’ll have to choose the correct port and baud-rate, in my case “COM 9” and “128000”, then hit “Connect”.

PLC-DAQ successfully connected and logging data in Excel columns

After some seconds you’ll have a lot of data to play with. Let’s draw some curves :D.

5. Making Use of Excel Power (Drawing Charts)

Then click “OK”. You’ll have the line drawn like this.

This isn’t good becuase the X-axis still have an automatic counter and we want the time (per millis) to be on that axis. so here’s how you do it.

You’ll have to edit the type of this axis to be “data axis” as follows:

Then voila! You’ll have your chart ready

Advanced Techniques

You can add the power of VB in your excel DAQ and do all other interesting stuff like playing a sound when a long process of “DAQing” is complete ,fire an alarm if something went wrong (based on the data values) or alter the user form in a way that has a lot of features and other things.

This will be the topic for another post about it, if you’ve any ideas that can be implemented don’t hesitate and comment them here.

That’s all for now!

That’s all for now if you found this helpful please share it. And if you have any comments or ideas that you want to build please leave them in the comments.

Thanks for your time, see you later!