48

I need to plot serial data from Arduino.

I require support for:

  1. Various data formats (e.g. signed, unsigned, 8 bits, 16 bits);
  2. Plots several data on the same axes;
  3. Exports / Imports file data.

As plotting serial data from Arduino is a common need, my question is: What programs/utilities are available for plotting serial data from Arduino that meet the needs above?

What are the advantages / disadvantages of the method you have suggested?

2
  • I decided to reopen with your last edit. As this question stands, it seems to be on topic because it's specific. I'll be clear to anyone (since there's not a lot of these types of questions): if this gets too off topic, I may have to step in. However, the likelihood of that happening is rare. :) @JRobert If GnuPlot meets the requirements in the question, post it. Apr 17, 2014 at 20:47
  • 1
    The "Interfacing with Other Software" page on the Arduino Playground shows a bunch of ways to plot serial data from an Arduino to an iPhone, a Windows PC, a Linux PC, etc.
    – David Cary
    Sep 24, 2014 at 22:18

21 Answers 21

25

There are some good applications for visualizing the serial data, including:

  • MegunoLink ($39.95; Lite free) - plotting, logging, programming, reporting and more.

    MegunoLink

  • Electric UI ($80; free for students) - cross platform, fully featured code based GUI framework for hardware.

    Electric UI

  • MakerPlot ($59) - digital & analog plotting, monitoring, custom interfaces and more.

    MakerPlot

  • ArduinoPlot (free) - simple plotting.

    ArduinoPlot

  • arduino-plotter (free) - easy, light-weight plotting with support for all primitive types

    arduino-plotter

  • Bridge Control Panel (free) - logging, plotting, and more.

    Bridge Control Panel

  • RealtimePlotter (free) - 6 channels data plotting.

    RealtimePlotter

  • SimPlot (free) - 4 channel plotting.

    SimPlot

  • Arduino Serial Plotter (free) - built in Arduino Editor under Tools > Serial Plotter.

    Arduino Serial Plotter

(This is a community wiki, you can expand the list.)

2
  • I'm confused. I posted my own solution below but now I'm not sure if it wouldn't be better to edit your post since it's a wiki. What do you think ?
    – Overdrivr
    Mar 1, 2016 at 15:51
  • @Overdrivr Sure, go extend this wiki for others' sake!
    – niutech
    Mar 1, 2016 at 20:47
10

GnuPlot

Advantages: It's very flexible, scriptable, and freely available.

Disadvantages: A bit complex to learn (but I figured out how to get started in a few minutes, and quite functional in an hour or two), runs in a terminal window (if you consider that a disadvantage).

Something I found very useful was to script it to reload my terminal program's logfile periodically so i got a dynamic graph as my experiment progressed.

Image of GnuPlot



Edit: Here is the GnuPlot script that plots it:

#!/usr/local/bin/gnuplot -rv
# Note reverse video here ^^^   til I find a way to put it in the script

# gpFanCtl - Plots DiffThermo fan controller data (aloft, alow, Tdiff, fan-state).
# $Id: gpFanCtl,v 1.8 2014-04-28 09:40:51-04 jrobert Exp jrobert $

set terminal x11 1 noraise
set xtics 3600
set mxtics 4
set xdata time

set ytics 1 nomirror
set mytics 2

set y2range [0:3]
set y2tics 1
set my2tics 4

set grid
set ylabel 'Temperature, degC'
set y2label 'Tdiff, degC' textcolor rgb '#00CD63'

cd '/Users/jrobert/Desktop'
plot "Logfile.txt" using ($0*4):1 title "Aloft" with lines lc rgb "red",\
     "Logfile.txt" using ($0*4):2 title "Alow" with lines lc rgb "#3982FF",\
     "Logfile.txt" using ($0*4):3 title "Tdiff" with lines lc rgb "#00CD63" axis x1y2,\
     "Logfile.txt" using ($0*4):4 title "Fan" with lines lc rgb "orange" axis x1y2;
pause 4
refresh
reread
3
  • 1
    This looks great. Could you add some demo code? Sep 25, 2014 at 5:01
  • But it plots the data from Logfile.txt, not the realtime serial data. How to connect it to a serial port?
    – niutech
    Feb 24, 2015 at 1:21
  • 1
    No, this script isn't "real-time" -- it could be up to around 4 seconds behind. Logfile.txt is the capture file output from a terminal program. In my case, the data collection system samples and logs every 4 seconds and the GnuPlot script replots the log file every 4 seconds. This is dynamic enough for what I'm doing with it (monitoring room temperatures).
    – JRobert
    Feb 24, 2015 at 16:18
8

I use Matplotlib for any plotting I need to do.

It's not arduino specific in any way, but it is a very excellent Python plotting toolkit.

I've built a number of applications that plot data from a variety of microcontrollers in real-time to a graph, but that was really more of a two-step process: 1. Get data from device into computer, 2. plot realtime data.

Really, I think you should break your question into two parts:

  • How do you get data from an Arduino/Any serial device into a computer easily.
  • What is a good plotting library that is easy to use.
5
  • +1. Does the "Arduino real time plot Matlab"[youtube.com/watch?v=ntHZsLmNkgw] video use that same technique?
    – David Cary
    Sep 24, 2014 at 21:27
  • Yep. It uses a call that reads the arduino data into a matlab variable, and then a call that updates the matlab plot with the matlab variable. Sep 25, 2014 at 0:12
  • 1
    Matplotlib is python, not matlab.
    – DaveP
    Feb 24, 2015 at 6:33
  • I disagree with you, this question should not be divided in 2. There are solutions (such as the one I posted below) that do take care of both, because it is annoying to reivent the wheel for remote monitoring and control of arduino applications, and also because writing python code for real time plots is actually very far from trivial. Things can be done with matplotlib but clearly there are better alternatives for that such as pyqtgraph.
    – Overdrivr
    Mar 1, 2016 at 15:48
  • For part 1: getting data from Arduino: github.com/ElectricRCAircraftGuy/eRCaGuy_PyTerm Oct 30, 2019 at 4:20
8

SerialPlot (free). It does everything you require and much more.

Other features:

  • Zoom in on data
  • Click on datapoints to see values
  • Send commands back to Arduino
  • Adjust total number of points plotted
  • Ability to show each channel in its own autoscaled plot
  • Interprets binary, ASCII and custom packets
  • Demo mode lets you play with features

enter image description here

5
  • 1
    Good answer, I liked serialplot, it found my COM port & baud rate automatically, I just had to change from binary to CSV and increase to 3 channels ( for a magnetometer) and it was plotting nicely. Feb 28, 2018 at 15:49
  • This is the neatest and easy to use - but I do wish there was a mac Binary :)
    – willwade
    May 4, 2019 at 20:39
  • AppImage available => ultra quick installation !
    – doom
    Apr 9, 2020 at 15:28
  • But seems that icon of SerialPlot is not visible in Ubuntu (AppImage).
    – doom
    Apr 9, 2020 at 15:35
  • Would love to give this tool a try, but can't seem to find any documentation on how to format the data sent to the serial port.
    – kregus
    Dec 23, 2020 at 1:17
6

Responding to my own question here.. I use Bridge Control Panel as mentioned.

Advantages: Lots of Features.

Disadvantages: Tricky to setup and very poor syntax/error reporting.

To use: You need to write the Arduino Data over the Serial Port one byte at a time. For an int data type that would look as follows:

// RX8 [h=43] @1Key1 @0Key1
Serial.print("C");
Serial.write(data>>8);
Serial.write(data&0xff);

In Bridge the command to Read Data is:

RX8 [h=43] @1Key1 @0Key1

RX8 is the read command [h=43] means the next valid byte is "C" in ASCII then the High Byte of Key1 then the Low Byte of Key1

It looks like this in Bridge:

enter image description here

enter image description here

6

You can try serialchart. It's pretty strait forward program. It does exactly what you asked. The only disadvantage is that it requires data in CSV format (does not meet first point).

Screenshot from project page:

example

1
  • I tried this & found it very clunky to get working, no default config, doesn't autoscale, after half an hour faffing with the syntax I still didn't have a plot only a straight line, so I gave up & used SerialPlot which worked within a few minutes, just had to specify ascii text & number of channels. Feb 28, 2018 at 15:46
6

You might be interested in Telemetry See on Github . It is a communication protocol, highly simple to use, with a clean interface, that enables bidirectionnal communication with Arduino/Mbed devices.

If you don't want to read this long post, see A walkthrough of all the awesome features in it

The power of this library comes from the desktop command line interface (that requires no programming skills in python).

It is able to open high-performance plots (much higher that what can be done with matplotlib) just by typing a command.

The protocol supports complexes data structures. For now arrays and sparse arrays can be send from the embedded board.

The plots opened from the command line interface understand the type of data, and for arrays, rather than plotting each sample versus time, sample will be plotted against its own index.

In a near future, it is planned to add support for spatial coordinates (xyz data), that will allow you to plot immediately spatial data. Once, again the plots will figure everything out, plot your data in 2D or 3D space and you can focus on developping your app.

I believe those features are simply unique for such a project.

Pytelemetry CLI PyPI version

Once installed with pip, the command line can be started with

pytlm

Then you can connect, ls(list) received topics, print data received on a topic, pub(publish) on a topic, or open a plot on a topic to display received data in real-time

enter image description here

enter image description here

Get started

Wiki

PS : I am the author.

I developed it because I could not find a solution that would allow me to:

  • write quickly PC scripts to control an Arduino
  • debug quickly
  • plot complex data (not just a time varying value)

all of the above without using proprietary solutions or bloated GUIs.

Using this library, the time to setup a communication between Arduino and PC went from usually half a day to 5 minutes.

1
  • PS: logging of the serial port data in the python packages (raw data and decoded data) is also fully supported. I intend to use it to implement an offline replay function (simulate serial data flow)
    – Overdrivr
    Mar 1, 2016 at 15:45
6

Nobody had mentioned Processing which is super versatile. You can do a lot more than just plotting but if that's all you want to do you can use the gwoptics library; hook up Arduino and Processing as directed here.

2

While I haven't used it myself, "rqt_plot" running on the PC seems to be a popular way to plot data on a PC that comes over a serial port from an Arduino running a sketch that includes the rosserial_arduino library or the ros_arduino_bridge library.

2

I made an equivalent tool in python that print real time data from ADXL345 accelerometer. https://github.com/mba7/SerialPort-RealTime-Data-Plotter

may be it will be helpful for someone

enter image description here

Just choose the serial com and speed and sent a serial data on the following format:

  • 3 inputs, every input is a 2 bytes (Two's complement )
  • 6 bytes seperated by a space
  • the packet is a string terminated by '\n'

Could be easily adapted to change this format

1
  • Can you explain how to use this, and what the advantages and disadvantages of this are? Sep 21, 2014 at 23:17
2

You can use MATLAB Student Edition, this can save your time for further analysis, too. You can just open the COM port in MATLAB and plot the received signal and/or save the signal in the workspace or whatever. MATLAB makes everything easy!

2
  • 2
    Welcome to Arduino SE! Can you please edit your answer to add more information describing how it fits the OP's needs and maybe a little other information like a link or a photo? Thanks! Jul 31, 2014 at 13:58
  • Good answer, wouldn't have thought of using Matlab, there's a SO thread here about it stackoverflow.com/questions/19483098/… Apr 12, 2018 at 13:06
2

CSV format is most versatile for any data (signed/unsigned, various size and precision).

Cross-platform (written in Java/Scala) tool Scsvlog can receive/parse CSV strings from serial port / socket, show values and draw charts (up to 8).

1
  • Tool can no longer be found now, unfortunately - the original link is dead and I can't seem to find any copies. Jul 23, 2019 at 1:37
2

You can try out the software I developed for that propose. It's aimed to be easy to use. See SerialGraphicator - Open Source Free Serial Port Client capable of graph values that are received in JSON format.

1

I know this is a very old question, but I recently created a mac application that solves this problem very well. You can find more information about it on www.bloonapp.com. There are some demo videos on the website that you can check out.enter image description here

1
  • 1
    As of Aug 1 '18 this website is dead.
    – Dan
    Aug 1, 2018 at 13:39
1

I know you were probably after more advanced GUI output, but I managed to replicate a task that one would normally do with an oscilloscope: Arduino Serial Plotter output

using the serial plotter in the Arduino IDE and an ADC module you can get for $3 on eBay. I admit it's a bit crude, but it might be worth playing with the tool for a while, before you invest in Python/Matlab/ect level solutions. It was exceedingly easy to use. It would not take much to add SD card recording to the process.

See: https://edwardmallon.wordpress.com/2016/08/15/using-the-arduino-uno-as-a-basic-data-acquisition-system/

1

Serial Plotter is a simple program that I've made with Electron that receives data in the following format: data1,data2,timestamp; and converts it into a realtime chart.

enter image description here

0

Telemetry Viewer

Advantages:

  1. Easy to use
  2. Intuitive and flexible UI
  3. Open Source and free
  4. Different types of Graphs
  5. Very fast graph update rate

Disadvantages:

  1. Stopped development
  2. Binary data format is not complete yet.
  3. Primitive graph controls like zoom, screenshot and ... enter image description here
0

Almost useful. It needs:

  1. logging serial data to a file OR
  2. graphing from a file and updating every xxx milliseconds.

Live Graph is a better option and I use it in conjunction with Tera Term which gets the data via the USB/serial link (and saves it to a log file which then Live Graph polls).

Live Graph is slightly buggy when caching data and I haven't found a way to set a moving window to display results. Also, showing multiple graphs requires manual scaling, but in spite of all this, it's still very useful. It's written in java so you'll need the JRE. I prefer this over having to install python like some of the other graphing programs do. another downside is that it opens 4 different windows, which is a pain when I want to flip between it and Tera Term.

I've yet to find software that's

  1. An executable (.EXE) so it has no external reliance
  2. Includes a terminal emulator or serial data logger
  3. Logs serial data
  4. Graphs multiple items from a CSV
  5. Allows for CSV AND tab-delimited data (which is way easier to read as it scrolls along while simultaneously monitoring the graph.
  6. Allows setting of different scales for each overlaid graph without having to scale everything to [0..1] or setting a multiplier, i.e. allowing setting an [y0..y1] range for each item graphed.
1
  • 1
    Welcome to Arduino SE! Your answer is informative but could you please improve the formatting of the answer using the markdown guide you can view by pressing the ? button in the editor.
    – Avamander
    Feb 29, 2016 at 15:15
0

I am using processing.org for serial plotting from Arduino. It was the only app I could find that allowed me to make real histograms ( e.g. a million events in a hundred bins) and display various info numbers in addition to mean sigma for each channel. Two major problems: A) it turned out to be based on Java with no unsigned bytes B) synch ig with input required circular buffer and markers in the data. ( high speed, no handshake)

0

SVisual Monitoring and recording of signals for Arduino and not only.

enter image description here enter image description here

Video example

Download (free)

0

HITIPanel Serial data plotting and recording. You can zoom in/out, pan, export data to text or excel file, or import external data from text files. Come with a user interface to control and monitor the hardware.

enter image description here

enter image description here

Not the answer you're looking for? Browse other questions tagged or ask your own question.