Skip to main content

Command Palette

Search for a command to run...

How to use Arduino serial plotter?

Published
2 min read
How to use Arduino serial plotter?

Here’s the quick, reliable way to use the Arduino Serial Plotter (works with IDE 1.8.x and 2.x).

Steps

  1. Open the Plotter: Arduino IDE → Tools → Serial Plotter.

  2. Match the baud rate: Set the Plotter’s baud to the same value you use in Serial.begin(...) (e.g., 115200).

  3. Print one “row” per sample: Each line you println() becomes one time step on the X-axis.

  4. Print numbers only (per series):

    • Multiple series: print values separated by commas or tabs on one line.

    • IDE 2.x bonus: you can print labels like temp:23.4,hum:48.2 and it shows a legend. (If labels don’t appear in your version, it still plots the numbers.)

  5. Throttle your rate: 10–100 samples/s is ideal (use millis() to control output).


Example A — Single channel (A0), ~50 samples/s

void setup() {
  Serial.begin(115200);
}

void loop() {
  static uint32_t last;
  if (millis() - last >= 20) {         // ~50 Hz
    last = millis();
    int raw = analogRead(A0);          // 0..1023
    Serial.println(raw);               // one value → one trace
  }
}

Example B — Two channels (A0, A1) as CSV (works on all IDEs)

void setup() { Serial.begin(115200); }
void loop() {
  static uint32_t last;
  if (millis() - last >= 20) {
    last = millis();
    int a0 = analogRead(A0);
    int a1 = analogRead(A1);
    Serial.print(a0); Serial.print(','); Serial.println(a1);
    // Plotter draws two lines: series #1 and series #2
  }
}

Example C — Labeled output (IDE 2.x shows legend)

void setup() { Serial.begin(115200); }
void loop() {
  static uint32_t last;
  if (millis() - last >= 50) {
    last = millis();
    float temp = 25.0 + sin(millis()/1000.0)*2.0;
    float hum  = 45.0 + cos(millis()/1200.0)*5.0;
    Serial.print("temp:"); Serial.print(temp);
    Serial.print(",hum:");  Serial.println(hum);
  }
}

Tips & gotchas

  • No text spam: Don’t mix in nonnumeric debug text on the same lines—use a separate serial port or gate prints with a flag.

  • Decimal point: Use . as decimal separator (Arduino prints this by default).

  • Scaling: Convert to engineering units before printing (e.g., volts = raw * 5.0 / 1023.0).

  • Smoothing: Average N samples, then print the average to reduce jitter.

  • X-axis: It’s not “time,” it’s sample index; keep a steady print interval for a meaningful time base.

More from this blog

A

Ampheo Electronic Blog-Chip and component knowledge sharing

181 posts

Original and Genuine Electronic Components Distributor