multi column PLX output

Hi,
I want to have a refreshing bar chart of six sensor outputs from Arduino Mega to PLX-DAQ. The Arduino sketch is controlling 6 light-to-frequency sensors, and sending data to serial monitor. PLX-DAQ is then used to display graph of data. In practice, the Arduino sketch is started, then the PLX-DAQ program is started to receive and graph the data, in Excel, from the Arduino sketch.

So the idea is to have one set of bars, refreshed every second or so, as in Capture.jpg below. The current code (TCS_6TCS_Polling_6LEDs_44.5_PLX.ino) is OK to graph new and old data, as in Capture2 below. In other words, goal is to to meter the current levels, not plot old data.

I think something like this piece of code (from http://robottini.altervista.org/arduino-and-real-time-charts-in-excel) can be used to keep the data in Excel in a single row for the graph: Serial.println(‚ÄúROW,SET,2‚ÄĚ); but I don‚Äôt know how to add it to the Arduino code. Any help appreciated.
Thanks

Serial.print("DATA,TIME,"); // PLX-DAQ prints time and logs subsequent data.
  for(int i=0; i<6; i++) // 6 sensors
  { 
    Select_TCS_OUT(i); //TCS is light-to-frequency sensor
    int lastDigitalRead = HIGH;
    for(int j=0; j<20000; j++)
    {
      int digitalReadValue = digitalRead(OUT);
      if (lastDigitalRead == LOW && digitalReadValue == HIGH) // records changes voltage to get Hz
      {
        countTCS++;
      }
      counterTCS++;
      lastDigitalRead = digitalReadValue;
    }

    Serial.print(countTCS);
    Serial.print(",");
  
    if (i==5) {Serial.println(" , ");
    }

    delay (10);
    counterTCS=0;
    countTCS=0;
  }    // end i loop

}
void Select_TCS_OUT(int TCS_OUT) //6 sensors
{
  switch(TCS_OUT)
  {
  case TCS_1:   
    OUT=OUT1;
    break;

  case TCS_2:  
    OUT=OUT2;
    break;

  case TCS_3:  
    OUT=OUT3;
    break;

  case TCS_4:  
    OUT=OUT4;
    break;

  case TCS_5:    
    OUT=OUT5;
    break;

  case TCS_6:       
    OUT=OUT6;
    break;

  }

TCS_6TCS_Polling_6LEDs_44.5_PLX.ino (2.49 KB)

1 Like

If I understand you correctly, I would not have thought this was a starter in Excel. This is because the product from Excel is probably designed with paper print in mind, and "live graph" is probably merely a paper print graph that that is constructed live before your eyes.

Therefore, what you need is a volatile display on an LCD.

Having said that, it might be possible if the X-data is constant relative to the Y-data, thereby overwriting the previous, but it is usually time or something, and isn't. If it can be done, I guess it will be all down to your Excel skills, and Arduino's job would be quite straightforward.