Make Graphs on Qt and Plot Your Arduino Measurements

Introduction: Make Graphs on Qt and Plot Your Arduino Measurements

As promised I come in my second instructable to explain you how to program graphs on Qt. This will allow you to monitor measurements from a probe plug on your arduino. At the end of this instructable you will be able to program Labview-like software for free.

In this instructable you will learn :
how to receive data from your arduino
how to plot them on a graph

To do this I use Qt (say cute) which I already presented in my former instructable :
Control your arduino from your PC with the Qt Gui

To start to write your programs you will need to:
install Qt (sounds obvious ;) ) :
install the additional library to read the port com : see my former instructable
install the additional library to put graphs in your programs : see the next step.

PS : As you probably notice it, I am not a native English speaker. I would be please if you can correct me.

Step 1: Installation of QWT

Qwt is a additional library which allows you to add graph in your qt program.

I assume that you have already installed Qt, and you have basic skills in programming in C/C++.

First you need to get qwt from source-forge :

Then you extract the files.

Here comes the tricky part. The files you downloaded are not compiled.
So you must compiled them. To do so you must start the Qt prompt console.
You can find it on Windows in :
start menu,
Qt 4.7.3 for Desktop (MinGW)

Then send the command that are on picture 2.

Congratulation, you perfectly compiled the library!

Step 2: Let's Program

Now you have installed all the library you need (qwt and qextserialport) your are ready to program.

I join a little example of a program (see the video in the introduction) which show data send from an arduino. In the next step I give a little program for your arduino to play with this progrme. If you want to do more complicated graphs you can have a look to the folder "examples" of the qwt lib.

All the description are into the program.

If when compiling you have the error n°1073741515 (or maybe another) that mean that you need to put the qextserialportd.dll into your .exe folder. Don't forget to also add the qwt.dll.

Step 3: Program Your Arduino

Here is the program to send data.
It send only random data, up to you to improve it and add real probes.

void setup()
Serial.begin(9600); //initialisation of the port
randomSeed(analogRead(0)); //randomise the random function

int randNumber;

void loop()
randNumber = random(255); //generation of a new random number
Serial.print(randNumber, BYTE); //sending of the number
delay(1000); //wait 1 second

Step 4: Conclusion

I hope this instructable helps you to develop your own project.
The arduino is not the only device which uses the rs232 communication. This instructable can also be useful, for example in my job, to communicate  with vacuum probes, micro quartz scale, ...

Fill free to ask questions if you fill lost.

Microcontroller Contest

Participated in the
Microcontroller Contest

Be the First to Share


    • Pocket-Sized Speed Challenge

      Pocket-Sized Speed Challenge
    • Super-Size Speed Challenge

      Super-Size Speed Challenge
    • Audio Challenge 2020

      Audio Challenge 2020

    3 Discussions

    Mario ROLOFF
    Mario ROLOFF

    6 years ago

    Hi, great demo! Could you send the Qt source code?

    I am not having success with the data plotting (Qwt).

    Thank you in advance,