Serial Plotter Code Help

Hello, I'm working on a project utilizing 6, T-type thermocouples for ground temperature measurements over time. My interface is the Ocean Controls Thermocouple Multiplexer Shield (KTA-259T) mounted atop an arduino Metro from Adafruit.
The issue is the serial plotter does not display the temperature data graphs. It will display the X axis title bar at the very top of the window and the Y axis is not displayed. The data is displayed in the serial monitor they way i'd expect.
I've read numerous posts about others having similar issues, typically with not using Serial.print(' ') or Serial.println(""), but it seems to be correct in my code to the best of my knowledge. Appreciate any input you may have here...i'm sure this is a simple code fix. The code is a sample code from the Ocean Controls website.

// Assumes 20 MHz or less clock. Insert NOPs for faster operation.
// Pinout for Ocean Design's Thermocouple Multiplexer Shield
#define PINEN 7 // TC Mux Enable pin
#define PINA0 4 // TC Mux Address 0 pin
#define PINA1 5 // TC Mux Address 1 pin
#define PINA2 6 // TC Mux Address 2 pin
#define PINSO 12 //TC ADC Slave Out pin (MISO)
#define PINSC 13 //TC ADC Serial Clock (SCK)
#define PINCS 9  //TC ADC Chip Select

#define SHORT -1001
#define OPEN -1000

volatile int tcTemp[9];    // in quarter deg. C, tcTemp[8] is the interal reference temp, disable IRQ's to access these

int readSPI() {
  word v = 0;
  for (byte i = 16; i != 0; i--) {
    v <<= 1;
    digitalWrite(PINSC, HIGH);
    // 100nS min. delay implied
    v |= digitalRead(PINSO);
    digitalWrite(PINSC, LOW);   // request next serial bit
    // 100nS min. delay implied
  return v;

void tcTempSetup() {
  pinMode(PINEN, OUTPUT);
  pinMode(PINA0, OUTPUT);
  pinMode(PINA1, OUTPUT);
  pinMode(PINA2, OUTPUT);
  pinMode(PINSO, INPUT);
  pinMode(PINCS, OUTPUT);
  pinMode(PINSC, OUTPUT);

  digitalWrite(PINEN, HIGH);   // enable the mux all the time
  digitalWrite(PINSC, LOW);    // put clock in low
  digitalWrite(PINCS, LOW);    // stop conversion, start serial interface

  // Timer0's overflow is used for millis() - setup to interrupt
  // in the middle and call the "Compare A" function below
  OCR0A = 0x80;
  TIMSK0 |= _BV(OCIE0A);

void setup() {

// Interrupt is called every millisecond
  static byte ms = 0;
  static byte ch = 0;

  if (ms == 0) {
    // select the thermocouple channel on the mux
    digitalWrite(PINA0, ch & 1);
    digitalWrite(PINA1, ch & 2);
    digitalWrite(PINA2, ch & 4);
    // ... wait a while for the capacitor on the ADC input to charge (< .1 mS actually needed)
  } else if (ms == 5) {
    // begin conversion
    digitalWrite(PINCS, HIGH);
    // ... wait 100 mS for conversion to complete
  } else if (ms == 105) {
    // stop conversion, start serial interface
    digitalWrite(PINCS, LOW);
    // 100nS min. delay implied

    int rawTC = readSPI();
    int rawIT = readSPI();

    int tempC = rawTC / 4;
    if (rawTC & 1) {
      if (rawIT & 1) {
        tempC = OPEN;
      if (rawIT & 6) {
        tempC = SHORT;
    tcTemp[ch] = tempC;

    if (++ch == 8) {
      tcTemp[8] = rawIT / 64; // internal temperature reduced to quarter degree C
      ch = 0;
    ms = 255; // ++ will make this 0

void loop() {
  for (byte j = 0; j < 9; j++) {

    // access thermocouple readings with interrupts disabled to prevent 'shearing'
    int t = tcTemp[j];

    if (t == OPEN) {
    } else if (t == SHORT) {
    } else {
      Serial.print(t / 4);
    Serial.print(' ');
  delay(1000);  //  delay(1000) milleseconds, set this for print time;

Serial Plotter likes CSV values, but spaces also work as delimiters.

Thank you, yes both comma and space result in the same incomplete plotter output.

i didn't know the the arduino IDE serial plotter accepts x,y coordinates. as far as i know, it just plots values as multicolored y values, auto incrementing along the x-axis

How should look it complete?
Of course you have to remove all non-numeric decoration from the output for plotting.
After the last channel a \n (println) advances to the next plot column.

Below is the plotter output currently....sketch of what i'm looking for below that.

sketch should be rotated -90deg....sorry about that

The plot shows the non-numerical output that is overridden with each loop() iteration. Limit that verbose output to occur once in setup() and output only numbers in loop().

get following plot, with output and code below

greg:0 jean:10
greg:3 jean:33
greg:6 jean:56
greg:9 jean:75
greg:12 jean:92
greg:15 jean:106
greg:18 jean:115
greg:21 jean:121
greg:24 jean:121
greg:27 jean:118
greg:30 jean:110
greg:33 jean:99
greg:36 jean:86
greg:39 jean:69
greg:42 jean:52
greg:45 jean:35
greg:48 jean:18
greg:50 jean:0

```int  n;

char s [80];

void setup() { // wait for serial to start
    Serial.begin (9600);

#define A  100

void loop()
    long a = A * sin(n++ * PI / 200);
    long b = A * sin(n++ * PI / 30);

#if 1
    sprintf (s, "greg:%ld jean:%ld", a, a+b);
    sprintf (s, "greg:%ld", a);
    Serial.println (s);

Plotter output matches your sine issues there...
Will play with DrD's suggestion tonight.

Fantastic !! Thank you.... commented out the first Serial.print lines and changed the words output.....all works as needed for now.

void loop() {
  for (byte j = 0; j < 9; j++) {

    // access thermocouple readings with interrupts disabled to prevent 'shearing'
    int t = tcTemp[j];

    if (t == OPEN) {
      Serial.print(" , ");  //Change , to Open to troubleshoot thermocouple
    }  else if (t == SHORT) {
      Serial.print(" , ");  //Change , to Short troubleshoot thermocouple
    } else {
      Serial.print(t / 4);
    Serial.print(' ');
  delay(1000);  //  delay(1000) milleseconds, set this for print time;

not the cleanest i know, but will work on it......analog guy going digital = fun times

if you're just interested in a plot of some data collected using an arduino, you could copy the serial monitor screen to a file and use xgraph for viewing the data. other tools (?) would presumably generate nicer (?) plots for documents

Thanks gcjr......i'm actually thinking the same....this arduino will monitor 6 thermocouples over the course of a few years so too much data for the EEPROM and i just found out the location of the sensors will be too far from a computer. So, my idea is to use an SDRAM shield, copy and paste from the serial monitor into the PC and utilize excel for plotting.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.