PLX-DAQ version 2 - now with 64 bit support! (and further new features)

ScapeZ:
Could you please take a look at the attached sketch and help me with the PLX-DAQ ?

Hi Jonas,
we are both German but let's keep this in English thus everyone can participate (just wanted to say I do understand your code and comments made :wink: )
What is your problem anyways? You are prompting two outputs to Serial Monitor I see. First one being in line 28 looks fine, although you just send your i variable to Excel - nothing fancy there I guess?
Next one in line 34 to 39 is a bit tricky. Do you not want to have in Excel via PLX DAQ? In that case ok, but if you want it you need to do it in the proper format (like the one in line 28). Just replace your i variable with the once for humidity and temperature.



Hugocad:
I discovered that when I connect my Arduino/Mega to my PC, when I go into the "Device Manager", in the "COM & USB" Section, my Arduino is called "USB Serial Device" while it used to be "Arduino Mega".
I thought it could come from Arduino Drivers that should be re installed for Windows 10 maybe?

Hi Hugo,

sadly I do not have any experience with Win10 and PLX DAQ / Arduino yet. Still using Win 7 :wink: but there were some users with Win10 being able to use the software I guess already. Have you tried reinstalling the drivers? As long as your Arduino is not working fine on Win10 I guess PLX DAQ would suffer recognizing the device as well and won't work. Just try to solve that one out and everything should be fine.


Greetings to both of you.

Brilliant, please keep up the great work.

Net_Devil this is great work you have done. I'm having trouble figuring out how to add more analog channels to the PLX-DAQ v2.
Arduino code:
oid loop() {
milli_time = millis();
voltTC = 5.000 * analogRead(A0) / 1024.000;
voltTH = 5.000 * analogRead(A1) / 1024.000;
voltpH = 5.000 * analogRead(A2) / 1024.000;
Serial.print("DATA,TIME,");
Serial.print(milli_time);
Serial.print(",");
Serial.println(voltTC);
Serial.print(",");
Serial.println(voltTH);
Serial.print(",");
Serial.println(voltpH);
//Serial.print(",");

delay(1000);

Is there anything I have to do in DataReady subroutine?
Thanks

Try using just the one println and see if it helps.

oid loop() {
  milli_time = millis();
  voltTC = 5.000 * analogRead(A0) / 1024.000;
  voltTH = 5.000 * analogRead(A1) / 1024.000;
  voltpH = 5.000 * analogRead(A2) / 1024.000;
  Serial.print("DATA,TIME,");
  Serial.print(milli_time);
  Serial.print(",");
  Serial.print(voltTC);
  Serial.print(",");
  Serial.print(voltTH);
  Serial.print(",");
  Serial.println(voltpH);  //last serial command uses println
  
    
  delay(1000);

Sum guy, that was it! Thanks man.

Thanks for the response! As you already assumed I only want the Temperature, Humidity and time in the Excel sheet. But sadly I have absolutely no idea how to write that in the proper format. So it would be really nice if you or anyone else could help me with it. Btw I'm sorry for taking up your time. I really appreciate your help.

DHT22.ino (1.94 KB)

Net Devil Congratulations on the excellent project!

I have an ultrasonic sensor JSN-SR04T with arduino mega 2560 connected to a raspberry pi 3B + and I want to do exactly what this solution proposes (Save the water level in a reservoir in a worksheet). Is it possible to perform the task in linux environment? Will the libre office or open office run the macro?

Thank you!

@sumguy: thank you very much for taking care!

@Jonas (ScapeZ): as already said you do have one code block in the correct format and one in the wrong format. If in doubt please take a look at the Beginners Guide which is included in the zip file as it will answer your questions. The trick is to write the code in the format "Serial.println( (String) "Buzzword1,Buzzword2,Buzzword3" + Variable1 + "," + Variable2);"

@niltonfelipe: thanks a lot :slight_smile: I am acutally running a Linux on my laptop but never really tried to get it to work with it (it is a Lubuntu with really limited processing power...). My best guess is that it won't work since PLX DAQ is heavily relying on some Windows API calls to work, but it might be that Libre or Open Office ported them to Unix. If you can, please give it a try and post your feedback :slight_smile:

Greetings to all of you.

@NetDevil

First, great product. Thank you for your efforts.

I have a project running on an ESP32 through the Arduino IDE. I set up PLX-DAQ to gather information produced by my project. All went well in collecting the data. After selecting Pause, Disconnect, I highlighted the rows to chart, and selected a chart the workbook disappeared and, moments later, restarted, without the data collected.

I am using Microsoft Excel 2019 MSO 64bit

If I copy the information, open a new workbook, paste, I am able to graph the info.

Idahowalker:
All went well in collecting the data. After selecting Pause, Disconnect, I highlighted the rows to chart, and selected a chart the workbook disappeared and, moments later, restarted, without the data collected.

I am using Microsoft Excel 2019 MSO 64bit

If I copy the information, open a new workbook, paste, I am able to graph the info.

Hi Idahowalker,
and thank you very much for your feedback :slight_smile:

Just to get this correct: "the workbook disappeared" means Excel crashed? And automatically restarted? In that case it would make sense that data was lost and maybe try saving the workbook first (either manually or with a sporadic command send from PLX DAQ [there is chapter in the Beginners Guide for that]).

Truly speaking PLX DAQ does have some stability issues which increase the more data is read or the faster data is read (baud rate). I do have an enhancement for the API calls on my bucket list, but that is already on said list for a very very long time sadly ....

Or is it really directly related to the data on the sheet? Like the macro ist pasting the data to the cells in a wrong format that crashes Excel? In that case: never heard of the problem, but I never hear of anyone using MS Excel 2019 up until now :slight_smile: Does it happen all the time? Even with very simple data (like only DATE,TIME)?

Greetings
Jonathan

NetDevil:
Hi Idahowalker,
and thank you very much for your feedback :slight_smile:

Just to get this correct: "the workbook disappeared" means Excel crashed? And automatically restarted? In that case it would make sense that data was lost and maybe try saving the workbook first (either manually or with a sporadic command send from PLX DAQ [there is chapter in the Beginners Guide for that]).

Truly speaking PLX DAQ does have some stability issues which increase the more data is read or the faster data is read (baud rate). I do have an enhancement for the API calls on my bucket list, but that is already on said list for a very very long time sadly ....

Or is it really directly related to the data on the sheet? Like the macro ist pasting the data to the cells in a wrong format that crashes Excel? In that case: never heard of the problem, but I never hear of anyone using MS Excel 2019 up until now :slight_smile: Does it happen all the time? Even with very simple data (like only DATE,TIME)?

Greetings
Jonathan

Yes, Excel crashes. I select pause to stop the data collection, then I select disconnect, my thinking is to free up resources, I then select the 3 columns of data collected, and then select Insert | Charts and then the crash occurs. If I, after selecting the 3 rows, select copy and paste the data into another workbook, things work well.

My project, I have two magnetometers connected with each plane 180 degrees out of phase with each other. Magnetometer 0 is read and its readings are stored in a structure, then magnetometer 1 is read, its readings are summed to 0 and that summation data is sent to be serial printed. The process is then set to be retriggered every 70mS after the Serial println is completed const TickType_t xFrequency = pdMS_TO_TICKS( 70 );. The uController being used is a ESP32, the task to read magnetometer 0 is set to core 0 and the task to read magnetometer 1 is set to core 1. The Arduino IDE has all the components loaded to program a ESP32 running freeRTOS. The serial prints are

 Serial.print( "DATA," );
    Serial.print( String(xMag.x) );
   Serial.print( ", " );
     Serial.print( String(xMag.y) );
     Serial.print( ", " );
    Serial.print( String(xMag.z) );
    Serial.print( ", " );
    Serial.print( "AUTOSCROLL_20" );
    Serial.println();

. I typically collect about 100 data sets before pausing and disconnecting. My development computer is running Windows 10, 3Ghz, 8GB ram, the connection is via (USB) com 4 at 115200 baud. As, I have a workaround, I consider things to be working.

I just discovered that the issue goes away if the Arduino IDE (not just serial monitor) is closed during data collection.

This projects goal is to see if 2, 3 axis magnetometers mounted with each respective axis 180 degrees out of phase with the corresponding axis, can be made to be auto calibrating.

Awesome product. Thank you very much.

First off, thank you for all your work on this software.

I am just getting my feet wet using it to read data from an Arduino reading a 32 bit encoder via SPI.

Adding the following to my sketch seems to work fine:

    Serial.println("LABEL,Encoder Counts");
    Serial.print("DATA,");
    Serial.print(encoderValue);
    Serial.println(",");

It updates one cell with the data, but it continues streaming, I really don't need that and I think it might make Excel unstable.

So, what I would like to do is create a control button in Excel that I can "click", send a command to the Arduino to take 20 readings and average them, then return the value to a cell and turn off data-logging until the control button is pushed again.

I do have the manual and I'm struggling along, but I thought someone on here might have some insight.

Any help is appreciated.

Robin2 has a must read article for you

https://forum.arduino.cc/index.php?topic=288234.0

On the PLX side providing you keep your serial connection open PLX will keep track of the current row so all you need to do is add a button to your worksheet with the following macro

Sub Button1_Click()

lngStatus = CommWrite(frmStampDAQ.cboPort.Text, "<Ready>")

End Sub

and use Robin2's code to capture the Ready string

You only need to transmit the "LABEL" instruction once and then in a loop

Serial.print("DATA,");
Serial.println(encoderValue); // adjusted to match the edit

EDIT the last line transmitted to PLX should be sent with println

sumguy,

Thanks for the input. I was placing the "LABEL" instruction in the loop to get the data to populate and refresh the data in one cell and not create a column of data. Unfortunately, this causes Excel to look a little "jumpy".

Is there a better way to do this?

I have also tried using the AUTOSCROLL_x function. A short column of data would be acceptable, but I cannot get it to work with my 2010 version of Excel. I did see the modification for AUTOSCROLL in a prior post, but that didn't work either :confused:

If you wish to restrict the data to a single cell there is a command in the manual, again you should not include "LABEL" inside the loop, "LABEL" is executed once only.

Here is the "CELL,SET" command virtually straight from the manual

Serial.print("CELL,SET,C9,");
Serial.println(encoderValue);

I don't know why auto scroll does not work for you, I may look at that sometime later.

An alternative might be to clear the data after 10 or 20 rows and start from cell 2 again.

THANK YOU!!!

I read about the "CELL,SET" command, but I assumed the "DATA" command had to be used after the "LABEL" command.

Moved the "LABEL" command out of the loop, added a version of the "CELL,SET" command and it works GREAT!

@NetDevil

It's been a while but I wanted to say thank you for all your help. I have 8 probes running at once, logging into individual sheets, and dynamically graphing as the data comes in.

Hi guys,
been quite some time, sorry for the delay! Let's get started:


@Idahowalker:
to be honest I still don't get your setup and what it should do (sounds sophisticated :wink: :grin: ) but very good to know it is working. Looking at your code the only minor optimizations which come to my mind are: eliminating the spaces after each explicit "," wrote and using the println already with the AUTOSCROLL line and not dedicated with a blank string. Maybe but just maybe the String(xMag.x) prints the value comma separated and not dot separated as Excel would expect? In case it is comma separated PLX DAQ might interpret that as a delimiter. You can check what is actually received in the DirectDebugWindow.


@sumguy:
Thanks once more for helping the people out here! Karma to you :slight_smile:
To solve the mystery of AUTOSCROLL, the functions used by the VBA macro got added to Excel with Office 2013, thus versions prior to that do not support the feature. There is hardcoded check in PLX DAQ to skip the call if an earlier version is detected.

'## Check for AUTOSCROLL command and handle
If (InStr(1, UCase(DataVal(x)), "AUTOSCROLL_", vbBinaryCompare) >= 1) Then
    DontPostDataThisIteration = True ' Autoscroll will not be posted to sheet
    If (ActiveSheet.Name = WStoUse.Name And Split(Application.Version, ".")(0) >= 15) Then
        '## Autoscroll command checks should only be done if the currently active sheet is the sheet where data is pasted to
        '## Autoscroll command was added in Office 2013 (version 15.0) - dont use for earlier versions)
        Dim offset As String
        offset = Trim(Mid(DataVal(x), InStr(1, DataVal(x), "AUTOSCROLL_", vbBinaryCompare) + Len("AUTOSCROLL_"))) 'get value right side of "AUTOSCROLL_"
        If (IsNumeric(offset)) Then
            If ((row - offset) >= 1 And (row - offset) <= ActiveSheet.Rows.Count) Then 'if row - offset is too low (< 0) or too high ( > max row possible) set to row
                ActiveWindow.ScrollRow = row - offset
            Else
                ActiveWindow.ScrollRow = 1
            End If
        End If
    End If
End If

Sadly I missed putting that information in the post and in the Beginners Guide .... sorry for that ... I've updated the information in the v2.11 Release Post.


@Snaggles:
good to know. That should be one of the more complex setups build with the tool => gratulations :slight_smile: do you mind posting some screenshots of it as an inspiration?
On top: what is your baud setup and runtime and PC setup? As told multiple times PLX DAQ does have stability issues when it comes to much data or fast data or long running logging. You seem to have a good balance on the setup :slight_smile:

Hi all,

I'm trying to use PLX DAQ 2.11 on my new windows computer, 64 Bit Windows Pro and the newest version of excel. I'm using an Arduino Uno board with it.

The PLXDAQ works for a bit but on data capture at about line 3400 or so it crashes excel. I have tried various things to see if it was on my end but it seems to repeat every time.

Anyone else having this issue or have any advice?

Also, here is the code I'm running on the Arduino:

unsigned long prevMillis;

int buttonPushCounter = 0;
int sensorValue = 0;  // variable to store the value coming from the sensor

const byte sensorPin = A0;
const byte buttonPin = 2;
const byte ledPin = 13;

byte buttonState = 0;
byte lastButtonState = 0;

bool start = false;

//**************************************************************************************************************
void setup()
{
  Serial.begin(9600);
  Serial.println("CLEARDATA"); //clears up any data left from previous projects
  Serial.println("LABEL,Time,Timer,Sensor Value"); //always write LABEL, so excel knows the next things will be the names of the columns
  Serial.println("RESETTIMER"); //resets timer to 0

  pinMode(ledPin, OUTPUT);

  pinMode(buttonPin, INPUT);
  lastButtonState = digitalRead(buttonPin);

} //END of setup()

//**************************************************************************************************************
void loop()
{
  //****************************
  //check the switch every 50ms
  if (millis() - prevMillis >= 50)
  {
    //restart timer
    prevMillis = millis();

    checkSwitch();
  }

  //****************************
  if ( start == true)
  {
    sensorValue = analogRead(sensorPin);
    //writes the time in the first column A and the time since the measurements started in column B
    Serial.println(String("") + "DATA,TIME,TIMER," + sensorValue);
  }
  //****************************

} //END of loop()


//**************************************************************************************************************
void checkSwitch()
{
  buttonState = digitalRead(buttonPin);

  //Compare the buttonState to its previous state
  if (buttonState != lastButtonState)
  {
    //update to the new state
    lastButtonState = buttonState;

    //if button state is pushed
    if (buttonState == HIGH)
    {
      buttonPushCounter++;
      digitalWrite(ledPin, HIGH);

      //enable printing
      start = !start;
    }
  }
  
} //END of checkSwitch()

kcpilotguy:
Hi all,

I'm trying to use PLX DAQ 2.11 on my new windows computer, 64 Bit Windows Pro and the newest version of excel. I'm using an Arduino Uno board with it.

Have you tried closing the Arduino IDE before trying to collect data?