Custom QT Application with Arduino over Ethernet

I have been thinking of a project for a long time but never had the time to start since it seems like its a big operation to learn TCP communication in QT.

What i want to accomplish is to write a program in QT and use ehternet connected Arduinos as nodes. I want to sort them by type of I/O signal and output its data in variable tables for further use.
So a kind of modular system. The Arduinos would have a fixed HW setting in their own runtime program that would be recoqnized by the QT program.

For starters i would be super happy just to be able to connect and read a single input of a specific datatype :slight_smile:

Is there someone out there with knowledge of both QT and Arduino?

Isn't QT used primarily for creating user interfaces? If that is the case, you'll need some sort of a backend to store data from your Arduino nodes, and just query that from your QT application

Yes the QT is an application framework and will be used for the frontend or GUI.
It could be used as a backend for connection to the arduino aswell.
For storing the data i have tons of options i guess :slight_smile:
Some local DB format would do for speed.

Since the Arduino ethernet shield have a server i can run some HTML application from where i can put or get information from the Arduino.
The Arduino would cyclically update the HTML application.
I dont want to use a webpage for getting the data since it would be too slow i just want to know the current state of bits or if the total ammount of bits could be converted from array of bits into a word it would be fast to sent from the device to the backend and then converted from word to array of bits presented in the GUI where i could label them.

If HTML could be used what would be the smallest and fastest way to present the I/O information to the GUI backend?

I don't use HTML for my stuff, I just use raw TCP/UDP to talk to the Arduino. It's much simpler exchanging data without parsing the HTML overhead.

Yeah i can see why that would be a better sollution. Is that method more private/secure also than using HTML where you can read the transmitted packets if you tap in to the network with like Wireshark?

Reason for the HTML suggestion was that i think would be a little bit simpler to get up and running but no way near good.

I bet that there is pretty good support on the Arduino ide of the problem.
But is there any good starter guides for getting QT ready, like libraries and examples?
Is there another framework more suitable than QT, only reason for me using it is that i have been using it on and off for 11 years so im familiar with it which helps :slight_smile:

The GUI would be my interface for collecting and manipulating data.
I would have to create a server type service for connecting to and maintaining assigned nodes on the network and also which would be the pipeline between the systems.
Also i was thinking about some UDP service which could help me assign unassigned nodes when you connect them to the network. That would be my later task if i get the other things running of course. For starters i think most of the connectivity tasks would have to be done ready in both ends.

Unless you are using HTTPS for HTML, raw TCP/UDP is just as insecure as plaintext HTML. If you do want secure HTML, then you don't have a choice but implement HTTPS which require lots of resources. For raw TCP/UDP, you can implement some basic encryption without having to deal with public/private keys.

In my honest opinion, you should separate the GUI from the data collection so you have the option to change the interface whenever you feel like it. I'm sure QT has some API that can talk to databases etc.

Personally, I use a locally hosted Splunk as my back-end. Very easy to setup "UDP listeners" and very flexible for data formatting. The messages from my "sensor nodes" are literally syslog UDP messages

With a little bit of REGEX parsing, Splunk can visualize the data

There is also a Splunk REST API so technically, you can have another application such as QT to retrieve the data and display it in another format. Currently, I'm learning Android development so I can have a cheap always ON Android tablet to display the data instead of opening my PC every time

Hehe id rather not use the x509 certificates since they are party stoppers.
Took me a while to learn how to create, implement and use them.
The project is not a public project anyways, just for the fun of it!
Keep it simple seems fine to me then :slight_smile:

Will look in to you suggestion!
Thanks!

Hello again!

Just wanted to share a good find for starting with networking with QT i think.

[Network Examples | Qt Network 5.15.12](https://QT Network Examples)

Not really sure where i want to start but i was thinking of running through the example to see if i find something of interest.

Any suggestions?

Think i might go with the TCP Chat for this and do a dirty remake to make it fit my project.

I think it has the components i would need to have for finding peers and letting them know they are available and connected. Once they are connected i can start requesting them for data.

The data will be dumped in another program and used in the GUI which obviously needs retouching to fit the purpose :slight_smile:

Really dont know how buffers work with this and how or if i want to format everything or just chunk it and parse?

I usually go with the example where I can generate the test data the easiest. There's a network utility in Linux called nc that allows you to open socket on any port as a server or client.

Once you got the application working, you can then try it with a real Arduino or something