The Arduino Serial Plotter is a built-in IDE tool that graphs Serial.print() data in real-time, turning raw console text into visual waveforms. To plot multiple variables simultaneously, you must print them separated by commas or spaces, ending the line with Serial.println(). If you include text labels in your serial output, the plotter will fail to parse the data and crash or flatline. This guide walks through a robust dual-channel temperature and humidity build using the Arduino Uno R4 Minima, provides production-ready code, and details exactly how to debug the most common Serial Plotter errors.
Build Specs & Parts List
This build targets the Arduino Uno R4 Minima. We chose the R4 Minima over the classic Uno R3 because its native USB-C connection and RA4M1 32-bit ARM Cortex-M4 processor handle high-speed serial buffering without the UART bottleneck that causes dropped frames on older ATmega328P boards at baud rates above 115200.
| Component | Exact Variant / Model | Approx. Price (2026) | Why This Part? |
|---|---|---|---|
| Microcontroller | Arduino Uno R4 Minima (ABX00080) | $20.00 | Native USB, 14-bit ADC, 48MHz clock for fast I2C polling. |
| Sensor | Adafruit SHT31-D I2C Breakout (2857) | $14.50 | High accuracy (±2% RH, ±0.3°C), integrated pull-ups, 3.3V/5V tolerant. |
| Prototyping | Half-size breadboard & 22 AWG solid jumper wires | $6.00 | Standard bench setup; 22 AWG grips securely in R4 header sockets. |
| Cable | USB-C to USB-A Data Cable (e.g., Cable Matters 201013) | $8.00 | Must be a data cable, not a charge-only cable. |
Hardware Wiring & Pin Mapping
The SHT31-D communicates over I2C. While the Uno R4 Minima has dedicated SDA and SCL pins on the standard digital header, they are also mapped to A4 and A5 for backward compatibility with R3 shields. We will use the dedicated header pins for cleaner breadboard routing.
| SHT31-D Breakout Pin | Arduino Uno R4 Minima Pin | Wire Color (Recommended) | Notes |
|---|---|---|---|
| VIN | 5V | Red | The Adafruit breakout has an onboard regulator; 5V is ideal. |
| GND | GND (any) | Black | Ensure a common ground reference. |
| SDA | SDA (Pin 18 / A4) | Blue | I2C Data line. Breakout includes 10k pull-ups. |
| SCL | SCL (Pin 19 / A5) | Yellow | I2C Clock line. |
| ADR | Not Connected (Floating) | N/A | Leave floating for default I2C address 0x44. Tie to GND for 0x45. |
Complete Arduino Code for Dual-Channel Plotting
This code targets the Arduino Uno R4 Minima and requires the Adafruit SHT31 Library (install via Library Manager). The critical rule for the Serial Plotter is formatting: print only numbers, separate multiple variables with a comma or space, and terminate the line with Serial.println().
#include <Wire.h>
#include "Adafruit_SHT31.h"
// Pin definitions (Hardware I2C uses dedicated pins, no explicit definition needed for Wire)
#define SENSOR_I2C_ADDRESS 0x44
#define SERIAL_BAUD_RATE 115200
#define POLLING_DELAY_MS 250 // 4 Hz update rate for smooth plotting
Adafruit_SHT31 sht31 = Adafruit_SHT31();
void setup() {
Serial.begin(SERIAL_BAUD_RATE);
// Wait for serial port to connect (native USB on R4 Minima)
while (!Serial) {
delay(10);
}
// Initialize I2C and sensor with error handling
if (!sht31.begin(SENSOR_I2C_ADDRESS)) {
// Print error to serial monitor, but DO NOT use text labels if plotter is open
Serial.println("999,999"); // Send dummy max values to spike the plotter visually
while (1) {
delay(1000); // Halt execution if sensor is missing
}
}
}
void loop() {
float tempC = sht31.readTemperature();
float humidity = sht31.readHumidity();
// Error handling for NaN (Not a Number) read failures
if (isnan(tempC) || isnan(humidity)) {
// Send previous valid data or a specific error flag, avoiding text strings
Serial.println("-10,-10");
} else {
// CRITICAL: The Serial Plotter requires strictly numeric CSV format.
// Do NOT use Serial.print("Temp: "); It will crash the plotter parser.
Serial.print(tempC);
Serial.print(","); // Comma separates the two plot lines
Serial.println(humidity); // println sends the newline character to render the frame
}
delay(POLLING_DELAY_MS);
}
Debugging: Fixing Plotter Crashes & Flatlines
When the Serial Plotter fails, it rarely gives a polite warning. In Arduino IDE v2 (which uses a Go-based backend for the plotter), feeding it text instead of floats will trigger a backend parsing failure.
The Exact Error String:
If you open the IDE logs or run the backend manually, you will see:
serial-plotter: parse error: strconv.ParseFloat: parsing "Temp:": invalid syntax
In the IDE GUI, this manifests as the plotter silently dropping the line, resulting in a flatline at zero or jagged spikes to the X-axis.
The First Three Things to Check When It Fails
- Text vs. Numeric Output: Scan your
loop()for anySerial.print("Label")orSerial.println("Ready")statements. The plotter's parser attempts to cast every string between delimiters into a 64-bit float. If it hits a letter, it aborts parsing that frame. Strip all text labels from your serial output when the plotter is active. - Baud Rate Mismatch: Ensure the baud rate selected in the Serial Plotter dropdown (top right of the plotter window) exactly matches the
Serial.begin()value in your code (e.g., 115200). A mismatch results in garbled ASCII characters, which the parser reads as invalid syntax, causing a permanent flatline. - USB Cable Integrity: The Uno R4 Minima requires a high-quality data cable. If you are using a charge-only cable, or a cable with degraded shielding, the native USB CDC-ACM connection will drop packets at 115200 baud. Swap to a verified data cable (like the Cable Matters 201013) and plug directly into the motherboard's rear I/O, bypassing unpowered USB hubs.
Wire library to hang indefinitely. The plotter will freeze on the last known value. Always reset the board via the physical reset button after wiring changes.
Scaling the Build: Extensions & Simplifications
Depending on your project phase, you may need to scale this setup up for data logging or down for quick analog testing.
How to Extend: Adding SD Card Logging
The Serial Plotter is volatile; when you close the window, the data is gone. To extend this build for long-term environmental monitoring, add an Adafruit MicroSD Breakout Board (wired to the R4 Minima's SPI pins: MOSI=11, MISO=12, SCK=13, CS=10). Modify the code to open a file in setup() and write the same comma-separated string to the SD card inside the loop(). You can then export the CSV to Python or Excel for deeper statistical analysis, while still using the Serial Plotter for real-time bench verification.
How to Simplify: The $2 Potentiometer Test
If you are just learning the Serial Plot Arduino workflow and don't want to wire I2C pull-ups or install third-party libraries, simplify the build to a single analog channel. Connect a standard 10kΩ linear potentiometer (e.g., Bourns 3852A-286-103AL) with the outer wipers to 5V and GND, and the middle wiper to Analog Pin A0. Replace the loop() with Serial.println(analogRead(A0));. This gives you immediate visual feedback of the R4 Minima's 14-bit ADC resolution (0-16383) as you turn the knob, verifying your IDE and cable setup before moving to complex digital sensors.
Frequently Asked Questions (FAQ)
How to plot multiple variables in Arduino Serial Plotter?
To plot multiple variables (up to 8 channels in IDE v2), print each numeric variable separated by a comma, space, or tab, and terminate the sequence with a newline. For example: Serial.print(val1); Serial.print(","); Serial.print(val2); Serial.print(","); Serial.println(val3);. The plotter will automatically assign a distinct color to each channel and generate a legend based on the channel index (or variable names if you send a header row, though header rows can trigger parse errors in older IDE versions).
Why is my Arduino Serial Plotter flatlining or showing noise?
A flatline at zero usually indicates a baud rate mismatch or a strconv.ParseFloat error caused by text labels in your serial stream. High-frequency jagged noise, however, is typically an electrical issue. If plotting analog sensors, ensure your analog reference (AREF) is stable and that you are using twisted-pair wiring for sensor signals to reject 50/60Hz mains hum. For I2C sensors like the SHT31, noise is rare, but missing I2C pull-up resistors will cause the bus to read NaN, which the plotter may render as erratic drops to zero.
Can I save or export data from the Arduino Serial Plotter?
Natively, the Arduino IDE v2 Serial Plotter does not have a "Save CSV" button; it is strictly a visualization tool. To export data, you must either write it to an SD card on the microcontroller, or use an external serial terminal application like PuTTY, Tera Term, or the screen command in Linux/macOS to log the COM port output to a text file concurrently while the plotter is running.
What is the maximum baud rate for smooth Arduino serial plotting?
For classic ATmega328P boards (Uno R3, Nano), 115200 baud is the practical ceiling before hardware UART buffer overruns cause dropped frames. For modern ARM-based boards like the Uno R4 Minima, ESP32, or Nano 33 IoT, which use native USB CDC-ACM, you can push the baud rate to 921600 or even 2000000. However, the Serial Plotter's UI rendering engine is the actual bottleneck. Pushing more than 500-1000 data points per second will cause the IDE UI to lag. A polling delay of 10ms to 50ms (20-100 Hz) provides the smoothest visual tracing without freezing the IDE.






