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?

  • 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. – Anonymous Penguin Apr 17 '14 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 '14 at 22:18

18 Answers 18

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

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

  • 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 '16 at 15:51
  • @Overdrivr Sure, go extend this wiki for others' sake! – niutech Mar 1 '16 at 20:47

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
  • 1
    This looks great. Could you add some demo code? – geometrikal Sep 25 '14 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 '15 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 '15 at 16:18

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.
  • +1. Does the "Arduino real time plot Matlab"[youtube.com/watch?v=ntHZsLmNkgw] video use that same technique? – David Cary Sep 24 '14 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. – Connor Wolf Sep 25 '14 at 0:12
  • Matplotlib is python, not matlab. – DaveP Feb 24 '15 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 '16 at 15:48

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

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

  • 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. – Hamish_Fernsby Feb 28 at 15:46

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

  • 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. – Hamish_Fernsby Feb 28 at 15:49

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.

  • 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 '16 at 15:45

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.

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

  • Can you explain how to use this, and what the advantages and disadvantages of this are? – The Guy with The Hat Sep 21 '14 at 23:17

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
    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! – Anonymous Penguin Jul 31 '14 at 13:58
  • Good answer, wouldn't have thought of using Matlab, there's a SO thread here about it stackoverflow.com/questions/19483098/… – Hamish_Fernsby Apr 12 at 13:06

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).

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.

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.

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
    As of Aug 1 '18 this website is dead. – Dan Aug 1 at 13:39

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/

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

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

enter image description here

Video example

almost useful. 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
    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 '16 at 15:15

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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