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

Hi Martin,

oh boy wow this really did an unexpected turn to the better :slight_smile: I am so grateful for your answer! :slight_smile:
First of all, no damage done, all is good and I really still appreciate you replying to my mail 3 1/2 years ago and being where we are now due to your kind actions back then.

Actually I have written an email to the webmaster of Parallex in November 2016 informing them about this "new version" and asked them if they would be fine with placing a link on their download section - but never received an answer :-/ I just wasn't sure to write you as well... guess there went some potential down the drain, sorry for that...

Yeah so next to replacing the Stamp with the API calls and extending it to be 64 bit ready (PointerSafe) I implemented some more function calls and configuration possibility. I totally agree that it gets kind of "overloaded" on the UI even though I tried to hide the DirectDebugWindow by default.

I was always looking at some improvements in the API calls since this version comes with some stability issues with regards to high input of data (e.g. receiving data every 5ms). If I would have ever found the time to tackle that general API handling with promising looking other code I found I would have thought about an UI rework as well. But yeah, never actually found the time and most people could live with 9600 baud and adding a 100ms delay to their code.

That said, if you really get in touch with Parallex and would like to give the program a new boost I will gladly assist and try to arrange some time for it. I once even started a "backlog" over the now 28 pages to collect improvement ideas and community requests. Just saying :wink:

Really looking forward hearing from you and all the best from Germany

Jonathan

Jonathan,
It can’t push 9600 baud or data faster than 5mS?

In tests on my new release I was running 256000 with no Arduino delay, getting a string processed every .667 mS. Now, any disruption in it’s processing would cause it to crash lol. But that’s the trade off.

I used a comms API module written by David M. Hitchner (with permission). Took a break from recoding, totally from scratch, MakerPlot in Java to do it

No no, don't get me wrong. Technically it can receive way faster baud rates. I have had successful tests with an Arduino Uno and 1.000.000 baud.
But it is important to have a balance between baud and delays as I have had reports about crashes over the years when way too much data was being received in way too little time.

The code that is running in v2 is also from David M. Hitcher (as mentioned in the credits :slight_smile: ) but as said has some problems with buffering I guess. I was never able to get the perfect balance with baud to delay or figure out where in the code the problems were. I don't think you will go through all pages of this thread but there are several issues mentioned as well as some excessive back-and-forth testing with different values (especially in the early days).

So this other implementation I once found is sadly of unknown source. <Edit: ok, board told me I can not upload xlsm files - will send it to you via mail>
They rather used a "click to fetch data" approach instead of a constant stream. But I did some tries with spamming the "Empfangen" (receive) button top left hand side and it never crashed. So I wanted to try to adopt that API implementation into v2 as it looks promising.

Hi NetDevil,

First of fine work. Pardon me as I did not really go through all conversations on this thread but I would like to know if your PLX-DAQ v2 is able to auto save file?

Some context of my project,

It is a datalogger logging 24/7 by the second. Sorry if this is too much to ask but,

  1. Can it auto save current excel file after a daily set time with a specific file name (lets say today's date)?

  2. Then it deletes all data and start from 1st row again.

  3. Once it reaches its daily set time once again (the next day), this cycle repeats.

And I would have something like this shown in attached picture. I'm able to do this if I save to SD (I have a sd card logger shield) but really uncertain about doing it through serial as I'm making this wireless using NRF24L. I want to eliminate the need to manually collect the data from the SD card shield which is located far away.

sample.PNG

I'm doing this because I want daily data file. Thus since by the seconds in a day, meaning max about 86400 rows per excel file.

I've tried using Teraterm through log rotate. It's sort of close but isn't really what I'm looking for and am not satisfied haha. It just adds .1, .2, .3 to the file once it reaches a specific file size limit.

Thank you for reading and much thanks NetDevil or any others whom are able to help me out.

sample.PNG

Hi imagination,

thanks for the kind words and sure, I can not expect anyone to go through 28 pages of thread to find each and every information :slight_smile:

Let's go for it:

  1. Can it auto save current excel file after a daily set time with a specific file name (lets say today's date)?

You can use the SAVEWORKBOOKAS command, this will store a copy of the current workbook by a name passed from Arduino to Excel. Please take a look at the Beginners Guide of PLX DAQ included in the downloadable ZIP file.
E.g. serial.println("SAVEWORKBOOKAS","today"); will save a "today.xlsm" copy. In case you are using a Real Time Clock module on your Arduino and have the date you can use it as a parameter. Otherwise you could only take a counter for the files. Or if you are familiar with coding (which I guess you are :slight_smile: ) you can take a quick look at the code of PLX DAQ (open Excel, hit F11, expand forms, right click on frmStampDAQ and view code) and take a look at the "SAVEWORKBOOKAS" command

ThisWorkbook.SaveCopyAs ThisWorkbook.Path & "\" & DataVal(1) & ".xlsm"

with e.g.

ThisWorkbook.SaveCopyAs ThisWorkbook.Path & "\" & "myExcels_" & Replace(Date, ".", "-") & ".xlsm"

By that it would save as "myExcels_2020-07-04.xlsm" or however you would like to have it.
But generally speaking this is a valid extension I should add in the next version, yes.

  1. Then it deletes all data and start from 1st row again.

sure, just use code "CLEARDATA" ==> serial.println("CLEARDATA");

  1. Once it reaches its daily set time once again (the next day), this cycle repeats.

Not by default. no. The command has to come from Arduino. Once more, in case you are using a Real Time Clock you can take that.
In case you just want to save every 24h you could use millis() and every 86,400,000 you just send the SAVEWORKBOOKAS command.

Something like this (caution! pseudo code!)

unsigned long lastSave:

void start() {
lastSave = millis(); // inital start
}

void loop() {

if (millis() - lastSave >= 84000000) { // do something every day
   serial.println( (String) "SAVEWORKBOOKAS","myName");
   serial-println("CLEARDATA");
   lastSave = millis();
}
if( millis() < lastSave) { lastSave = 0; } // after 49 days millis rolls over, revert lastSave as well

As it takes millis 49 days to overflow I tried to come up with a way to handle that and revert lastSave back to 0 as well. But by that you might have more then 1 day between the intervals as it rolls over at 49-something days. Let's say there is half a day missing. Next save will be one day later then, thus that day would be 1,5 days long.... To avoid that it would get complicated. You could store the diff from lastSave to overflow in a separate value and add that to millis() for the new day 1 save.
Or just restart your Arduino every 49 days :slight_smile:


In case of any further questions please feel free to ask.

Greetings

Jonathan

NetDevil:
Hi imagination,

thanks for the kind words and sure, I can not expect anyone to go through 28 pages of thread to find each and every information :slight_smile:

Let's go for it:
You can use the SAVEWORKBOOKAS command, this will store a copy of the current workbook by a name passed from Arduino to Excel. Please take a look at the Beginners Guide of PLX DAQ included in the downloadable ZIP file.
E.g. serial.println("SAVEWORKBOOKAS","today"); will save a "today.xlsm" copy. In case you are using a Real Time Clock module on your Arduino and have the date you can use it as a parameter. Otherwise you could only take a counter for the files. Or if you are familiar with coding (which I guess you are :slight_smile: ) you can take a quick look at the code of PLX DAQ (open Excel, hit F11, expand forms, right click on frmStampDAQ and view code) and take a look at the "SAVEWORKBOOKAS" command

ThisWorkbook.SaveCopyAs ThisWorkbook.Path & "\" & DataVal(1) & ".xlsm"

with e.g.

ThisWorkbook.SaveCopyAs ThisWorkbook.Path & "\" & "myExcels_" & Replace(Date, ".", "-") & ".xlsm"

By that it would save as "myExcels_2020-07-04.xlsm" or however you would like to have it.
But generally speaking this is a valid extension I should add in the next version, yes.
sure, just use code "CLEARDATA" ==> serial.println("CLEARDATA");
Not by default. no. The command has to come from Arduino. Once more, in case you are using a Real Time Clock you can take that.
In case you just want to save every 24h you could use millis() and every 86,400,000 you just send the SAVEWORKBOOKAS command.

Hi Jonathan,

Much thanks for your reply. I have now attached a DS3231 rtc module onto my arduino and now I can set at what time during the day I would like it to run the command SAVEWORKBOOKAS.

However when I tried it with your mentioned code that I changed in the PLZ DAQ code,

It doesn't work to save as a new file under today's date :confused: but if i revert back to original alt+f11 code it does save as to filename specified (eg. "file"). In both cases the CLEARDATA works fine.

What could I be doing wrong here? :cry: I don't think I quite understand how the code in alt+f11 works haha. I'm not so familiar with coding as per you assumed sorry :sweat_smile:

Also if i open the saved as file while current PLX DAQ is still running collecting data, it sorts of interferes with it? As in if i close that opened saved as file, it'll disconnect my serial connection and when I want to reconnect, it'll give me this error prompt.

error.PNG

Does this mean I can't open any other excel files while PLX DAQ is running? :disappointed_relieved:

error.PNG

Hi imagination,

well yeah, Excel is very picky when it comes to running multiple instances while one is doing heave operations (e.g. macros). Basically if you have one workbook open and are writing in a cell you can't even open a second workbook as long as you do not jump out of that active cell. It is a mess in Excel ....

And while the macro is running and you are starting a second instance it will interfere with the two same macros being in both books -.-
So a way would be to store the copy without macros. It is a bit tricky but give it a try with this code:

    Application.DisplayAlerts = False
    Dim name As String
        name = "myTestFile"
    ThisWorkbook.SaveCopyAs ThisWorkbook.Path & "\" & name & ".xlsm"
    Dim Wb As Workbook
    Set Wb = Application.Workbooks.Open(ThisWorkbook.Path & "\" & name & ".xlsm")
    Wb.SaveAs ThisWorkbook.Path & "\" & name & ".xlsx", xlOpenXMLWorkbook
    Wb.Close SaveChanges:=False
    Kill ThisWorkbook.Path & "\" & name & ".xlsm"
    Application.DisplayAlerts = True

This just suppresses any warnings from excel, then saves a copy with macros (xlsm), opens that file in background and saves without macros (xlsx) and then deletes the temporary macro excel and allows warning messages again.

Of course we need to solve your issue with the date not being displayed.
In VBA editor, hit Ctrl+G and a window will appear at the bottom (direct window or something like that, also available via menu 'view' => 'direct window'). There type "msgbox date" and hit enter. It will show you a textbox of your date format. If you go with "msgbox replace(date,".","-")" it should give you a date format but replace all dots with hyphens. My idea was to have a cleaner filename while storing.
If it causes troubles you can just go with

Dim name As String
        name = "myDownTime_" & Date

Hi NetDevil (Jonathan),

I tried your codes and it does save it as non-macro enable workbook.

However when I open any other excel workbook and it remains open, the PLX DAQ datalogger continues running.

But when I close any other workbook, it stops the datalogging and if I click connect, it comes out the error as I mentioned earlier. Is this normal and if it is, is there another workaround? :sweat_smile:

*****UPDATE:

If i close by clicking the top right "X" to close my opened non-macro excel, it shuts of PLX DAQ & unable to reconnect.

But if i go to FILE, then click CLOSE it does not affect anything at all and my PLX DAQ continues to run smoothly hmmmm...

I think my issue now is that my date format cannot be changed from dd/mm/yyyy and thus it will not save. I tried "msgbox replace(date,".","-")" but the format remains the same, does not change.

****EDIT:

HAHA I found out why already after googling, now I understand the replace code -.-

My date format is default at dd/mm/yyyy and thus my replace code should be,

replace(date,"/","-") instead of your given one.

It works great now to save to today's date!!! :smiley:

now just gota figure out my issue above :sweat_smile:

Hi imagination,
well looks like you did a lot of research on your own already, well done :slight_smile:

Using "" or "/" within a file name is not allowed with windows, thus the file couldn't be stored. I thought about that and that is why I asked for the "msgbox date" output. But perfect solution on your own :clap-clap:

With regards to Excel crashing when using the X instead of File => close I really don't know. That is news to me as well. But I appreciate your input and idea on that. Is it working fine that way?
I could think of the fact that when using the X to close Excel starts some heavy operations with cleaning up the instance of Excel and switching window handles and all kind of stuff and maybe that just kills the macro running in the second instance.
But is all working fine for you?

Hi NetDevil,

Yes it is working fine if I close any opened excel file through File -> close.

Using X completely stops PLX DAQ and have error reconnecting which requires me to close the PLX DAQ excel file and re-open to be able to reconnect again.

I guess so far that's it from me until I have further questions.

Thank you very very much.

Hi again NetDevil,

Need your assistance for me to save this as a .csv file with macro disabled.

Tried modifying your code in alt+F11 abit but can't figure it out :sweat_smile:

Thank you.

Hi imagination

so this is rather an Arduino unrelated problem, as well as PLX DAQ unrelated.
Never done it before but a quick Google search I found this snippet:

ActiveWorkbook.SaveAs Filename:="C:\Temp\Fredi.csv", FileFormat:=xlCSV, CreateBackup:=False, local:=True

I would suggest trying that. Changing the extension in your filename to end with ".csv", setting the FileFormat to xlCSV and adding this local attribute with true value.

In case it does not work altering the code try repeating the opening of the xlsx workbook and then saving as csv (thus from copy with macros to xlsx version to csv version).

I have loaded and run PLX-DAQ V2.11 and checked if it is communicating with the ARDUINO UNO. Looking at the debug screen on the PLX-DAQ control panel I can see all the data coming through correctly but I do not get anything on the spread sheet. Can you please advise. Mike

Hi Mike,
I guess you are not using the correct syntax. Syntax is like Serial.println( (String) "DATA,DATE,TIME,MyVar1,MyVar2," + millis () );

Just give it a try and start experimenting from there. You can take a look at the Beginners guide attached to the 2.11 post where everything is explained

Greetings

Jonathan

I have a problem with PLX-DAQ program.
I'm trying to data stream from a ARDUINO to Excel and it worked once but then stopped logging the data to the spread sheet. I have downloaded a sample project and run it ok but when I tried a small change to a Serial.print statement it stopped logging to the spread sheet. So I reloaded the sample program and tried again but it still would not log to the sheet. I then tried using the Data Streamer in Excel and that worked ok and proved the ARDUINO is communicating with Excel is working.
I've checked all the port settings and the program, I reloaded the PLX-DAQ program again, Iv'e rebooted the PC nothing seems to work.
Any suggestion would be appreciated as I've spent almost two days trying to get it working successfully.

Mike Boddy

I'm getting desperate, how can I find out what the problem is with my system.

I cannot get the data to transfer to the spread sheet, I see it on the PLX-DAQ diagnostic screen but not on the spread sheet.

I tried using the Date Streamer in Excel and that worked, so what am I doing wrong in the PLX-DAQ program.

Is there a special print formats I have to write in the ARDUINO, I checked it with a sample project and I have all the Serial.begin and print commands correct and now don't know what to check next.

Please please give me some sort of clue of what to look for or check.

Frustrated

Mike

Hi Mike

the screenshot "ARDUINO.jpg" shows you using the old v1 of PLX DAQ, that is not a good idea at all.

The other screenshot ("ARDUINO1.jpg") is with my V2.11

Hi Mike

the screenshot "ARDUINO.jpg" shows you using the old v1 of PLX DAQ, that is not a good idea at all.

The other screenshot ("ARDUINO1.jpg") is with my v2.11 - that's better :slight_smile:

You are still not using the direct Serial.println syntax. It is the correct syntax for Arduino to compile without errors, but not for PLX DAQ to interpret it. Please take a look at what I have written above.

To print data to the spreadsheet please start each transmit with the DATA keyword, followed by either placeholders like DATE or TIME (which will get converted to the real current date or time before writing it to the spreadsheet) or with your variables.

The Beginners Guide is quite handy for situations like this. Take 5 minutes to read through it and you will be able to solve all your problems by yourself.

Please give it another try or post your code for me to have a look at.

Greetings

Jonathan

Hi NetDevil

First of all, thank you for your work.

I have a problem, I want to acquire the information from two different arduino boards on two different excels on the same computer at the same time but when I run the software on both excels, only one excel writes the information while the two are well connected. When only one of the two is connected everything works fine.
Sorry for my English, I'm French :RÉ

Thank you in advance

Best regards,

Leo