Table of Contents
- What Is the Arduino Serial Plotter?
- Basic Usage: Plotting Your First Graph
- Plotting Multiple Channels Simultaneously
- Sensor Data Visualization: Accelerometer, Temperature, Light
- Real-Time Signal Filtering and Smoothing
- Advanced Techniques: Markers, Thresholds, and Scaling
- Alternatives: Processing, Python, and Web Dashboards
- Frequently Asked Questions
- Conclusion
What Is the Arduino Serial Plotter?
The Arduino Serial Plotter is a built-in graphing tool in the Arduino IDE that displays serial data as a live, scrolling line graph. It is the fastest way to visualise sensor readings, debug signal processing algorithms, and understand the behaviour of your circuits in real-time. No extra software or hardware is needed — if you have the Arduino IDE and a serial connection, you have a plotter.
Introduced in Arduino IDE 1.6.6, the Serial Plotter reads numeric values from the Serial Monitor output and graphs them against time. It supports multiple simultaneous channels (lines), automatic Y-axis scaling, and continuous scrolling. For Indian engineering students and hobbyists working on sensor projects, it replaces expensive oscilloscopes for low-frequency signal analysis and provides instant visual feedback during development.
The Serial Plotter is accessible from Tools > Serial Plotter (or Ctrl+Shift+L in Arduino IDE 2.x). It cannot run simultaneously with the Serial Monitor — you must close one to open the other.
Basic Usage: Plotting Your First Graph
The Serial Plotter reads numeric values separated by newlines. Each Serial.println() call creates one data point on the graph.
// Basic single-channel plot - analog sensor
void setup() {
Serial.begin(9600);
}
void loop() {
int sensorValue = analogRead(A0);
Serial.println(sensorValue); // One value per line = one graph line
delay(50); // ~20 samples per second
}
Open the Serial Plotter (Tools > Serial Plotter) and you will see a live scrolling graph of the sensor value. The Y-axis auto-scales to fit the data range, and the X-axis scrolls continuously to show the most recent data points.
Tips for Better Plots:
- Set the baud rate to 115200 for faster data throughput:
Serial.begin(115200) - Use
delay(20)todelay(100)for smooth, readable plots (10-50 Hz update rate) - Avoid printing text along with numbers — the plotter only understands numeric data
- Match the baud rate in the Serial Plotter dropdown to your code
Plotting Multiple Channels Simultaneously
To plot multiple values on the same graph, separate them with spaces, tabs, or commas on the same line:
// Three-channel plot: raw, filtered, and threshold
void setup() {
Serial.begin(115200);
}
void loop() {
int raw = analogRead(A0);
static float filtered = 0;
filtered = 0.9 * filtered + 0.1 * raw; // Low-pass filter
int threshold = 512; // Reference line
// Space-separated values on one line = multiple graph lines
Serial.print(raw);
Serial.print(" ");
Serial.print((int)filtered);
Serial.print(" ");
Serial.println(threshold);
delay(20);
}
The Serial Plotter automatically assigns different colours to each channel. In this example, you see three lines: the noisy raw signal, the smooth filtered signal, and a flat threshold reference line. This is extremely useful for tuning filter parameters — you can see the effect of changing the filter coefficient in real-time.
Channel Labels (Arduino IDE 2.x): In the newer IDE, you can add labels by using a colon format:
Serial.print("Raw:"); Serial.print(raw);
Serial.print(" Filtered:"); Serial.print((int)filtered);
Serial.print(" Threshold:"); Serial.println(threshold);
Sensor Data Visualization: Accelerometer, Temperature, Light
MPU6050 Accelerometer (3-axis):
#include <Wire.h>
#include <MPU6050.h>
MPU6050 mpu;
void setup() {
Serial.begin(115200);
Wire.begin();
mpu.initialize();
}
void loop() {
int16_t ax, ay, az;
mpu.getAcceleration(&ax, &ay, &az);
// Plot all 3 axes simultaneously
Serial.print(ax); Serial.print(" ");
Serial.print(ay); Serial.print(" ");
Serial.println(az);
delay(20); // 50 Hz update rate
}
This shows three coloured lines representing X, Y, and Z acceleration. Tilt the sensor and watch the lines change. Shake it and see the vibration patterns. This is invaluable for understanding accelerometer behaviour before writing control algorithms.
Temperature Trend Over Time:
void loop() {
float temp = readTemperature(); // Your sensor reading function
float setpoint = 25.0;
float error = temp - setpoint;
Serial.print(temp); Serial.print(" ");
Serial.print(setpoint); Serial.print(" ");
Serial.println(error);
delay(1000);
}
With temperature and setpoint plotted together, you can visually see how closely your control system tracks the target. The error channel shows overshoots and oscillations clearly.
Real-Time Signal Filtering and Smoothing
The Serial Plotter is the perfect tool for tuning digital filters. Plot the raw and filtered signals side by side and adjust parameters until the output looks right.
// Compare different filter types
float ema = 0; // Exponential Moving Average
float sma_buffer[10]; // Simple Moving Average buffer
int sma_index = 0;
float median_buffer[5]; // Median filter buffer
void loop() {
int raw = analogRead(A0);
// EMA filter (alpha = 0.1)
ema = 0.1 * raw + 0.9 * ema;
// SMA filter (window = 10)
sma_buffer[sma_index] = raw;
sma_index = (sma_index + 1) % 10;
float sma = 0;
for (int i = 0; i < 10; i++) sma += sma_buffer[i];
sma /= 10;
Serial.print(raw); Serial.print(" ");
Serial.print((int)ema); Serial.print(" ");
Serial.println((int)sma);
delay(20);
}
You will see that EMA responds faster to changes but lets more noise through, while SMA gives a smoother output but introduces more delay. This visual comparison makes it easy to choose the right filter for your application.
Advanced Techniques: Markers, Thresholds, and Scaling
Adding Constant Reference Lines:
// Plot sensor with upper and lower thresholds
void loop() {
int value = analogRead(A0);
int upperThreshold = 700;
int lowerThreshold = 300;
Serial.print(value); Serial.print(" ");
Serial.print(upperThreshold); Serial.print(" ");
Serial.println(lowerThreshold);
delay(50);
}
Fixed Y-axis Range: The plotter auto-scales by default. To force a specific range, include min and max reference values:
// Force Y-axis to show 0-1023 range
void loop() {
int value = analogRead(A0);
Serial.print(0); Serial.print(" "); // Force min
Serial.print(1023); Serial.print(" "); // Force max
Serial.println(value); // Actual data
delay(50);
}
Pulse/Event Detection Markers:
// Show when a threshold is crossed
void loop() {
int value = analogRead(A0);
int marker = (value > 600) ? 1023 : 0; // Spike on threshold cross
Serial.print(value); Serial.print(" ");
Serial.println(marker);
delay(20);
}
Alternatives: Processing, Python, and Web Dashboards
The built-in Serial Plotter has limitations: no data logging, no zoom, no export, and limited customisation. Here are more powerful alternatives:
Processing: Free, cross-platform graphics environment that reads serial data and creates custom visualisations. You can build oscilloscope-style displays, bar graphs, and 3D plots.
Python with Matplotlib: Use pyserial to read serial data and matplotlib to create publication-quality graphs. This is the go-to option for engineering project reports.
# Python serial plotter (run on your computer)
import serial
import matplotlib.pyplot as plt
import matplotlib.animation as animation
ser = serial.Serial('/dev/ttyUSB0', 115200)
data = []
fig, ax = plt.subplots()
line, = ax.plot([], [])
def update(frame):
if ser.in_waiting:
value = int(ser.readline().decode().strip())
data.append(value)
if len(data) > 200: data.pop(0)
line.set_data(range(len(data)), data)
ax.relim()
ax.autoscale_view()
return line,
ani = animation.FuncAnimation(fig, update, interval=50)
plt.show()
Teleplot (VS Code Extension): If you use VS Code with the Arduino extension, Teleplot provides a more feature-rich plotting experience directly in your editor, with zoom, pan, and data export capabilities.
Frequently Asked Questions
Why does my Serial Plotter show garbage?
The most common cause is a baud rate mismatch. Ensure the baud rate in your code (Serial.begin(115200)) matches the dropdown in the Serial Plotter. Also, avoid printing any text (Serial.print(“value: “)) — the plotter only understands raw numbers.
How many channels can the Serial Plotter display?
The Serial Plotter can display at least 6 channels simultaneously (Arduino IDE 2.x). More channels are possible but the graph becomes difficult to read. For more than 6 channels, use Processing or Python for custom visualisation.
Can I save the Serial Plotter data?
The built-in Serial Plotter does not have a save or export feature. To log data, use the Serial Monitor and copy the output, or use a Python script with pyserial to write data to a CSV file simultaneously.
Can I use the Serial Plotter with Bluetooth?
Yes, if your Bluetooth module (HC-05/HC-06) appears as a virtual serial port on your computer, the Serial Plotter can read data from it wirelessly. This is useful for plotting data from moving robots or wearable sensors.
Conclusion
The Arduino Serial Plotter is an underused but powerful debugging and visualisation tool. It turns abstract numbers into intuitive graphs, making it easy to understand sensor behaviour, tune filters, verify control algorithms, and detect anomalies. For quick debugging, it is unmatched in speed and convenience. For more sophisticated analysis, combine it with Python or Processing for data logging and custom visualisation.
Add comment