Monday, August 6, 2012

qSerialTerm: Qt based Serial Port Data Acquisition Software with Moving Plots

With its latest update, qSerialTerm can now be use as a Serial Port Data Acquisition System (DAS) or as a Serial Port Terminal Emulator.

The DAS mode includes, on top of the data logger feature, a moving plot feature. To achieve these moving plots, qSerialTerm uses libqwt for plotting. This means, that libqwt is a new dependency for qSerialTerm.

The user can select between these two modes using the "From Device" menu. In the following image, you can see qSerialTerm  configured as a DAS.

qSerialTerm in "plot" mode.

The user can configure the number of plots and the data type, endianness and format of the incoming data.

On the following image, you can see the a fully configured qSerialTerm ready to receive two "variables".

qSerialTerm configured for two plots.

These "variables" must be grouped as packets, e.g. let's say we want to plot 3 variables, these variables are floats, and are encoded as little endian raw binary. Each packet of data will contain one data point for each variable, summing a total of 12 bytes (4 bytes per float) per packet.

Packet Variable 1 Variable 2 Variable 3
1 float1 float2 float3
2 float4 float5 float6
Two structured packets

qSerialTerm should receive these two packets in the following order: float1, then float2, and so on until float 6. Then, two data points will be added to each plot.

Demostration


I'll now show some screenshots of qSerialTerm in operation. For these demos, I shorted the TX and RX lines of my USB <-> Serial converter, this means that every byte I send from the PC was echoed back to the PC.

The data was sent using the qSerialTerm's "frame" feature. Using the continuous mode, I sent data, whose values varied with sliders, this data echoed back to the PC, and ended being added to the plots.

1 uint8 variable

2 int8 variables

I'll post a demo video later.

Repository


You can get qSerialTerm source code from this repository.

More information

qSerialTerm as a serial port terminal emulator
qSerialTerm for data logging
qSerialTerm for serial servomotor control
qSerialTerm for image visualization 

5 comments:

  1. I'm trying to compile this, and i got sth like that:

    In file included from plot.cpp:23:0:
    circularbuffer.h:23:29: fatal error: qwt_series_data.h: Nie ma takiego pliku ani katalogu
    compilation terminated.

    "Nie ma takiego pliku.." == file not exists

    I'm using ubuntu 12.10, libqwt5-qt4-dev and qtserialport from github.
    When i changed to libqwt-dev:
    In file included from plot.cpp:21:0:
    ui_plot.h:27:22: fatal error: qwt_plot.h: Nie ma takiego pliku ani katalogu
    compilation terminated

    So, how to build it?

    ReplyDelete
    Replies
    1. Hello Marc,

      This program uses libqwt version 6 or better. The correct package to use in Ubuntu 12.10 is "libqwt-dev".

      You should try cleaning the project (using Build > Clean) since you changed/updated the qwt library. If that doesn't work you can try cloning the project again.

      The other thing that could be missing could be libqt-dev, but then you won't be able to launch the "qmake" command, which is necessary before the "make" command.

      Don't forget to tell us whether this worked or not.

      Delete
  2. what version are you using? QtAddOnSerialPort How install this?

    ReplyDelete
  3. Thank you for your article. I really enjoyed reading your post, and hope to read more. Vapeciga

    ReplyDelete