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

Hi, I'm in need of some help with using this PLX-DAQ software and Excel, I'm a complete blank slate when it comes to programming or coding and I would really appreciate the help.

I'm conducting an experiment which I need to measure people's skin conductance and I'm doing it with Arduino, I'm going to provide the link to where I got the idea from to measure skin conductance using Grove-GSR Sensor here so that anyone willing to help can get an idea of where I'm coming from. (Grove - GSR Sensor | Seeed Studio Wiki)

I'm using the code for Arduino IDE and not the raspberry pi.

My problem here is that I do not know how to transfer the data that I've obtained from the serial plotter into Excel. I've done some reading on guides on how to but I've still no idea on how to do it, as I'm completely new in this..

Any help is very much appreciated and I know I'm asking to be spoon-fed here but I'm really out of options.

Thanks in advance.

Hi Jason,

good thing you pointed out yourself how spoon-fed the issue sounds - otherwise I might have done that :slight_smile:

The good news on the other hand is, that as long as your data can be posted to Serial Monitor in Arduino IDE it can be posted to Excel as well using PLX DAQ. All you have to do is replace your "Serial.println(yourOutputHere);" commands with the PLX DAQ syntax which basically is "Serial.println("DATA,ValueForColumnA,ValueForColumnB,ValueForColumnC,....,ValueForColumnX");

You can read all about it in the Beginners Guide that is attached to the zip file or attached to the v2.11 post.

Try starting with the default sketch and try to understand the syntax. All it does is spam data in a loop to Excel, just the same way you want to send data. Next step, try to change the data to some different values and the final step is to implement the data you have measured using your build.

In case you have any specific questions rather then general ones please feel free to post here.

Greetings

Jonathan

NetDevil:
Hi Jason,

good thing you pointed out yourself how spoon-fed the issue sounds - otherwise I might have done that :slight_smile:

The good news on the other hand is, that as long as your data can be posted to Serial Monitor in Arduino IDE it can be posted to Excel as well using PLX DAQ. All you have to do is replace your "Serial.println(yourOutputHere);" commands with the PLX DAQ syntax which basically is "Serial.println("DATA,ValueForColumnA,ValueForColumnB,ValueForColumnC,....,ValueForColumnX");

You can read all about it in the Beginners Guide that is attached to the zip file or attached to the v2.11 post.

Try starting with the default sketch and try to understand the syntax. All it does is spam data in a loop to Excel, just the same way you want to send data. Next step, try to change the data to some different values and the final step is to implement the data you have measured using your build.

In case you have any specific questions rather then general ones please feel free to post here.

Greetings

Jonathan

Hi there, thanks very much for the reply, I still haven't solve the problem but I have a rough idea of how the code and program works, I just have one last problem.

I've just made a little tweak towards the original code I got from the website.

const int GSR=A0;
int sensorValue=0;
int gsr_average=0;

void setup() {

Serial.begin(9600);

Serial.println("CLEARDATA");

Serial.println("LABEL,SkinConductance,Time,TIMER");

Serial.println("RESETTIMER");

}

void loop(){
long sum=0;
for(int i=0;i<10;i++) //Average the 10 measurements to remove the glitch
{
sensorValue=analogRead(GSR);
sum += sensorValue;
delay(5);
}
gsr_average = sum/10;
Serial.println( (String) "DATA,gsr_average,TIME,TIMER,AUTOSCROLL_20" );
}

All of the above was able to be recorded in Excel like the time and timer except for the gsr_average value, instead it records the literal word "gsr_average" instead of the value. Am I doing something wrong here? Sorry for the noob questions.

I am so excited about this package! Thanks for the wonderful work, NetDevil.

Did anybody report that the following println code consume so much memory?

// set the names for the 3 checkboxes
Serial.println("CUSTOMBOX1,LABEL,Stop logging at 5 min?");
Serial.println("CUSTOMBOX2,LABEL,Resume log at 360?");
Serial.println("CUSTOMBOX3,LABEL,Quit at 3600?");

// check 2 of the 3 checkboxes (first two to true, third to false)
Serial.println("CUSTOMBOX1,SET,1");
Serial.println("CUSTOMBOX2,SET,1");
Serial.println("CUSTOMBOX3,SET,0");

The following is with them included:

Global variables use 1642 bytes (80%) of dynamic memory, leaving 406 bytes for local variables. Maximum is 2048 bytes.
Low memory available, stability problems may occur.

and with them commented out:

Global variables use 1484 bytes (72%) of dynamic memory, leaving 564 bytes for local variables. Maximum is 2048 bytes.

jasonn0413:
I just have one last problem.

Serial.println( (String) "DATA,gsr_average,TIME,TIMER,AUTOSCROLL_20" );

All of the above was able to be recorded in Excel like the time and timer except for the gsr_average value, instead it records the literal word "gsr_average" instead of the value. Am I doing something wrong here?

Hi Jason,
thanks for digging into the documentation and congratz on making it (nearly :slight_smile: ) work.
The issue is you literally put your variable name in the string. Try changing it to:

Serial.println( (String) "DATA," + gsr_average + ",TIME,TIMER,AUTOSCROLL_20" );


@cryotan:
thank you very much for your feedback.
And well, no, that issue has never been brought up yet :slight_smile: So let's see:

  • first of all the amount of memory consumed depends on your Arduino. I am developing on an Arduino Uno (which is already pretty weak) but honestly I have never paid much attention to those warnings.... is 2048 the max for all kind of Arduinos? The Mega2560 for example seems to have 4 times the SRAM.
  • Excluding the command will most likely free up the space that would normally be allocated for the large strings. However if one wants to label the command boxes I guess there is no other way then to hardcode the names :-/ or one could put the information to Excel and query + rewrite it (would be only commands stored in Arduino).
  • I guess the boxes will be rarely used and hopefully people will reduce code only to what is needed :slight_smile: otherwise Arduino might be able to page swap - or does it not compile if > 100% are used?

Greetings to both of you.

@NetDevil Thanks for your prompt reply. I have a 4 channel temperature shield and it fails when the memory reaches the limit. I have to drop those Serial.print lines for it to operate.

@NetDevil I want to replace the customcheckbox 1 and 2 with two set of spinbutton and textbox; and use GET from arduino to set sampling frequency and recording duration. i need some help with VB script. How do I save the last config values in settingsheet?

Private Sub SpinButton1_Change()
On Error Resume Next
TextBox1.Text = SpinButton1.Value
End Sub

Private Sub TextBox1_Change()
On Error Resume Next
SpinButton1.Value = TextBox1.Text
End Sub

Private Sub SpinButton1_SpinDown()
   TextBox1.Text = Val(TextBox1.Text) - 1
End Sub
Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
   Select Case KeyAscii
     Case vbKey0 To vbKey9, 8
     Case Else
       KeyAscii = 0
       Beep
   End Select
End Sub

Private Sub SpinButton1_SpinUp()
   TextBox1.Text = Val(TextBox1.Text) + 1
End Sub

Private Sub SpinButton2_Change()
On Error Resume Next
TextBox2.Text = SpinButton2.Value
End Sub
Private Sub TextBox2_Change()
On Error Resume Next
SpinButton2.Value = TextBox2.Text
End Sub

Private Sub SpinButton2_SpinDown()
   TextBox2.Text = Val(TextBox2.Text) - 1
End Sub

Private Sub SpinButton2_SpinUp()
   TextBox2.Text = Val(TextBox2.Text) + 1
End Sub

Private Sub TextBox2_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
   Select Case KeyAscii
     Case vbKey0 To vbKey9, 8
     Case Else
       KeyAscii = 0
       Beep
   End Select
End Sub

@NetDevil

This is some really good work you have done here. I've been going over the guide and demo code all morning. You deserve more than karma and kudos for the work! Before I get too far in experimenting with the demo code, I would like to know if what I'm trying to do is possible using PLX-DAQ and the cell.get.xx command. Instead of using it for data logging, I need to scroll through a list of numbers in Excel, multiple columns, multiple rows, values 1-124. Each row has two cells/values that need to trigger a specific LED on an 8x16 NeoPixel LED Matrix (two 8x8 in a row). As you scroll down the list active row/cell it shuts off the last LED's from the previous row and turns on the new. It sounds fairly simple, but the exchange from Excel to Sketch is my road block. Is what I'm trying to do possible with the chosen hardware? Thank you for your time and excellance!

Photo Album, WIP

Wondering if somebody can help with this. I am playing with CustomDevPointNewData to stop logging at certain duration (set at a textBox). I am thinking to get the millis or timer from the newdata string to pause the logging! But never can get it to work. Any help will be appreciated!!

Hi 30percent,

30percent:
You deserve more than karma and kudos for the work!

Thanks a lot :slight_smile: that is my I published under the beer license. Come to Germany and toast me a Hefeweizen (Wheat beer) if you like :wink: You are more then welcome.

30percent:
Before I get too far in experimenting with the demo code, I would like to know if what I'm trying to do is possible using PLX-DAQ and the cell.get.xx command.

Ok let's get to the real work here :slight_smile:
It is actually possible, yes. As you know the dimensions of your matrix in Excel you can create a loop counter in Arduino to go from x to y and from column a to b and read the value, wait for the response, act according to it and move on. However I fear the delay between request and response might be pretty long. Also it requires some tricky programming because you can either a) request-and-wait for the response (which would block the execution of all other code) or b) request, set a global variable to name to current LED you are looking for, continue with the standard Arduino loop all over as long as you have no response, once you get the response react on it (as you know which LED you are currently operating on) and move on to the next LED.
How frequent do you want to change the LEDs? Like 24 times per second to show a movie or like playing Tetris and changing some of them once per second?
I would really like to know if it works :slight_smile:



Hi cryotan,
well let's see:

cryotan:
I am playing with CustomDevPointNewData to stop logging at certain duration (set at a textBox). I am thinking to get the millis or timer from the newdata string to pause the logging! But never can get it to work.

Why not read the value from the textbox to Arduino and stop sending log data there once the value is reached?
Otherwise "CustomDevPointNewData" can be used, sure. It is called each and every time a DATA command is received. Simply split up the information passed to function by the "," and select n-th part (your millis-part, e.g. the 4-th one in "DATA,TIME,DATE,millis(),Something,Something")), compare that to the value in your textbox and in case it is larger return a "false" by the function. As far as i know (got no access to the code at the moment) that should prevent PLX DAQ from logging. Otherwise just create a global variable on your own and set it to false and expand my function that actually writes to the sheet to check that variable. Or if you are comfortable with completely stop PLX DAQ from running programmatically click the "Stop logging" button (something like btn_loggin.click() or stuff like that).

cryotan:
I have a 4 channel temperature shield and it fails when the memory reaches the limit. I have to drop those Serial.print lines for it to operate.

Ok that is though. Would you mind doing me the favor to check how much memory my demo sketch takes upon just by itself? The 8% for that few lines is though but there won't be any good workaround in case someone really needs to use those boxes as the command is pretty long itself already....

cryotan:
How do I save the last config values in settingsheet?

That is kind of tricky ... on load there is a function that looks up all values on the (hidden in Excel) sheet and puts them into variables. Just look for the function that has multiple identical lines - it was dirty coding :wink: Saving to the sheet by VBA is pretty simple. It is just Sheetname.cells(row,column).value = YourValue. That's all.


Greetings
Jonathan

Hefeweizen! We are definitely on the same page Sir. The night is on me if I ever make it to German. Salute!

I will be working on this all day. Hopefully have something to share later. The operation I need this for is much slower, manually controlled between LED changes approximately 10sec to 2 minutes apart. I think option B) is where I'll start. I will create global variables for each x,y LED and have the value in the cell trigger the variable/turn on the LED until the next row/cell is selected. Unfortunately its not for anything as cool as animation or imaging. This is to control LED light through hundreds (124x2)of 1mm fiber optic end light cable strands and turn off/on individual strands from each matrix from Excel. There are some photos in the album attached above showing some 3D printed parts securing the fiber strand. When I get the software operational, mechanical won't take long to finish so I can share the complete project/purpose, (o.-).

Off topic, Are you signed up on Code Mentor?

@NetDevil Hi Jonathan,

The memory consumption for the full default sketch:

Sketch uses 5258 bytes (16%) of program storage space. Maximum is 32256 bytes.
Global variables use 844 bytes (41%) of dynamic memory, leaving 1204 bytes for local variables. Maximum is 2048 bytes.

and after removing the following lines:

// set the names for the 3 checkboxes
 //  Serial.println("CUSTOMBOX1,LABEL,Stop logging at 250?");
 //  Serial.println("CUSTOMBOX2,LABEL,Resume log at 350?");
 //  Serial.println("CUSTOMBOX3,LABEL,Quit at 450?");

 // check 2 of the 3 checkboxes (first two to true, third to false)
 //  Serial.println("CUSTOMBOX1,SET,1");
 //  Serial.println("CUSTOMBOX2,SET,1");
 //  Serial.println("CUSTOMBOX3,SET,0");

Sketch uses 5054 bytes (15%) of program storage space. Maximum is 32256 bytes.
Global variables use 688 bytes (33%) of dynamic memory, leaving 1360 bytes for local variables. Maximum is 2048 bytes.

Hi NetDevil,

I'm hoping that you or anyone can help me.

I'm will be running 8 probes (only 2 for now) and I can get data to go into Excel great. I even have it able to tell me which probe is with which data. The only problem is that it all goes into 1 sheet and I really would like it to go to their own sheets based off of which probe it's reading from.

I tried CELL,SET,ONSHEET but that didn't work the way I wanted. I'm thinking that I might have to do some VBA in the Excel sheet but I'm a little lost there as well.

Thanks!

This is what I have now:

// WhiteBox Labs -- Tentacle Shield -- I2C example
// www.whiteboxes.ch
//
// How to retrieve continuous sensr readings from op to 8 Atlas Scientific devices on the I2C bus
// and send the readings to a host computer via serial.
//
// This code is intended to work on all 5V tolerant Arduinos. If using the Arduino Yun, connect
// to it's usb serial port. If you want to work with the Yun wirelessly, check out the respective
// Yun version of this example.
//
// USAGE:
//---------------------------------------------------------------------------------------------
// - Set all your EZO circuits to I2C before using this sketch.
//    - You can use the "tentacle-steup.ino" sketch to do so)
//    - Make sure each circuit has a unique I2C ID set
// - Adjust the variables below to resemble your setup: TOTAL_CIRCUITS, channel_ids, channel_names
// - Set host serial terminal to 9600 baud
//
//---------------------------------------------------------------------------------------------
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------------------------
//
//Adapted with PLX-DAQ V 2
//
//---------------------------------------------------------------------------------------------

#include <Wire.h>                     // enable I2C.

char sensordata[30];                  // A 30 byte character array to hold incoming data from the sensors
byte sensor_bytes_received = 0;       // We need to know how many characters bytes have been received

byte code = 0;                        // used to hold the I2C response code.
byte in_char = 0;                     // used as a 1 byte buffer to store in bound bytes from the I2C Circuit.

#define TOTAL_CIRCUITS 2        // <-- CHANGE THIS | set how many I2C circuits are attached to the Tentacle shield(s): 1-8

int channel_ids[] = {97, 98};// <-- CHANGE THIS.
// A list of I2C ids that you set your circuits to.
// This array should have 1-8 elements (1-8 circuits connected)

char *channel_names[] = {"Probe 1", "Probe 2"}; // <-- CHANGE THIS.
// A list of channel names (must be the same order as in channel_ids[])
// it's used to give a name to each sensor ID. This array should have 1-8 elements (1-8 circuits connected).
// {"PH Tank 1", "PH Tank 2", "EC Tank 1", "EC Tank2"}, or {"PH"}

/*
   Setup Save Workbook Timer
*/

unsigned long previousMillis = 0;
const long interval = 30000;

/*
   End Save Workbook Timer
*/

void setup() {                      // startup function
  Serial.begin(9600);                // Set the hardware serial port.
  Wire.begin();                // enable I2C port.


  //Serial.println("CLEARDATA"); // Clears starting at row 2
  Serial.println("CLEARSHEET"); //Clears sheet Probe 1 starting at row 1


  //Define Columns
  Serial.println("LABEL,Time,Timer,Probe,mg/L 02,");

  //Set the names for the 3 checkboxes
  //Serial.println("CUSTOMBOX1,SET,0");
  //Serial.println("CUSTOMBOX2,SET,0");
  //Serial.println("CUSTOMBOX3,SET,0");

}

void loop() {
  //Read Probe Data
  for (int channel = 0; channel < TOTAL_CIRCUITS; channel++) {       // loop through all the sensors

    Wire.beginTransmission(channel_ids[channel]);     // call the circuit by its ID number.
    Wire.write('r');                              // request a reading by sending 'r'
    Wire.endTransmission();                            // end the I2C data transmission.

    delay(1000);  // AS circuits need a 1 second before the reading is ready

    sensor_bytes_received = 0;                        // reset data counter
    memset(sensordata, 0, sizeof(sensordata));        // clear sensordata array;

    Wire.requestFrom(channel_ids[channel], 48, 1);    // call the circuit and request 48 bytes (this is more then we need).
    code = Wire.read();

    while (Wire.available()) {          // are there bytes to receive?
      in_char = Wire.read();            // receive a byte.

      if (in_char == 0) {               // null character indicates end of command
        Wire.endTransmission();         // end the I2C data transmission.
        break;                          // exit the while loop, we're done here
      }
      else {
        sensordata[sensor_bytes_received] = in_char;      // append this byte to the sensor data array.
        sensor_bytes_received++;
      }
    }

    //End Read Probe Data

    //Print Probe Data

    Serial.println(':');

    switch (code) {                          // switch case based on what the response code is.
      case 1:                               // decimal 1  means the command was successful.
        Serial.println( (String)"DATA,TIME,TIMER," + channel_ids[channel] + "," + sensordata + ",AUTOSCROLL_20");       // print the actual reading
        break;                                // exits the switch case.

      case 2:                                // decimal 2 means the command has failed.
        Serial.println("command failed");   // print the error
        break;                                 // exits the switch case.

      case 254:                              // decimal 254  means the command has not yet been finished calculating.
        Serial.println("circuit not ready"); // print the error
        break;                                 // exits the switch case.

      case 255:                              // decimal 255 means there is no further data to send.
        Serial.println("no data");          // print the error
        break;                              // exits the switch case.

    }
  }

  // for loop

  //Automatically save workbook every minute (60000ms)
  unsigned long currentMillis = millis();

  if (currentMillis - previousMillis >= interval) {
    previousMillis = currentMillis;
    Serial.println("SAVEWORKBOOK");
  }
  //End Workbook Saving

}

Hi @all,
first of all sorry for the late responses. I am moving houses at the moment and will be pretty busy over the next days. Therefore any responses will be delayed. And worst of all .... there are currently problems with the internet connection at my new place ... might be I won't be able to respond at all for a few weeks ....

That's said let's solve what is here:



Snaggles:
Hi NetDevil,
(...)
I tried CELL,SET,ONSHEET but that didn't work the way I wanted. I'm thinking that I might have to do some VBA in the Excel sheet but I'm a little lost there as well.

@Snaggles,
hi :slight_smile: there are two ways to solve your problem I think.

The first one is to use CELL,SET,ONSHEET,SheetNameX => what didn't work here? The big advantage of the DATA command is that it automatically writes to the next free row; CELL,SET on the other hand does not. For that one to work in your case you need a counter for each probe indicating the current line to write to on the respective sheet. Also please note the information in the Beginners Guide about adding a short delay of maybe 3 ms before each CELL,SET command to clear the buffer. Otherwise many times 0's were written in Excel.

The other option is indeed using VBA and to write an own command like "SETACTIVESHEET,SheetNameX" to set the globally used variable in PLX DAQ to the posted SheetNameX. That way all DATA commands coming in afterwards will be routed to that sheet. The command can be added within the CustomDevPoint function. However I guess there might be issues with the row variable for the sheet since that is a global counter as well I guess. Therefore it should be adjusted as well each time the sheet changes (there is a function to get the currentMaxRow for a sheet).

If I were you I'd start with the first option as all changes can be done in Arduino code.



@cryotan,
great, thanks for checking and posting that!
The strings really take up a lot of dynamic memory. I should warn the users in future versions to be careful with such long written commands. But I'm glad the basic code does not take away that much space :grin:



@30percent,
those pictures look really cool! Especially the 3D printed parts are amazing. 3D printing is a fantastic thing in combination with Arduino. One can build his own hardware, software and even cases to make a project look totally professional and robust. Nice work :slight_smile: Good luck on finishing the code!
I never knew about CodeMentor but checked the site and it is a really great idea. Can I somehow see what kind of questions or projects or coding langues are popular there? And in the end one can even sign up for a paid project :o good way to earn some money :wink: but shouldn't tell my boss about it :sunglasses:



Greetings to all of you

NetDevil:


@30percent,
those pictures look really cool! Especially the 3D printed parts are amazing. 3D printing is a fantastic thing in combination with Arduino. One can build his own hardware, software and even cases to make a project look totally professional and robust. Nice work :slight_smile: Good luck on finishing the code!
I never knew about CodeMentor but checked the site and it is a really great idea. Can I somehow see what kind of questions or projects or coding langues are popular there? And in the end one can even sign up for a paid project :o good way to earn some money :wink: but shouldn't tell my boss about it :sunglasses:



Greetings to all of you

Thank you Jonathan! Learning 3D printing has been a lot of fun along the way. Glad you checked out code mentor. There are mentors for all code languages, some that specialize in one, some that special in all. As good as you are helping people here, thought you might earn some $ at the same time. :smiley:

Made some more progress on remixing the PLX demo sketch. I can see data pulled from Excel in the serial monitor. So cool! Almost got this sketch solved.

Good luck on the housing/internet change.

NetDevil:


@Snaggles,
hi :slight_smile: there are two ways to solve your problem I think.

The first one is to use CELL,SET,ONSHEET,SheetNameX => what didn't work here? The big advantage of the DATA command is that it automatically writes to the next free row; CELL,SET on the other hand does not. For that one to work in your case you need a counter for each probe indicating the current line to write to on the respective sheet. Also please note the information in the Beginners Guide about adding a short delay of maybe 3 ms before each CELL,SET command to clear the buffer. Otherwise many times 0's were written in Excel.

The other option is indeed using VBA and to write an own command like "SETACTIVESHEET,SheetNameX" to set the globally used variable in PLX DAQ to the posted SheetNameX. That way all DATA commands coming in afterwards will be routed to that sheet. The command can be added within the CustomDevPoint function. However I guess there might be issues with the row variable for the sheet since that is a global counter as well I guess. Therefore it should be adjusted as well each time the sheet changes (there is a function to get the currentMaxRow for a sheet).

If I were you I'd start with the first option as all changes can be done in Arduino code.

@NetDevil[/b] Thanks for your reply. I would prefer to get it to work in Arduino myself. Here are some troubleshooting trials I've tried.
If I put in
[/u]** **[u]Serial.println("CELL,SET,ONSHEET,Probe 2");[/u]** **[u]
(Probe 2 is my 2nd sheet name) I get all the data printed on the first sheet still and a Error within command 9/Subscript out of range. I've tried different combinations of commas added in thinking it might be a missing variable confusing it but get the same problem.
If I put in my string that I want printed
[/u]** **[u]Serial.println("CELL,SET,ONSHEET,Probe 2, (String)DATA,TIME,TIMER," + channel_ids[channel] + "," + sensordata + ",AUTOSCROLL_20");[/u]** **[u]
I get nothing printed and an error 13/Type mismatch
If I follow the beginner's guide and do
[/u]** **[u]Serial.println("CELL,SET,ONSHEET,Probe 2,B,2,DATA");[/u]** **[u]
It prints the actual word DATA in sheet Probe 2, Cell B2 just fine but also keeps overwriting it. All the probe data is still printed on the first sheet as well even though I'm not changing the sheet again.
I guess I'm not exactly clear on the syntax of the command or maybe I'm trying to do something that it can't do...?

Thanks for this program.
it works ,but sometimes comerror pops up

hi, does anyone know the fastest sampling rate the plx-daq/excel can handle?

trying to analyze sound frequencies and so need to take readings at a few hundred Hz at the minimum, not sure if i can do that with excel. was initially going for a sampling rate of 1000Hz

after experimenting I feel like what I'm having trouble with also is printing the time elapsed from progam start to excel as the code works fine with serial monitor

// EmonLibrary examples openenergymonitor.org, Licence GNU GPL V3

#include "EmonLib.h"             // Include Emon Library



#define VOLT_CAL 269
#define CURRENT_CAL 60
unsigned long time;

EnergyMonitor emon1;             // Create an instance

void setup()
{  
  Serial.begin(9600);

  Serial.println("CLEARDATE");
  Serial.println("LABEL, Time Elapsed,Wall Voltage,Wall Current, Wall Power, Mic Voltage");
 
  emon1.voltage(A0, VOLT_CAL, 1.7);  // Voltage: input pin, calibration, phase_shift
  emon1.current(A1, CURRENT_CAL);       // Current: input pin, calibration.
}

void loop()
{
  emon1.calcVI(20,50);         // Calculate all. No.of half wavelengths (crossings), time-out

  float currentDraw     = emon1.Irms;             //extract Irms into Variable
  float supplyVoltage   = emon1.Vrms;                    //extract Vrms into Variable
  int sensorValue = analogRead(A4);

   time = millis();

  Serial.print(time);
  Serial.print(",");
  
Serial.print(supplyVoltage);
Serial.print(",");
Serial.print(currentDraw);
Serial.print(",");
Serial.print(supplyVoltage*currentDraw);
Serial.print(",");
Serial.println(sensorValue);

 
}

Hi. I have some problems printing data from MPU6050. Excel goes out frecuently. I want print almost 1000 data but I get around 100. Thanks.

Andres Bravo

Hi friends!
Firts, thanks for this fantastic program! But, I have a question about PLX-DAQ. I need to import about 50 columns of dates in Excel. Is it possible to do? Exist any version capable to do it?
Thanks you!