SerialPlot – Realtime Plotting Software for UART/Serial Port


SerialPlot is my new open source adventure. It allows you to plot data coming through your computers serial port. To be honest, nowadays it’s most likely this will be a USB port, emulating serial port.

It supports binary and ASCII data formats. Binary formats include uint8, int8, uint16, int8, uint32, int32 and float. There is also multi channel support. SerialPlot doesn’t require a sophisticated package format. It just assumes each channels data is sent consecutively. That means all channels should be synchronized. In case of ASCII it’s different. ASCII input actually can be in CSV (comma separated values) format. Each channel is sent as a column.

Below is a screenshot of the SerialPlot:

 

Currently there is installation package for debian/ubuntu only. I hope to add windows support soon, and some other linux distributions as well. You can download debian package from here.

Update: Check out the hackaday page for downloads.

Source code is released under GPLv3 license. You can obtain code from my mercurial repository over at bitbucket. I also have created a project page at hackaday.io.

Update: Download source code from https://hg.sr.ht/~hyozd/serialplot/

If you have any trouble installing/building, please let me know.


95 responses to “SerialPlot – Realtime Plotting Software for UART/Serial Port”

  1. Hi, Your SerialPlot is very interesting. Can I ask you a question? I would like to transfer a data package to computer by SerialPlot, what format of the data package could be? I’m just using ADC to convert and DMA, then transfer through UART and STM32F4 microcontroller. Thanks in advance!

    • Hey Jack, I’m glad you are interested.

      SerialPlot supports binary and ASCII (text basically) formats. Simplest to implement in my opinion is the ASCII format. You just print the data in seperate lines. Like this;

      printf("%d,%d\r\n",chan0,chan1)

      But this can be slow and insufficient depending on your sampling speed and uart speed. In this case you should use one of the binary formats. Let me know if you want to know about binary formats.

      • Thanks for replying! I just use DMA to collect data from a single channel ADC. So there are 3 options: binary, acsii, and custom frame. I’m going to select the third option for this purpose of sending, for example, 10 bytes from memory (DMA-UART). So how does the frame look like?

        • Okay, so you want to package your data in a binary frame. The reason third option is called ‘Custom Frame’ is that it allows you to define your own custom frame format. Let me give you an example frame format. First we should determine our sample type and how many channels are there. Lets say sample type is 16-bit signed integer, which is defined as int16_t in standard C. And lets say we have 2 channels to send. We also decide that every frame contains 5 sample of each channel. That means our payload size will be 2 (bytes per sample) x 2 (channels) x 5 (samples) = 20 bytes. We also need to select some kind of “frame start indicator”, let say this should be 0x7E. An example frame would be like this:

          I hope this image explains things. Let me know if it doesn’t.

          Now we should set these options in serialplot “data format” tab.

          Frame Start: 0x7E
          Channels: 2
          Frame Size: Fixed and ’20’
          Number Type: int16
          Endianness: Little (STM32 is little endian)
          Checksum: not checked

          Rest is implementing the code to send data in this format. I think you can pull that off. If you need any help or want to know about other features (flexible frame size, checksum) just let me know.

          • I just have 1 channel, and 10 float data samples. Here is my code but it does not work. What’s wrong here?
            HAL_ADC_Start_DMA(&hadc1,(uint32_t*)ADC_Value,10);
            for (int i=0;i<10;i++)
            {
            temp[i] = (float)(3.3*ADC_Value[i]/256);
            }
            printf("%d",0xFF); // Frame Start = 0xff
            printf("%d",0x01); // Number of channels = 1
            printf("%d",0x28); // Fixed size of data = 40
            for (int i=0;i<10;i++)
            {
            printf("%f",temp[i]); // float data
            }

            • First, when in custom frame mode, you shouldn’t use printf function. Printf converts numbers to text, in binary mode you should send them directly. I don’t know what library you are using but you should have a function to send data byte by byte. Let’s say we have a function named uart_send(uint8_t data) that sends 1 byte from uart. In this case you would send the frame start with this:

              uart_send(0xFF);

              Second, you don’t send number of channels as part of the frame. Maybe I should add this as an option. But it is not supported at the moment.

              Third, if you select the ‘Fixed Size’ option you don’t send the payload size as part of the frame, you should set it in the SerialPlot interface only.

              Here is a complete example (I’m assuming you have a function named `uart_send`):


              float temp[10];
              uint8_t* data = (uint8_t*) temp; // type casting for ease of access

              uart_send(0xFF); // send frame start

              uart_send(40); // payload size, remove this line if 'fixed size' option is selected

              // send samples array byte by byte
              for (int i = 0; i < 40; i++) { uart_send(data[i]); }

              I hope this is helpful.

  2. Hi
    Your tool is Amazing! it helped me alot.
    I’d like to know if it’s capable of logging streaming data into a txt file or a spreadsheet?\

    thanks

    • Hi Isra, thanks a lot for your compliments! I’m very glad to be helpful.

      I’m guessing you have created this issue? SerialPlot does export what you see on the screen. If you change the plot width from the “Plot” tab, it will plot more data that you can export. But to be honest, above 10000 points it starts to get really slow. I think this is not enough for you. I will try implement an interface to log everything to a file. This shouldn’t be hard…

      • Hi again
        I’ve tried it with my Arduino Pro Micro and it seems to not capture anything. Is there a reason for that?
        Note that Arduino Pro Micro and Leonardo use virtual serial communication, could that be the reason?
        thanks

        • SerialPlot should work fine with virtual serial ports. If you can open that ‘port’ with a generic terminal application, serialplot should be able to open it as well. I suggest you to check your data with a terminal application. What data format are you using? Are you seeing any errors in “Log” tab?

          • No I’ve tried it with the serial monitor and RealTerm (captured the data to a txt file too). The readings were as expected, this only happens when I try it with serialPlot.

  3. Hi,

    I just want to say thank you for your efforts on creating SerialPlot. It works very well and has every feature that I expect from a serial plotter.

    Cheers.

    • Thanks : ) I’m glad to hear that. Let me know if you need anything or have ideas to implement.

  4. Hi hyOzderya, thanks so much for SerialPlot, very easy to use. I have a PSOC 5 spitting out thermistor temperature data.

    Greg

  5. Hi, hyOzderya.

    I want to thank you for SerialPlot. I needed a serial plotter that was a bit more configurable than the one in the Arduino IDE. Having looked at lots of plotters that were either too simple or horribly complicated to set up, I found SerialPlot, and I had it doing everything I wanted in 5 minutes flat. It’s beautifully designed. You’ve done a great job.

  6. Thanks for a useful tool, I’m currently making a tool for graphs on stm32, sd card and TFT display for data acquisition. A very useful function is to scale the graph both horizontally and vertically.

      • This scaling looks just like plugging and moving the graph in the Saleae Logic analyzer.

        • I’m sorry. I still don’t get it. Do you mean zoom with the scroll wheel?

          By the way if you haven’t noticed, you can press and drag the mouse over the X and Y axes for horizontal/vertical zoom in a precise manner.

    • Robert, thanks for sharing this 🙂 I’m always happy to see SerialPlot being used. I personally prefer 1px lines because it allows more detail but I agree that this should be an option. I will add it to my TODO list.

  7. Hey Hasan, thank You for creating this amazing UART data plot and save program. It is perfect suitable for my paper! But when Im trying to catch data over your program, it seems to do over sampling with constant 44Hz. Im 100% sure that desired frequency has to be 100Hz, but 92 is shown on FFT. Do You have any idea how to fix this?

    • Juraj, I don’t understand your problem. Serialplot may not be able to keep up with the incmoning data rate sometimes and drop data. But it’s usually very good up to 10-20 kilo samples per second. I don’t know what your sample rate is, but I wouldn’t expect it to have a problem with 44Hz signal. I’m just guessing; maybe your baud rate is too small and you are missing data?

      • Baud rate is sufficient. My samole rate is 500Hz, Im sampling microphone. Imput accoustic (audio) signal is 100Hz. I collect 1024 samples with Serialplot, put it into Matlab, make FFT and it shows fundamental frequency at 92Hz insptead of 100Hz.

        • Juraj my signal processing skills aren’t very good but I think that; altough 500Hz sample rate for a 100Hz signal is enough in theory, in practice if you want accurate FFT results I recommend at least 10 times the frequency of your input signal or even higher as your sampling rate. 500Hz is too slow. I doubt that serialplot is missing any data. If it does you can usually notice it from the shape of the signal. In such case, there would be spikes in the signal (up or down).

          • For 100Hz signal 200Hz sampling is sufficient (Nyquist theorem) I had confirmed that by my previous data logger. Your Serialplot is showing accurate sample rate 500SPS in right down corner. But when I make FFT with respect of sampling f 500Hz it is showing as I said 92Hz. When I calculate FFT with respect of sampling frequency 540Hz it shows fundamental right at 100Hz. From this implies, that program is doing some kind of over sampling.

            • But serialplot doesn’t do sampling. It just gets the data from serial port, displays it and writes it to file. Unless some data is missing (unlikely at these speeds) it shouldn’t change the input signal at all. Maybe data is duplicated, or read twice? What is your data format? Have you tried capturing the data with another program and look at it? If you can provide me your SerialPlot settings file and the raw data from serialport I might try to reproduce the issue..

    • Well simple binary mode is pretty simple. I don’t think it needs explaining.

      In custom frame mode, format depends a lot on your settings. I will make up a simple example from my mind here.

      Frame start: AA BB
      Number of Channels: 2
      Frame size: Fixed = 4
      Number type: uint8
      Little endian, No checksum

      Example data: ch1=[0x10, 0x20, 0x30, 0x40] ch2=[0x15, 0x25, 0x35, 0x45]

      Corresponding binary frame: 0xAA 0xBB 0x10 0x15 0x20 0x25 0x30 0x35 0x40 0x45

      Notice that samples from different channels are interleaved. If there was a 3rd channels its samples would be in between not added to the end!

      If your frame isn’t a fixed size, number of bytes should be a byte right after the start bytes. It only includes number of bytes after itself not including checksum (if it’s enabled). For example above frame with payload size as a byte (0x08):

      0xAA 0xBB 0x08 0x10 0x15 0x20 0x25 0x30 0x35 0x40 0x45

      Hope this is helpful.

      • Thank you so much!
        By reading your posts, I have the understanding in custom frame format.
        My question is if I use simple binary, I can not plot multi-channels.
        So, the simple binary frame is simple fill: 0x10 0x15 0x20 0x35 0x40…
        Ma I right?

        • You can still use multiple channels in simple binary mode. Different channel’s samples follow each other. For example (number format is uint8):

          Channel 1’s samples: 0x10 0x11 0x12 …
          Channel 2’s samples: 0x20 0x21 0x22 …

          Sent data: 0x10 0x20 0x11 0x21 0x12 0x22

          As you may guess synchronization is going to be a problem. If a byte is missed while reading, everything will shift. You will either have broken data or wrong channel data. You have to manually fix the synchronization using “Skip Byte/Sample” buttons. In my experience if you have a serial port that is always open you don’t lose synchronization, things just work out. But if you are going to collect data for a long time you should be careful. Using custom frame is always the safer choice.

      • One port is enough for me, but I do have more than one data sream coming over the port. I’m experimenting with splitting the port and running two instances of serialplot.

  8. Again, this is a great tool. I use the multiple plot feature a lot. It would be nice if I could have multiple plots on each pane.
    I have dutycycle, current, and speed data from four motors. So, for example, I would like to plot all four currents in one pane and all four speeds in another.
    It would be so intuitive if I could just select a pane and then bring up the plot options.
    Thanks again for all your work.

  9. Dear Hasan,
    Thank you for excellent charting software. It is probably the best plotting tool for micros interfacing. Please add to the wishlist an option to draw wider signal lines. The thin lines are barely visible on sreenshots after inserting into docs.

    • Turns out it is already already in the wishlist 🙂 https://quire.io/w/SerialPlot/186/adjustible_plot_l… To be honest I have other things to sort out before this. So It might take some time to implement. In the mean time, only other option is to export the data as csv and use another software to create nicer plots.

      Thanks for mentioning it anyway.

      • Thank you for responding and providing a link to Todo-list. May I also want NOT to “put a PAUSED text on the screen”. I use Pause button to make a screenshot of the chart for further use in the docx! Having a PAUSED label on the screen voids Pause option for me!
        Regards

        • Yeah you are right. Anything on screen can be annoying at some point. I should find another way to do it. In the mean time, using “snapshots” feature can be an alternative to pausing.

  10. Great tool,
    i have installed it under windows and linux. Now I build the newest serialplot under linux which worked very well. But all attempts to build under windows went wrong. Tried with Qt Creator, Visual Studio, cmake – throws plenty of errors. Can I get somewhere the newest binary for winfows instead?

  11. Dear.

    I want to use the communication speed higher than 256,000bps.
    I think it would be great if you modified it.
    Other features are great too.

    • Kwon, you can enter a custom baud rate into the baud rate selection box. It is also a text editor. It should work as long as entered baud rate is supported by your platform.

  12. Dear Hasan,
    Is there an option to control SerialPlot settings from the microcontroller side? For example, by sending some command sequence, which would adjust number of channels, data type, frame start, etc.? This way the SerialPlot can be configured automatically.

    • No there isn’t at the moment. It’s long term planned feature.

      There is a command line option that allows you to load a given configuration file. It is not the same thing. This can only bu used when starting the serialplot from the command line or from a script. But I thought it may be useful to you.

  13. Hasan,
    The “snapshot” feature is nice, but is hard to use for making screenshots. Two issues: (1) the snapshot frame size is not persistent, that is next snapshot is default small square size, not the last used size. The snapshot size is not saved in Settings either, so it is not possible to make consistently-sized screenshots for using in documents. (2) it would be nice to have a Snapshot export in PNG or JPEG formats.
    Please consider this for wishlist.
    PSoC77

      • Thank you,
        Also related to snapshot: it displays all signal traces, including invisible ones (unchecked in the Plot tab). Looks strange.
        PSoC77

  14. Dear.
    Below the graph are the values 0, 200, 400, … 1000.
    I want to use this as 0 ~ 10000 or 0 ~ 100000.

  15. Hasan,
    In the above example re: Custom Frame format, how many times the Checksum byte should be inserted if Checksum is enabled?
    Frame start: AA BB
    Number of Channels: 2
    Frame size: Fixed = 4
    Number type: uint8
    Little endian
    Checksum: enabled

    Example data:
    ch1=[0x10, 0x20, 0x30, 0x40]
    ch2=[0x15, 0x25, 0x35, 0x45]

    Is following binary frame correct?
    0xAA 0xBB ‘ 0x10 0x15 CS ‘ 0x20 0x25 CS ‘ 0x30 0x35 CS ‘ 0x40 0x45 CS
    each CS byte is calculated from two previous bytes; the asterisk is added for clarity.

    • There should be only one checksum value at the end of the frame. Not for each ‘sample set’.

      Correct frame would be like this (last byte is checksum):

      0xAA 0xBB 0x10 0x15 0x20 0x25 0x30 0x35 0x40 0x45 0x1F

      Also important your frame size should be set to “8”. Frame size actually means total payload size. Since your frame contains 4 uint8 samples for 2 channels, frame size is 8.

  16. Hi Hasan, First of all thanks for your effort doing this usefull program. I wonder if you could give me a hand. I’ve tried to install Serialplot in my ubuntu 18.04 and it doesn’t work. I’ve tried also to use the appimage and it doesn’t work. If I change the baud rate it plots signals but when I match the baud rate with my arduino program it plots nothing. ¿could you tell me if I am doing anything wrong? Thanks

    • Ruben, what is your baud rate and which data format are you using? I don’t remember any problems related to baud rate. Although there are bugs that part of the software is quite stable. Please make sure your data coming from arduino and baud rate is correct using a text terminal software.

    • Build difficulties on windows is keeping me back. To be honest I haven’t been giving enough attention to this project for the last 2 years. : (

  17. hi Hasan
    i try your serialplot, i think it is very useful, but i only can used it for simple binary input
    i have no success on plotting ascii data , event when i use terminal program like realterm to send ascii data manually, it is not plotting any graph , would you tell me what is possible reason with this problem?, is there any special format to send ascii data, (btw i only try one channel plot only)

    • Ascii data is expected in CSV form. But if you are sending just one channel, simply sending each sample at a new line should be enough. Like this:

      1334.43
      3343.34
      3422.958

  18. Everywhere I go to download SerialPlot brings me back to downloading it from BitBucket and BitBucket says that they no longer support mercurial repositories. The hackaday.io update states that its been moved over to source hut, but the windows download link on sourcehut also brings me back to bitbucket and the same issue. Not sure where to go from here.

  19. Thank you for writing a great program! I use it for all kinds of projects. One issue I run into recently is not enough digits written to file. It only writes 6 digit floating number, but it would be useful to write all digits available. Also it would be useful to manually specify Y plot range with more than 2 digits after decimal.

  20. It doesn’t look like there is any way to download this for windows anymore. Is there somwhere I can still find it?

    • This has been on my table for quite some time. But unfortunately I couldn’t make it work. Sorry to disappoint.

  21. Hi Hasan,
    SerialPlot is awesome. As an embedded SW designer, I’ve stared at numeric data on terminals so many times wishing I could see it in real-time plotted form. SerialPlot does all that and much more in a very useful and easy to use manner. Well done on an excellent piece of software. Wish I had your PC based SW skills!
    There is only one thing I would like to change. The channel name appears right there where newest data appears as it scrolls in from right to left. Is it possible to move the text elsewhere? (perhaps on the far left where oldest data scrolls out?)
    Thanks again for your great SW and generosity to share it.
    Leon.

  22. Hi,
    Would it be possible to add more channel (>64)? I’m currently using the Bar Plot and I need 72 for instance.
    Is it a difficult modificaiton ?
    BR,

    • Yes it is possible and easy modification. You can search the source code for `MAX_NUM_CHANNELS` define and increase it. Let me know if you can’t compile it.

  23. merhabalar üründen desteğini çekmiş bir firmanın laboratuvar makinası bozuldu ve basit bir çıktıyı alamıyorduk. yazıcısını da artık satmıyorlar. yazıcısı serial port ile çalışıyordu. raspberry pi ile serialden veriyi çektim ve bir txt ye kaydediyorum. ama ekranda ve yazıcı çıktısında bir grafik var. o grafik “r0A?* b1W?*” gibi komutlarla txt ye düşüyor ve çevirmeyi başaramadım. örnek okuma ekteki gibi https://paste.ubuntu.com/p/PXwtR7P73C/ . acaba bunu hangi yolla grafik olarak çevirebilirim…

    • Text ve binary karışık bir data yapısına benziyor. Hiç bir fikrim yok. Ama bence serial port yazıcı protokollerine bakmanız gerekiyor. Kullandıkları yazıcı standard bir formatta çalışıyor olabilir.

  24. The current Frame Size is limited to 255, which prevents sending larger frames. For example, sending 512 data packets each having 4 channels of int16 data would require FrameSize = 512x4x2 = 4096. Would it be possible to increase this parameter to a larger value (say 65535) in future releases?

  25. Hasan,
    it would be nice if in the Command string window, hitting the ENTER key would send the command (without need to use a mouse to click the SEND button). I believe that is a natural way to send a command with manual input.

    • That is probably the automatic update checker. You can disable it from the help menu. I already did a commit to disable automatic checker by default.

  26. I believe you used to offer a 64-bit serial plotter for Win10, but no longer see it available. There are a host of tutorials from TopTechBoy using that 64bit plotter. The 32-bit version you offer did not produce the same results and often froze.

  27. Merhaba,
    serialplotter için tebrik ederim. Gördüğüm işini iyi yapan en iyi usart-plotter olmuş. Yüksek hızda gelen verileri hatasız çizebiliyor ve ekrankartı ve işlemciye çok yüklenmiyor. DSP bazlı ve/veya rf iletişim kuran yüksek hızlı sistemler tasarlıyorum. Nisbeten yüksek hızlı logging gerekiyor. 3Mbps gibi baud hızlarını kullanıyorum. Baud hızı seçiminde seçeneklerde olmayan hızları girebileceğimiz giriş ilave edebilir misiniz. 256k limiti benim testlerimi güvensiz kılıyor. Yazılımınız sayesinde qt’yi de gördüm, inceleyeceğim.
    Yazılım için teşekkürler.

Leave a Reply to hyOzderya Cancel reply

Your email address will not be published.