arduino-serial-plotter

Easily Making Graphs in Arduino IDE with Serial Plotter

  • 2 min

The new version 1.6.6 of the Arduino IDE has just been released, and one of the most celebrated new features is the inclusion of a window for creating graphs with the values received via the serial port.

In this post, we will see how to use this simple but useful tool, called “Serial Plotter,” to visualize information sent from Arduino via the serial port.

Arduino Serial Plotter

As mentioned, the new Arduino IDE incorporates an extension to the traditional serial monitor, which allows displaying in a real-time graph the values received via the serial port.

Don’t expect miracles… it’s a simple tool, far from what we can achieve by connecting Arduino with a Processing, C#, Python, or Java application (some of which we will cover soon on the blog).

But precisely this simplicity and ease of use is what makes the serial plotter useful, as it allows us to perform quick tests or monitor the value of a variable effortlessly.

We find the new Serial Plotter in the Tools menu, right next to the traditional Serial Monitor.

arduino-serial-plotter

Let’s demonstrate its use with a simple example. To do this, we start by connecting Arduino via USB, as we saw in the post Arduino Communication with Serial Port.

Load the following code onto Arduino. It simply generates random numbers between 1 and 3 with two decimal places and sends them via the serial port every 100 ms.

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

void loop() {

  float value;
  value = random(100,300)/100.0;

  Serial.println(value);

  delay(100);
}
Copied!

The result you will get is similar to the following image.

arduino-grafica

Of course, in a real application, the displayed value would be a monitored variable, such as a measurement taken by one of the many sensors we have seen on the blog. Similarly, we should adjust the time between sends to the desired measurement frequency.

We see that, despite its limitations, it is a tool that is useful for its simplicity in performing quick tests and setups. We hope that in future versions they improve and add new features to the Serial Plotter.

Download the Code

All the code from this post is available for download on Github. github-full