Realtime data plotter

Debugging sensors on a microprocessor can be a hassle and the most used approach is to output the sensor values to a serial monitor. Realtime plotting is a better and more visual way of doing the same thing.


  • Real-time plotter of your data while it is still being processed by your application
  • Plots live data from serial port. Microprocessor choice does not matter as long as it can send serial data to your computer.
  • 6 channels of data (and this can be increased if necessary)
  • Live bar charts
  • Live line graphs
  • You just send the data you want to debug with a space as delimiter like this "value1 value2 value3 value4 value5 value6". Floats or integers does not matter.
  • Open source
  • Robust. It will not crash because of corrupt data stream or similar.
  • Multi platform Java. Tested on OSX and Windows 8 (and should work on Linux as well).

I created this software to debug an Arduino Due on my self-balancing robot. To tune the controls of the robot I needed fast feedback to know if I was making progress or not. The video below demonstrates typical use of the realtime plotter:


You can also follow the project at Github. If you make improvements to the source code, please share it by making a pull request at Github.

How to install and use

Since I have an Arduino I will use it as example but any micro processor can be used.

  1. Get ProcessingIDE to run the code. It is a neat and useful IDE for doing graphical stuff.
  2. Download controlP5 gui library and unzip it into your Processing libraries folder
  3. Connect the Arduino to the usb or serial port of your computer.
  4. Upload the example code (RealtimePlotterArduinoCode) to the Arduino
  5. Check serial monitor (at 115200) and check that it outputs data in the format "value1 value2 value3 value4 value5 value6".
  6. Close the serial monitor (since only one resource can use the serial port at the same time).
  7. Open the Processing sketch and edit the serial port name to correspond to the actual port ("COM3", "COM5", "/dev/tty.usbmodem1411" or whatever you have)
  8. Run the sketch

Advanced use

The realtime plotter can be expanded to also send commands to the microprocessor. The usual approach when programming microprocessors is to set some parameters in the beginning of the code, upload them to the processor, see the result, change the parameters again, upload, and so on until satisfactory performance is achieved. This iterative process takes a lot of time and a better approach is to send updated parameters to the microprocessor from your computer via serial data. For example I needed to tune some parameters on my robot and created a command panel that runs in parallell with the realtime plotter. For each change in parameters I immediately am able to see the result on the plotting screen. Example code of this is located in /RealtimePlotterWithControlPanel.



I decided to send and receive the data as ascii characters instead of binaries. The greatest disadvantage is performance and ease of use is the main advantage.

In some sense the realtime data plotter can also be used as a very slow and limited digital oscilloscope. I would not recommend using it for any high frequency applications though.

Some comments about earlier approaches and the used libraries

I have tried many different ways of doing this. My first approach was Matlab but I had problems with it locking the serial port. It was a hassle to get it working and getting everything configured takes to much time. My second approach was Python and graphing libraries but this was still not very satisfactory. The Processing language together with a graph library and ControlP5 made the whole thing much easier.


Posted in Realtime plotter, Timeline
27 Comments »Realtime data plotter
  1. ben says:

    The Processing IDE looks very interesting! Kinda looks like a Enthought Chaco alternative!

    Is there anything unique about this Arduino setup that would prevent plotting data using other microcontrollers (stm32, msp430, etc)? In the past, I've mostly seen pyqt and matplotlib used on the pc gui side, and firmata on arduinos, to do real-time graphing.

    I'd like to do an open source version of a uCProbe (Micrium) to do not just graphing but to display the current state of pins, etc. Not sure how different 'RealtimePlotterArduinoCode' is from 'firmata' or which would be best if porting to a stm32. Any suggestions?

    • sebnil says:

      It would work on any microcontroller since it is just sending of data over serial. You would also be able to display the current status of pins if you send them as 1 or 0 depending on the state. Or you could modify my code and do something more fancy to display pin states.

  2. Saneesh says:

    Excellent work buddy. I was just looking for some app like this to tune a motor parameters using serial port.

  3. Vsevolod says:

    It's pretty insane that there were no common tools for that, great work. Could you please tell me if it's able to plot 3 sensor readings 400 times per second update rate (24bits each)? Thanks in advance for any help you are able to provide.

  4. Tobias Rådenholt says:

    Nice work! I'm going to use this to visualize data and tune my Arduino autopilot for sailing yachts. Also gonna try to send commands to the autopilot from the command window.

    I have just downloaded and got this running on Ubuntum, but I had to make chnages in the code:

    The path to plotter_config.json

    plotterConfigJSON = loadJSONObject(topSketchPath+"/plotter_config.json");
    plotterConfigJSON = loadJSONObject("/home/USERNAME/Skrivbord/BasicRealtimePlotter/plotter_config.json");

  5. Juan from Brazil says:

    Man Nice work!
    meus parabens from Brazil :)!!

  6. Mark says:

    Nice work! However we noticed some acculating time lag in the visualization. We tested with 4 signals at 115200 Baud. Do you have any recommandation to avoid this behaviour?

    • sebnil says:

      Yes, but I am working on a solution using Python instead but have nto gotten to it just yet. The reason is either processing of the serial or drawing of the graph, and the solution I am working on is puttin geach of these tasks in separate processes instead.

      • Mark says:

        Thanks for the reply. Looking forward for the next (Python based?) release of the Real Time Data Plotter. Keep up with the nice work.

  7. Matt says:

    I'm sorry I don't fully understand how to get this code working for myself. I am trying to transmit data that I filtered from various sensors. Do I not just use
    Serial.print(data);Serial.print(" ");
    to get it to plot if I choose the proper COM port and baud rate? I am using an arduino UNO if it matters...


    • Sebastian Nilsson says:

      Yes, that should be about it. And then add a new row of data with println. There is an Arduino example in the github code I think. Good luck!

  8. Jan says:

    Hello Sebastian,

    Thanks for sharing a great real-time plotting tool. I would really like to use it for MCU debugging and testing, but I am getting an error.

    I am trying to get your RealTimePlotter up and running. I have installed Processing, the controlP5 library and opened the sketch "BasicRealTimePlotter", but I get the error "PApplet.sketchPath is not visible" when I try to run the sketch. It refers to the following code line in BasicRealtimePlotter:

    // settings save file
    topSketchPath = sketchPath;

    Do you have any suggestions to what causes this error?

    • sebnil says:

      I believe you are running on a new Processing version. This is old code and it works better on the old processing. But Tobias Rådenholt in a few comments above you seem to have a solution.

      Please make a pull request to the github repo if you fix any issues. That is the only way of keeping this project alive.


  9. Gabriel says:

    Hello Sebastian

    Very interesting and Great project,I was try your RealtimePlotterWithControlPanel for my self-balance robot,I upload the example code (RealtimePlotterArduinoCode) to the Arduino and I run sketch RealtimePlotterWithControlPanel when realtime plotter run the graph work fine but the panel robot tuner not visible , i don't know what the problem, i use processing 2.2.1, whether I should change your code (RealtimePlotterArduinoCode) but what the code I should change? or whether i should add (RealtimePlotterArduinoCode) to your ardino code (selfbalancing_robot_arduino_due) so that RealtimePlotterWithControlPanel work fine

    Thank you Sebastian

    • sebnil says:

      Unfortunatly I do not know why the code for processing does not work. I wrote it a long time ago and I think I wrote it for an older Processing version. Read the error messages, try and figure it out and make a pull request to the Github page with a solution.

      Good luck!

      • Gabriel says:

        Thanks for the reply, in processing 2.2.1 no error messages, real time plotter work fine ,but the robot tuner panel not visible, ok i will try in processing 1.5.1

        Thank you Sebastian


        • Gabriel says:

          In processing 1.5.1 it not compatible for your code because no java mode in processing 1.5.1, but your code (BasicRealtimePlotter) compatible in processing 2.2.1 and 3.0, if use processing 2.2.1 use the code // settings save file
          topSketchPath = sketchPath;
          and if use processing 3.0 use the code
          // settings save file
          topSketchPath = sketchPath();

          Your code (RealtimePlotterWithControlPanel) just compatible in processing 2.2.1

          • Gabriel says:

            I have question how your self-balance ARM robot connection your Realtime plotter such as your video on youtube? just upload the example code (RealtimePlotterArduinoCode) to the Arduino and run sketch RealtimePlotterWithControlPanel/ BasicRealtimePlotter , whether I should change your code (RealtimePlotterArduinoCode) but what the code I should change? or whether i should add (RealtimePlotterArduinoCode) to your arduino code (selfbalancing_robot_arduino_due) so that RealtimePlotterWithControlPanel/ BasicRealtimePlotter work fine?

            Thank you Sebastian

          • sebnil says:

            If I remember correctly the robot code already outputs the right data to the plotter. But if not, it is just print statements. Good luck! /seb

          • sebnil says:

            Please make a pull request on github to help people out who are struggeling with the same problem. And thank you for sharing your fix.

          • Gabriel says:

            I dont' have account github

            I have one question in your arduinocode(selfbalancing_robot_arduino_due) no code already outputs the right data to the plotter,But if not, it is just print statements ,Can you give example the print statements self-balance ARM robot connection your Realtime plotter such as your video on youtube? And in your github selfbalancing-robot-v2 no code vReadIMUTask, i compile in arduino code 'vReadIMUTask' was not declared in this scope in arduino, i think the code outputs the right data to the plotter it in the vReadIMUTask

            ,Please help me, I confuse

            Thank you Sebastian

  10. ICY says:

    Hello, thanks for your info. I just got some errors because of Processing Version (I am using Processing 3.1.1).
    Errors are like " The method add(Component) in the type Container is not applicable ....".
    Is there any site that I can refer in order to fix your code for Processing 3.1.1.

  11. Robert says:

    Hello Sebastian,
    I'm working on a project were I use dual channel PID to balance a ball on a surface with 2 degrees of freedom. The project cant be seen here: https://www.youtube.com/watch?v=0MD_lD6VtoU
    The ball sits on a resitive touch screen that sends X and Y location of the ball and then 2 servo motors (one in X direction and another in the Y) actuate the system.

    I was able to successfully plot the X and Y values using your BasicRealtimePlotter. However I'd like to have two separate real-time line graphs. One to plot the X direction and the other for the Y direction.
    I tried modifying your code to remove the bar graph and instead replace it with a line graph. However I ended up with one graph drawing all the axis and labels with no lines plotting and another with the lines plotting but no axis or labels drawn.

    Is there anyway you could help me with this or point me towards some source to allow me to plot two separate real-time plots?

    Thanks in advance,

  12. Simon says:

    Thank you so much! This is perfect... I'm building an LED display connected to an Arduino with an MSGEQ7 chip, for live guitar performances... I was opening Putty logs in excel and graphing... over and over and over again lol This is so useful to be able to visualise live, to help me work out how I can translate the spectrum info and design some funky drawing routines back on the Arduino 🙂 Thanks again!!

  13. Felix says:

    Is there anyway to increase graph plotting location and size ?

  14. Riya Shah says:

    it is not compatible with arduino on windows 10 ?
    Because while unzip step, it shows error.

2 Pings/Trackbacks for "Realtime data plotter"

Leave a Reply

Your email address will not be published. Required fields are marked *